-
Notifications
You must be signed in to change notification settings - Fork 14
/
jenkins-persistent-template.yml
329 lines (328 loc) · 9.98 KB
/
jenkins-persistent-template.yml
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
---
kind: Template
apiVersion: v1
metadata:
name: jenkins-persistent
creationTimestamp:
annotations:
openshift.io/display-name: Jenkins (Persistent)
description: |-
Jenkins service, with persistent storage.
NOTE: You must have persistent volumes available in your cluster to use this template.
iconClass: icon-jenkins
tags: instant-app,jenkins
template.openshift.io/long-description: This template deploys a Jenkins server
capable of managing OpenShift Pipeline builds and supporting OpenShift-based
oauth login.
template.openshift.io/provider-display-name: Red Hat, Inc.
template.openshift.io/documentation-url: https://docs.openshift.org/latest/using_images/other_images/jenkins.html
template.openshift.io/support-url: https://access.redhat.com
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.
objects:
- apiVersion: v1
kind: ImageStream
metadata:
labels:
app: jenkins
name: jenkins
- kind: Route
apiVersion: v1
metadata:
name: "${JENKINS_SERVICE_NAME}"
creationTimestamp:
spec:
to:
kind: Service
name: "${JENKINS_SERVICE_NAME}"
tls:
termination: edge
insecureEdgeTerminationPolicy: Redirect
- kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: "${JENKINS_SERVICE_NAME}"
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "${VOLUME_CAPACITY}"
- apiVersion: v1
kind: BuildConfig
metadata:
labels:
app: jenkins
name: jenkins
spec:
output:
to:
kind: ImageStreamTag
name: jenkins:latest
resources:
limits:
memory: ${MEMORY_LIMIT}
source:
contextDir: ${CONTEXT_DIR}
git:
uri: ${REPO_URL}
ref: ${REPO_REF}
secrets: []
type: Git
strategy:
sourceStrategy:
from:
kind: DockerImage
name: docker.io/openshift/jenkins-2-centos7:v3.11
env:
- name: GIT_SSL_NO_VERIFY
value: 'true'
type: Source
triggers:
- type: ConfigChange
- imageChange: {}
type: ImageChange
status:
lastVersion: 0
- kind: DeploymentConfig
apiVersion: v1
metadata:
name: "${JENKINS_SERVICE_NAME}"
creationTimestamp:
spec:
strategy:
type: Recreate
triggers:
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- jenkins
from:
kind: ImageStreamTag
name: "${JENKINS_IMAGE_STREAM_TAG}"
namespace: "${NAMESPACE}"
lastTriggeredImage: ''
- type: ConfigChange
replicas: 1
selector:
name: "${JENKINS_SERVICE_NAME}"
template:
metadata:
creationTimestamp:
labels:
name: "${JENKINS_SERVICE_NAME}"
spec:
serviceAccountName: "${JENKINS_SERVICE_NAME}"
containers:
- name: jenkins
image: " "
readinessProbe:
timeoutSeconds: 3
initialDelaySeconds: 3
httpGet:
path: "/login"
port: 8080
livenessProbe:
timeoutSeconds: 3
initialDelaySeconds: 420
failureThreshold: 30
httpGet:
path: "/login"
port: 8080
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: JAVA_OPTS
value: >-
-Dhudson.model.ParametersAction.keepUndefinedParameters=true
-Djenkins.model.Jenkins.logStartupPerformance=true
-Djava.security.egd=file:/dev/./urandom
-Djenkins.install.runSetupWizard=false
-Dhudson.DNSMultiCast.disabled=true
- name: JAVA_GC_OPTS
value: >-
-XX:+UseParallelGC -XX:MaxPermSize=100m -XX:MinHeapFreeRatio=20
-XX:MaxHeapFreeRatio=40 -XX:GCTimeRatio=4
-XX:AdaptiveSizePolicyWeight=90 -XX:MaxMetaspaceSize=500m
- name: GIT_SSL_NO_VERIFY
value: 'true'
- name: OVERRIDE_PV_CONFIG_WITH_IMAGE_CONFIG
value: 'true'
- name: OVERRIDE_PV_PLUGINS_WITH_IMAGE_PLUGINS
value: 'true'
- name: LOAD_SEED_JOB
value: ${LOAD_SEED_JOB}
- name: DSL_JOB_REPO
value: ${DSL_JOB_REPO}
- name: ENABLE_INFLUXDB
value: ${ENABLE_INFLUXDB}
- name: INFLUXDB_ROUTE
value: ${INFLUXDB_ROUTE}
- name: INFLUXDB_USERNAME
value: ${INFLUXDB_USERNAME}
- name: INFLUXDB_PASSWORD
value: ${INFLUXDB_PASSWORD}
- name: INFLUXDB_INSTANCE
value: ${INFLUXDB_INSTANCE}
- name: INFLUXDB_DATABASE
value: ${INFLUXDB_DATABASE}
resources:
limits:
memory: "${MEMORY_LIMIT}"
volumeMounts:
- name: "${JENKINS_SERVICE_NAME}-data"
mountPath: "/var/lib/jenkins"
terminationMessagePath: "/dev/termination-log"
imagePullPolicy: IfNotPresent
capabilities: {}
securityContext:
capabilities: {}
privileged: false
volumes:
- name: "${JENKINS_SERVICE_NAME}-data"
persistentVolumeClaim:
claimName: "${JENKINS_SERVICE_NAME}"
restartPolicy: Always
dnsPolicy: ClusterFirst
- kind: ServiceAccount
apiVersion: v1
metadata:
name: "${JENKINS_SERVICE_NAME}"
annotations:
serviceaccounts.openshift.io/oauth-redirectreference.jenkins: '{"kind":"OAuthRedirectReference","apiVersion":"v1","reference":{"kind":"Route","name":"${JENKINS_SERVICE_NAME}"}}'
- kind: RoleBinding
apiVersion: v1
metadata:
name: "${JENKINS_SERVICE_NAME}_edit"
groupNames:
subjects:
- kind: ServiceAccount
name: "${JENKINS_SERVICE_NAME}"
roleRef:
name: edit
- kind: Service
apiVersion: v1
metadata:
name: "${JNLP_SERVICE_NAME}"
spec:
ports:
- name: agent
protocol: TCP
port: 50000
targetPort: 50000
nodePort: 0
selector:
name: "${JENKINS_SERVICE_NAME}"
type: ClusterIP
sessionAffinity: None
- kind: Service
apiVersion: v1
metadata:
name: "${JENKINS_SERVICE_NAME}"
annotations:
service.alpha.openshift.io/dependencies: '[{"name": "${JNLP_SERVICE_NAME}",
"namespace": "", "kind": "Service"}]'
service.openshift.io/infrastructure: 'true'
creationTimestamp:
spec:
ports:
- name: web
protocol: TCP
port: 80
targetPort: 8080
nodePort: 0
selector:
name: "${JENKINS_SERVICE_NAME}"
type: ClusterIP
sessionAffinity: None
parameters:
- description: Git source URI for Jenkins S2I. E.g. https://github.com/CentOS-PaaS-SIG/contra-env-infra
name: REPO_URL
value: https://github.com/CentOS-PaaS-SIG/contra-env-infra
required: true
- description: Git branch/tag reference
name: REPO_REF
value: master
- description: Path within Git project to build; empty for root project directory.
name: CONTEXT_DIR
value: jenkins/master/openshift
- name: JENKINS_SERVICE_NAME
displayName: Jenkins Service Name
description: The name of the OpenShift Service exposed for the Jenkins container.
value: jenkins
- name: JNLP_SERVICE_NAME
displayName: Jenkins JNLP Service Name
description: The name of the service used for master/slave communication.
value: jenkins-jnlp
- name: ENABLE_OAUTH
displayName: Enable OAuth in Jenkins
description: Whether to enable OAuth OpenShift integration. If false, the static
account 'admin' will be initialized with the password 'password'.
value: 'true'
- name: MEMORY_LIMIT
displayName: Memory Limit
description: Maximum amount of memory the container can use.
value: 1024Mi
- name: VOLUME_CAPACITY
displayName: Volume Capacity
description: Volume space available for data, e.g. 512Mi, 2Gi.
value: 10Gi
required: true
- name: NAMESPACE
displayName: Jenkins ImageStream Namespace
description: The OpenShift Namespace where the Jenkins ImageStream resides.
value: "{{ openshift_project }}"
- name: JENKINS_IMAGE_STREAM_TAG
displayName: Jenkins ImageStreamTag
description: Name of the ImageStreamTag to be used for the Jenkins image.
value: jenkins:latest
- name: LOAD_SEED_JOB
displayName: Load seed job
description: Whether to load a dsl seed job
value: 'true'
- name: DSL_JOB_REPO
displayName: DSL job repo
description: The repository of dsl jobs
value: "{{ jenkins_dsl_job_repo }}"
- name: DSL_REPO_BRANCH
displayName: DSL repo branch
description: The branch to use for job dsl repository
value: "{{ jenkins_dsl_repo_branch }}"
- name: ENABLE_INFLUXDB
displayName: Enable Influxdb
description: Install and configure the Influxdb plugin
value: "{{ jenkins_enable_metrics }}"
- name: INFLUXDB_ROUTE
displayName: Influxdb route
description: The http api for Influxdb
value: "{{ influxdb_api_route }}"
- name: INFLUXDB_USERNAME
displayName: Influxdb username
description: The username to auth to influxdb
value: "{{ influxdb_admin_user }}"
- name: INFLUXDB_PASSWORD
displayName: Influxdb password
description: The password to auth to influxdb
value: "{{ influxdb_admin_password }}"
- name: INFLUXDB_INSTANCE
displayName: Influxdb instance
description: The name of the configured influx instance
value: localInflux
- name: INFLUXDB_DATABASE
displayName: Influxdb database
description: The database to use for metrics
value: db0
labels:
template: jenkins-persistent