jenkins-persistent-template.json 9.1 KB

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