jenkins-persistent-template.json 8.0 KB

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