jenkins-persistent.yaml 6.7 KB

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