jenkins-persistent-template.json 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  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": "KUBERNETES_MASTER",
  131. "value": "https://kubernetes.default:443"
  132. },
  133. {
  134. "name": "KUBERNETES_TRUST_CERTIFICATES",
  135. "value": "true"
  136. },
  137. {
  138. "name": "JNLP_SERVICE_NAME",
  139. "value": "${JNLP_SERVICE_NAME}"
  140. }
  141. ],
  142. "resources": {
  143. "limits": {
  144. "memory": "${MEMORY_LIMIT}"
  145. }
  146. },
  147. "volumeMounts": [
  148. {
  149. "name": "${JENKINS_SERVICE_NAME}-data",
  150. "mountPath": "/var/lib/jenkins"
  151. }
  152. ],
  153. "terminationMessagePath": "/dev/termination-log",
  154. "imagePullPolicy": "IfNotPresent",
  155. "capabilities": {},
  156. "securityContext": {
  157. "capabilities": {},
  158. "privileged": false
  159. }
  160. }
  161. ],
  162. "volumes": [
  163. {
  164. "name": "${JENKINS_SERVICE_NAME}-data",
  165. "persistentVolumeClaim": {
  166. "claimName": "${JENKINS_SERVICE_NAME}"
  167. }
  168. }
  169. ],
  170. "restartPolicy": "Always",
  171. "dnsPolicy": "ClusterFirst"
  172. }
  173. }
  174. }
  175. },
  176. {
  177. "kind": "ServiceAccount",
  178. "apiVersion": "v1",
  179. "metadata": {
  180. "name": "${JENKINS_SERVICE_NAME}",
  181. "annotations": {
  182. "serviceaccounts.openshift.io/oauth-redirectreference.jenkins": "{\"kind\":\"OAuthRedirectReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"Route\",\"name\":\"${JENKINS_SERVICE_NAME}\"}}"
  183. }
  184. }
  185. },
  186. {
  187. "kind": "RoleBinding",
  188. "apiVersion": "v1",
  189. "metadata": {
  190. "name": "${JENKINS_SERVICE_NAME}_edit"
  191. },
  192. "groupNames": null,
  193. "subjects": [
  194. {
  195. "kind": "ServiceAccount",
  196. "name": "${JENKINS_SERVICE_NAME}"
  197. }
  198. ],
  199. "roleRef": {
  200. "name": "edit"
  201. }
  202. },
  203. {
  204. "kind": "Service",
  205. "apiVersion": "v1",
  206. "metadata": {
  207. "name": "${JNLP_SERVICE_NAME}"
  208. },
  209. "spec": {
  210. "ports": [
  211. {
  212. "name": "agent",
  213. "protocol": "TCP",
  214. "port": 50000,
  215. "targetPort": 50000,
  216. "nodePort": 0
  217. }
  218. ],
  219. "selector": {
  220. "name": "${JENKINS_SERVICE_NAME}"
  221. },
  222. "type": "ClusterIP",
  223. "sessionAffinity": "None"
  224. }
  225. },
  226. {
  227. "kind": "Service",
  228. "apiVersion": "v1",
  229. "metadata": {
  230. "name": "${JENKINS_SERVICE_NAME}",
  231. "annotations": {
  232. "service.alpha.openshift.io/dependencies": "[{\"name\": \"${JNLP_SERVICE_NAME}\", \"namespace\": \"\", \"kind\": \"Service\"}]",
  233. "service.openshift.io/infrastructure": "true"
  234. },
  235. "creationTimestamp": null
  236. },
  237. "spec": {
  238. "ports": [
  239. {
  240. "name": "web",
  241. "protocol": "TCP",
  242. "port": 80,
  243. "targetPort": 8080,
  244. "nodePort": 0
  245. }
  246. ],
  247. "selector": {
  248. "name": "${JENKINS_SERVICE_NAME}"
  249. },
  250. "type": "ClusterIP",
  251. "sessionAffinity": "None"
  252. }
  253. }
  254. ],
  255. "parameters": [
  256. {
  257. "name": "JENKINS_SERVICE_NAME",
  258. "displayName": "Jenkins Service Name",
  259. "description": "The name of the OpenShift Service exposed for the Jenkins container.",
  260. "value": "jenkins"
  261. },
  262. {
  263. "name": "JNLP_SERVICE_NAME",
  264. "displayName": "Jenkins JNLP Service Name",
  265. "description": "The name of the service used for master/slave communication.",
  266. "value": "jenkins-jnlp"
  267. },
  268. {
  269. "name": "ENABLE_OAUTH",
  270. "displayName": "Enable OAuth in Jenkins",
  271. "description": "Whether to enable OAuth OpenShift integration. If false, the static account 'admin' will be initialized with the password 'password'.",
  272. "value": "true"
  273. },
  274. {
  275. "name": "MEMORY_LIMIT",
  276. "displayName": "Memory Limit",
  277. "description": "Maximum amount of memory the container can use.",
  278. "value": "512Mi"
  279. },
  280. {
  281. "name": "VOLUME_CAPACITY",
  282. "displayName": "Volume Capacity",
  283. "description": "Volume space available for data, e.g. 512Mi, 2Gi.",
  284. "value": "1Gi",
  285. "required": true
  286. },
  287. {
  288. "name": "NAMESPACE",
  289. "displayName": "Jenkins ImageStream Namespace",
  290. "description": "The OpenShift Namespace where the Jenkins ImageStream resides.",
  291. "value": "openshift"
  292. },
  293. {
  294. "name": "JENKINS_IMAGE_STREAM_TAG",
  295. "displayName": "Jenkins ImageStreamTag",
  296. "description": "Name of the ImageStreamTag to be used for the Jenkins image.",
  297. "value": "jenkins:latest"
  298. }
  299. ],
  300. "labels": {
  301. "template": "jenkins-persistent-template"
  302. }
  303. }