jenkins-ephemeral-template.json 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "name": "jenkins-ephemeral",
  6. "creationTimestamp": null,
  7. "annotations": {
  8. "description": "Jenkins service, without persistent storage.\nWARNING: Any data stored will be lost upon pod destruction. Only use this template for testing",
  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": "DeploymentConfig",
  35. "apiVersion": "v1",
  36. "metadata": {
  37. "name": "${JENKINS_SERVICE_NAME}",
  38. "creationTimestamp": null
  39. },
  40. "spec": {
  41. "strategy": {
  42. "type": "Recreate"
  43. },
  44. "triggers": [
  45. {
  46. "type": "ImageChange",
  47. "imageChangeParams": {
  48. "automatic": true,
  49. "containerNames": [
  50. "jenkins"
  51. ],
  52. "from": {
  53. "kind": "ImageStreamTag",
  54. "name": "${JENKINS_IMAGE_STREAM_TAG}",
  55. "namespace": "${NAMESPACE}"
  56. },
  57. "lastTriggeredImage": ""
  58. }
  59. },
  60. {
  61. "type": "ConfigChange"
  62. }
  63. ],
  64. "replicas": 1,
  65. "selector": {
  66. "name": "${JENKINS_SERVICE_NAME}"
  67. },
  68. "template": {
  69. "metadata": {
  70. "creationTimestamp": null,
  71. "labels": {
  72. "name": "${JENKINS_SERVICE_NAME}"
  73. }
  74. },
  75. "spec": {
  76. "serviceAccountName": "${JENKINS_SERVICE_NAME}",
  77. "containers": [
  78. {
  79. "name": "jenkins",
  80. "image": " ",
  81. "readinessProbe": {
  82. "timeoutSeconds": 3,
  83. "initialDelaySeconds": 3,
  84. "httpGet": {
  85. "path": "/login",
  86. "port": 8080
  87. }
  88. },
  89. "livenessProbe": {
  90. "timeoutSeconds": 3,
  91. "initialDelaySeconds": 120,
  92. "httpGet": {
  93. "path": "/login",
  94. "port": 8080
  95. }
  96. },
  97. "env": [
  98. {
  99. "name": "JENKINS_PASSWORD",
  100. "value": "${JENKINS_PASSWORD}"
  101. },
  102. {
  103. "name": "KUBERNETES_MASTER",
  104. "value": "https://kubernetes.default:443"
  105. },
  106. {
  107. "name": "KUBERNETES_TRUST_CERTIFICATES",
  108. "value": "true"
  109. },
  110. {
  111. "name": "JNLP_SERVICE_NAME",
  112. "value": "${JNLP_SERVICE_NAME}"
  113. }
  114. ],
  115. "resources": {
  116. "limits": {
  117. "memory": "${MEMORY_LIMIT}"
  118. }
  119. },
  120. "volumeMounts": [
  121. {
  122. "name": "${JENKINS_SERVICE_NAME}-data",
  123. "mountPath": "/var/lib/jenkins"
  124. }
  125. ],
  126. "terminationMessagePath": "/dev/termination-log",
  127. "imagePullPolicy": "IfNotPresent",
  128. "capabilities": {},
  129. "securityContext": {
  130. "capabilities": {},
  131. "privileged": false
  132. }
  133. }
  134. ],
  135. "volumes": [
  136. {
  137. "name": "${JENKINS_SERVICE_NAME}-data",
  138. "emptyDir": {
  139. "medium": ""
  140. }
  141. }
  142. ],
  143. "restartPolicy": "Always",
  144. "dnsPolicy": "ClusterFirst"
  145. }
  146. }
  147. }
  148. },
  149. {
  150. "kind": "ServiceAccount",
  151. "apiVersion": "v1",
  152. "metadata": {
  153. "name": "${JENKINS_SERVICE_NAME}"
  154. }
  155. },
  156. {
  157. "kind": "RoleBinding",
  158. "apiVersion": "v1",
  159. "metadata": {
  160. "name": "${JENKINS_SERVICE_NAME}_edit"
  161. },
  162. "groupNames": null,
  163. "subjects": [
  164. {
  165. "kind": "ServiceAccount",
  166. "name": "${JENKINS_SERVICE_NAME}"
  167. }
  168. ],
  169. "roleRef": {
  170. "name": "edit"
  171. }
  172. },
  173. {
  174. "kind": "Service",
  175. "apiVersion": "v1",
  176. "metadata": {
  177. "name": "${JNLP_SERVICE_NAME}"
  178. },
  179. "spec": {
  180. "ports": [
  181. {
  182. "name": "agent",
  183. "protocol": "TCP",
  184. "port": 50000,
  185. "targetPort": 50000,
  186. "nodePort": 0
  187. }
  188. ],
  189. "selector": {
  190. "name": "${JENKINS_SERVICE_NAME}"
  191. },
  192. "type": "ClusterIP",
  193. "sessionAffinity": "None"
  194. }
  195. },
  196. {
  197. "kind": "Service",
  198. "apiVersion": "v1",
  199. "metadata": {
  200. "name": "${JENKINS_SERVICE_NAME}",
  201. "annotations": {
  202. "service.alpha.openshift.io/dependencies": "[{\"name\": \"${JNLP_SERVICE_NAME}\", \"namespace\": \"\", \"kind\": \"Service\"}]",
  203. "service.openshift.io/infrastructure": "true"
  204. },
  205. "creationTimestamp": null
  206. },
  207. "spec": {
  208. "ports": [
  209. {
  210. "name": "web",
  211. "protocol": "TCP",
  212. "port": 80,
  213. "targetPort": 8080,
  214. "nodePort": 0
  215. }
  216. ],
  217. "selector": {
  218. "name": "${JENKINS_SERVICE_NAME}"
  219. },
  220. "type": "ClusterIP",
  221. "sessionAffinity": "None"
  222. }
  223. }
  224. ],
  225. "parameters": [
  226. {
  227. "name": "JENKINS_SERVICE_NAME",
  228. "displayName": "Jenkins Service Name",
  229. "description": "The name of the OpenShift Service exposed for the Jenkins container.",
  230. "value": "jenkins"
  231. },
  232. {
  233. "name": "JNLP_SERVICE_NAME",
  234. "displayName": "Jenkins JNLP Service Name",
  235. "description": "The name of the service used for master/slave communication.",
  236. "value": "jenkins-jnlp"
  237. },
  238. {
  239. "name": "JENKINS_PASSWORD",
  240. "displayName": "Jenkins Password",
  241. "description": "Password for the Jenkins 'admin' user.",
  242. "generate": "expression",
  243. "from": "[a-zA-Z0-9]{16}",
  244. "required": true
  245. },
  246. {
  247. "name": "MEMORY_LIMIT",
  248. "displayName": "Memory Limit",
  249. "description": "Maximum amount of memory the container can use.",
  250. "value": "512Mi"
  251. },
  252. {
  253. "name": "NAMESPACE",
  254. "displayName": "Jenkins ImageStream Namespace",
  255. "description": "The OpenShift Namespace where the Jenkins ImageStream resides.",
  256. "value": "openshift"
  257. },
  258. {
  259. "name": "JENKINS_IMAGE_STREAM_TAG",
  260. "displayName": "Jenkins ImageStreamTag",
  261. "description": "Name of the ImageStreamTag to be used for the Jenkins image.",
  262. "value": "jenkins:latest"
  263. }
  264. ],
  265. "labels": {
  266. "template": "jenkins-ephemeral-template"
  267. }
  268. }