-
Notifications
You must be signed in to change notification settings - Fork 0
/
jenkins.yaml
214 lines (213 loc) · 7.39 KB
/
jenkins.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
apiVersion: v1
kind: Template
labels:
template: jenkins-ephemeral-template
message: A Jenkins service has been created in your project. Log into Jenkins with
your OpenShift account. The tutorial at https://github.com/openshift/origin/blob/master/examples/jenkins/README.md
contains more information about using this template.
metadata:
annotations:
description: |-
Jenkins service, without persistent storage.
WARNING: Any data stored will be lost upon pod destruction. Only use this template for testing.
iconClass: icon-jenkins
openshift.io/display-name: Jenkins (Ephemeral)
openshift.io/documentation-url: https://docs.openshift.org/latest/using_images/other_images/jenkins.html
openshift.io/long-description: This template deploys a Jenkins server capable
of managing OpenShift Pipeline builds and supporting OpenShift-based oauth login. The
Jenkins configuration is stored in non-persistent storage, so this configuration
should be used for experimental purposes only.
openshift.io/provider-display-name: Red Hat, Inc.
openshift.io/support-url: https://access.redhat.com
tags: instant-app,jenkins
creationTimestamp: null
name: jenkins-ephemeral
objects:
- apiVersion: v1
kind: Route
metadata:
annotations:
template.openshift.io/expose-uri: http://{.spec.host}{.spec.path}
name: ${JENKINS_SERVICE_NAME}
spec:
tls:
insecureEdgeTerminationPolicy: Redirect
termination: edge
to:
kind: Service
name: ${JENKINS_SERVICE_NAME}
- apiVersion: v1
kind: DeploymentConfig
metadata:
annotations:
template.alpha.openshift.io/wait-for-ready: "true"
name: ${JENKINS_SERVICE_NAME}
spec:
replicas: 1
selector:
name: ${JENKINS_SERVICE_NAME}
strategy:
type: Recreate
template:
metadata:
labels:
name: ${JENKINS_SERVICE_NAME}
spec:
containers:
- capabilities: {}
env:
- name: OPENSHIFT_ENABLE_OAUTH
value: ${ENABLE_OAUTH}
- name: OPENSHIFT_ENABLE_REDIRECT_PROMPT
value: "true"
- name: KUBERNETES_MASTER
value: https://kubernetes.default:443
- name: KUBERNETES_TRUST_CERTIFICATES
value: "true"
- name: JENKINS_SERVICE_NAME
value: ${JENKINS_SERVICE_NAME}
- name: JNLP_SERVICE_NAME
value: ${JNLP_SERVICE_NAME}
- name: "CASC_JENKINS_CONFIG"
value: "/jenkins-conf"
- name: "SECRETS"
value: "/secrets"
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.labels['name']
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: ' '
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 30
httpGet:
path: /login
port: 8080
initialDelaySeconds: 420
timeoutSeconds: 3
name: jenkins
readinessProbe:
httpGet:
path: /login
port: 8080
initialDelaySeconds: 3
timeoutSeconds: 3
resources:
limits:
memory: ${MEMORY_LIMIT}
securityContext:
capabilities: {}
privileged: false
terminationMessagePath: /dev/termination-log
volumeMounts:
- mountPath: /var/lib/jenkins
name: ${JENKINS_SERVICE_NAME}-data
- name: "${JENKINS_SERVICE_NAME}-conf"
mountPath: "/jenkins-conf"
readOnly: true
- name: "${JENKINS_SERVICE_NAME}-secrets"
mountPath: "/secrets"
readOnly: true
- name: "mega-backups"
mountPath: "/mega-backups"
dnsPolicy: ClusterFirst
restartPolicy: Always
serviceAccountName: ${JENKINS_SERVICE_NAME}
volumes:
- name: ${JENKINS_SERVICE_NAME}-data
emptyDir:
medium: ""
# persistentVolumeClaim:
# claimName: ${JENKINS_PVC_NAME}
- name: "${JENKINS_SERVICE_NAME}-conf"
configMap:
name: "${JENKINS_SERVICE_NAME}-config"
- name: "${JENKINS_SERVICE_NAME}-secrets"
secret:
secretName: "${JENKINS_SERVICE_NAME}"
- name: mega-backups
persistentVolumeClaim:
claimName: ${MEGA_BACKUP_PVC}
triggers:
- imageChangeParams:
automatic: true
containerNames:
- jenkins
from:
kind: ImageStreamTag
name: ${JENKINS_IMAGE_STREAM_TAG}
lastTriggeredImage: ""
type: ImageChange
- type: ConfigChange
- apiVersion: v1
kind: ServiceAccount
metadata:
annotations:
serviceaccounts.openshift.io/oauth-redirectreference.jenkins: '{"kind":"OAuthRedirectReference","apiVersion":"v1","reference":{"kind":"Route","name":"${JENKINS_SERVICE_NAME}"}}'
name: ${JENKINS_SERVICE_NAME}
- apiVersion: v1
kind: Service
metadata:
name: ${JNLP_SERVICE_NAME}
spec:
ports:
- name: agent
nodePort: 0
port: 50000
protocol: TCP
targetPort: 50000
selector:
name: ${JENKINS_SERVICE_NAME}
sessionAffinity: None
type: ClusterIP
- apiVersion: v1
kind: Service
metadata:
annotations:
service.alpha.openshift.io/dependencies: '[{"name": "${JNLP_SERVICE_NAME}",
"namespace": "", "kind": "Service"}]'
service.openshift.io/infrastructure: "true"
name: ${JENKINS_SERVICE_NAME}
spec:
ports:
- name: web
nodePort: 0
port: 80
protocol: TCP
targetPort: 8080
selector:
name: ${JENKINS_SERVICE_NAME}
sessionAffinity: None
type: ClusterIP
parameters:
- description: The name of the OpenShift Service exposed for the Jenkins container.
displayName: Jenkins Service Name
name: JENKINS_SERVICE_NAME
value: jenkins
- name: "JENKINS_PVC_NAME"
value: "jenkins"
- description: The name of the service used for master/slave communication.
displayName: Jenkins JNLP Service Name
name: JNLP_SERVICE_NAME
value: jenkins-jnlp
- description: Whether to enable OAuth OpenShift integration. If false, the static
account 'admin' will be initialized with the password 'password'.
displayName: Enable OAuth in Jenkins
name: ENABLE_OAUTH
value: "true"
- description: Maximum amount of memory the container can use.
displayName: Memory Limit
name: MEMORY_LIMIT
value: 512Mi
- description: Name of the ImageStreamTag to be used for the Jenkins image.
displayName: Jenkins ImageStreamTag
name: JENKINS_IMAGE_STREAM_TAG
value: jenkins:2
- description: Name of the PVC for the mega backups
displayName: Mega Backup PVC
name: MEGA_BACKUP_PVC
required: true