jenkins-ephemeral-template.json 8.5 KB

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