jenkins-persistent-template.json 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. {
  2. "apiVersion": "v1",
  3. "kind": "Template",
  4. "labels": {
  5. "app": "jenkins-persistent",
  6. "template": "jenkins-persistent-template"
  7. },
  8. "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.",
  9. "metadata": {
  10. "annotations": {
  11. "description": "Jenkins service, with persistent storage.\n\nNOTE: You must have persistent volumes available in your cluster to use this template.",
  12. "iconClass": "icon-jenkins",
  13. "openshift.io/display-name": "Jenkins",
  14. "openshift.io/documentation-url": "https://docs.openshift.org/latest/using_images/other_images/jenkins.html",
  15. "openshift.io/long-description": "This template deploys a Jenkins server capable of managing OpenShift Pipeline builds and supporting OpenShift-based oauth login.",
  16. "openshift.io/provider-display-name": "Red Hat, Inc.",
  17. "openshift.io/support-url": "https://access.redhat.com",
  18. "tags": "instant-app,jenkins"
  19. },
  20. "name": "jenkins-persistent"
  21. },
  22. "objects": [
  23. {
  24. "apiVersion": "v1",
  25. "kind": "Route",
  26. "metadata": {
  27. "annotations": {
  28. "haproxy.router.openshift.io/timeout": "4m",
  29. "template.openshift.io/expose-uri": "http://{.spec.host}{.spec.path}"
  30. },
  31. "name": "${JENKINS_SERVICE_NAME}"
  32. },
  33. "spec": {
  34. "tls": {
  35. "insecureEdgeTerminationPolicy": "Redirect",
  36. "termination": "edge"
  37. },
  38. "to": {
  39. "kind": "Service",
  40. "name": "${JENKINS_SERVICE_NAME}"
  41. }
  42. }
  43. },
  44. {
  45. "apiVersion": "v1",
  46. "kind": "PersistentVolumeClaim",
  47. "metadata": {
  48. "name": "${JENKINS_SERVICE_NAME}"
  49. },
  50. "spec": {
  51. "accessModes": [
  52. "ReadWriteOnce"
  53. ],
  54. "resources": {
  55. "requests": {
  56. "storage": "${VOLUME_CAPACITY}"
  57. }
  58. }
  59. }
  60. },
  61. {
  62. "apiVersion": "v1",
  63. "kind": "DeploymentConfig",
  64. "metadata": {
  65. "annotations": {
  66. "template.alpha.openshift.io/wait-for-ready": "true"
  67. },
  68. "name": "${JENKINS_SERVICE_NAME}"
  69. },
  70. "spec": {
  71. "replicas": 1,
  72. "selector": {
  73. "name": "${JENKINS_SERVICE_NAME}"
  74. },
  75. "strategy": {
  76. "type": "Recreate"
  77. },
  78. "template": {
  79. "metadata": {
  80. "labels": {
  81. "name": "${JENKINS_SERVICE_NAME}"
  82. }
  83. },
  84. "spec": {
  85. "containers": [
  86. {
  87. "capabilities": {},
  88. "env": [
  89. {
  90. "name": "OPENSHIFT_ENABLE_OAUTH",
  91. "value": "${ENABLE_OAUTH}"
  92. },
  93. {
  94. "name": "OPENSHIFT_ENABLE_REDIRECT_PROMPT",
  95. "value": "true"
  96. },
  97. {
  98. "name": "KUBERNETES_MASTER",
  99. "value": "https://kubernetes.default:443"
  100. },
  101. {
  102. "name": "KUBERNETES_TRUST_CERTIFICATES",
  103. "value": "true"
  104. },
  105. {
  106. "name": "JENKINS_SERVICE_NAME",
  107. "value": "${JENKINS_SERVICE_NAME}"
  108. },
  109. {
  110. "name": "JNLP_SERVICE_NAME",
  111. "value": "${JNLP_SERVICE_NAME}"
  112. }
  113. ],
  114. "image": " ",
  115. "imagePullPolicy": "IfNotPresent",
  116. "livenessProbe": {
  117. "failureThreshold": 2,
  118. "httpGet": {
  119. "path": "/login",
  120. "port": 8080
  121. },
  122. "initialDelaySeconds": 420,
  123. "periodSeconds": 360,
  124. "timeoutSeconds": 240
  125. },
  126. "name": "jenkins",
  127. "readinessProbe": {
  128. "httpGet": {
  129. "path": "/login",
  130. "port": 8080
  131. },
  132. "initialDelaySeconds": 3,
  133. "timeoutSeconds": 240
  134. },
  135. "resources": {
  136. "limits": {
  137. "memory": "${MEMORY_LIMIT}"
  138. }
  139. },
  140. "securityContext": {
  141. "capabilities": {},
  142. "privileged": false
  143. },
  144. "terminationMessagePath": "/dev/termination-log",
  145. "volumeMounts": [
  146. {
  147. "mountPath": "/var/lib/jenkins",
  148. "name": "${JENKINS_SERVICE_NAME}-data"
  149. }
  150. ]
  151. }
  152. ],
  153. "dnsPolicy": "ClusterFirst",
  154. "restartPolicy": "Always",
  155. "serviceAccountName": "${JENKINS_SERVICE_NAME}",
  156. "volumes": [
  157. {
  158. "name": "${JENKINS_SERVICE_NAME}-data",
  159. "persistentVolumeClaim": {
  160. "claimName": "${JENKINS_SERVICE_NAME}"
  161. }
  162. }
  163. ]
  164. }
  165. },
  166. "triggers": [
  167. {
  168. "imageChangeParams": {
  169. "automatic": true,
  170. "containerNames": [
  171. "jenkins"
  172. ],
  173. "from": {
  174. "kind": "ImageStreamTag",
  175. "name": "${JENKINS_IMAGE_STREAM_TAG}",
  176. "namespace": "${NAMESPACE}"
  177. },
  178. "lastTriggeredImage": ""
  179. },
  180. "type": "ImageChange"
  181. },
  182. {
  183. "type": "ConfigChange"
  184. }
  185. ]
  186. }
  187. },
  188. {
  189. "apiVersion": "v1",
  190. "kind": "ServiceAccount",
  191. "metadata": {
  192. "annotations": {
  193. "serviceaccounts.openshift.io/oauth-redirectreference.jenkins": "{\"kind\":\"OAuthRedirectReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"Route\",\"name\":\"${JENKINS_SERVICE_NAME}\"}}"
  194. },
  195. "name": "${JENKINS_SERVICE_NAME}"
  196. }
  197. },
  198. {
  199. "apiVersion": "v1",
  200. "groupNames": null,
  201. "kind": "RoleBinding",
  202. "metadata": {
  203. "name": "${JENKINS_SERVICE_NAME}_edit"
  204. },
  205. "roleRef": {
  206. "name": "edit"
  207. },
  208. "subjects": [
  209. {
  210. "kind": "ServiceAccount",
  211. "name": "${JENKINS_SERVICE_NAME}"
  212. }
  213. ]
  214. },
  215. {
  216. "apiVersion": "v1",
  217. "kind": "Service",
  218. "metadata": {
  219. "name": "${JNLP_SERVICE_NAME}"
  220. },
  221. "spec": {
  222. "ports": [
  223. {
  224. "name": "agent",
  225. "nodePort": 0,
  226. "port": 50000,
  227. "protocol": "TCP",
  228. "targetPort": 50000
  229. }
  230. ],
  231. "selector": {
  232. "name": "${JENKINS_SERVICE_NAME}"
  233. },
  234. "sessionAffinity": "None",
  235. "type": "ClusterIP"
  236. }
  237. },
  238. {
  239. "apiVersion": "v1",
  240. "kind": "Service",
  241. "metadata": {
  242. "annotations": {
  243. "service.alpha.openshift.io/dependencies": "[{\"name\": \"${JNLP_SERVICE_NAME}\", \"namespace\": \"\", \"kind\": \"Service\"}]",
  244. "service.openshift.io/infrastructure": "true"
  245. },
  246. "name": "${JENKINS_SERVICE_NAME}"
  247. },
  248. "spec": {
  249. "ports": [
  250. {
  251. "name": "web",
  252. "nodePort": 0,
  253. "port": 80,
  254. "protocol": "TCP",
  255. "targetPort": 8080
  256. }
  257. ],
  258. "selector": {
  259. "name": "${JENKINS_SERVICE_NAME}"
  260. },
  261. "sessionAffinity": "None",
  262. "type": "ClusterIP"
  263. }
  264. }
  265. ],
  266. "parameters": [
  267. {
  268. "description": "The name of the OpenShift Service exposed for the Jenkins container.",
  269. "displayName": "Jenkins Service Name",
  270. "name": "JENKINS_SERVICE_NAME",
  271. "value": "jenkins"
  272. },
  273. {
  274. "description": "The name of the service used for master/slave communication.",
  275. "displayName": "Jenkins JNLP Service Name",
  276. "name": "JNLP_SERVICE_NAME",
  277. "value": "jenkins-jnlp"
  278. },
  279. {
  280. "description": "Whether to enable OAuth OpenShift integration. If false, the static account 'admin' will be initialized with the password 'password'.",
  281. "displayName": "Enable OAuth in Jenkins",
  282. "name": "ENABLE_OAUTH",
  283. "value": "true"
  284. },
  285. {
  286. "description": "Maximum amount of memory the container can use.",
  287. "displayName": "Memory Limit",
  288. "name": "MEMORY_LIMIT",
  289. "value": "512Mi"
  290. },
  291. {
  292. "description": "Volume space available for data, e.g. 512Mi, 2Gi.",
  293. "displayName": "Volume Capacity",
  294. "name": "VOLUME_CAPACITY",
  295. "required": true,
  296. "value": "1Gi"
  297. },
  298. {
  299. "description": "The OpenShift Namespace where the Jenkins ImageStream resides.",
  300. "displayName": "Jenkins ImageStream Namespace",
  301. "name": "NAMESPACE",
  302. "value": "openshift"
  303. },
  304. {
  305. "description": "Name of the ImageStreamTag to be used for the Jenkins image.",
  306. "displayName": "Jenkins ImageStreamTag",
  307. "name": "JENKINS_IMAGE_STREAM_TAG",
  308. "value": "jenkins:2"
  309. }
  310. ]
  311. }