jenkins-persistent-template.json 9.3 KB

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