jenkins-persistent-template.json 8.5 KB

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