jenkins-persistent-template.json 8.0 KB

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