jenkins-persistent-template.json 9.4 KB

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