jenkins-ephemeral-template.json 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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. "annotations": {
  27. "template.openshift.io/expose-uri": "http://{.spec.host}{.spec.path}"
  28. }
  29. },
  30. "spec": {
  31. "to": {
  32. "kind": "Service",
  33. "name": "${JENKINS_SERVICE_NAME}"
  34. },
  35. "tls": {
  36. "termination": "edge",
  37. "insecureEdgeTerminationPolicy": "Redirect"
  38. }
  39. }
  40. },
  41. {
  42. "kind": "DeploymentConfig",
  43. "apiVersion": "v1",
  44. "metadata": {
  45. "name": "${JENKINS_SERVICE_NAME}",
  46. "creationTimestamp": null
  47. },
  48. "spec": {
  49. "strategy": {
  50. "type": "Recreate"
  51. },
  52. "triggers": [
  53. {
  54. "type": "ImageChange",
  55. "imageChangeParams": {
  56. "automatic": true,
  57. "containerNames": [
  58. "jenkins"
  59. ],
  60. "from": {
  61. "kind": "ImageStreamTag",
  62. "name": "${JENKINS_IMAGE_STREAM_TAG}",
  63. "namespace": "${NAMESPACE}"
  64. },
  65. "lastTriggeredImage": ""
  66. }
  67. },
  68. {
  69. "type": "ConfigChange"
  70. }
  71. ],
  72. "replicas": 1,
  73. "selector": {
  74. "name": "${JENKINS_SERVICE_NAME}"
  75. },
  76. "template": {
  77. "metadata": {
  78. "creationTimestamp": null,
  79. "labels": {
  80. "name": "${JENKINS_SERVICE_NAME}"
  81. }
  82. },
  83. "spec": {
  84. "serviceAccountName": "${JENKINS_SERVICE_NAME}",
  85. "containers": [
  86. {
  87. "name": "jenkins",
  88. "image": " ",
  89. "readinessProbe": {
  90. "timeoutSeconds": 3,
  91. "initialDelaySeconds": 3,
  92. "httpGet": {
  93. "path": "/login",
  94. "port": 8080
  95. }
  96. },
  97. "livenessProbe": {
  98. "timeoutSeconds": 3,
  99. "initialDelaySeconds": 420,
  100. "failureThreshold" : 30,
  101. "httpGet": {
  102. "path": "/login",
  103. "port": 8080
  104. }
  105. },
  106. "env": [
  107. {
  108. "name": "OPENSHIFT_ENABLE_OAUTH",
  109. "value": "${ENABLE_OAUTH}"
  110. },
  111. {
  112. "name": "OPENSHIFT_ENABLE_REDIRECT_PROMPT",
  113. "value": "true"
  114. },
  115. {
  116. "name": "OPENSHIFT_JENKINS_JVM_ARCH",
  117. "value": "${JVM_ARCH}"
  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. "emptyDir": {
  156. "medium": ""
  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. "annotations": {
  172. "serviceaccounts.openshift.io/oauth-redirectreference.jenkins": "{\"kind\":\"OAuthRedirectReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"Route\",\"name\":\"${JENKINS_SERVICE_NAME}\"}}"
  173. }
  174. }
  175. },
  176. {
  177. "kind": "RoleBinding",
  178. "apiVersion": "v1",
  179. "metadata": {
  180. "name": "${JENKINS_SERVICE_NAME}_edit"
  181. },
  182. "groupNames": null,
  183. "subjects": [
  184. {
  185. "kind": "ServiceAccount",
  186. "name": "${JENKINS_SERVICE_NAME}"
  187. }
  188. ],
  189. "roleRef": {
  190. "name": "edit"
  191. }
  192. },
  193. {
  194. "kind": "Service",
  195. "apiVersion": "v1",
  196. "metadata": {
  197. "name": "${JNLP_SERVICE_NAME}"
  198. },
  199. "spec": {
  200. "ports": [
  201. {
  202. "name": "agent",
  203. "protocol": "TCP",
  204. "port": 50000,
  205. "targetPort": 50000,
  206. "nodePort": 0
  207. }
  208. ],
  209. "selector": {
  210. "name": "${JENKINS_SERVICE_NAME}"
  211. },
  212. "type": "ClusterIP",
  213. "sessionAffinity": "None"
  214. }
  215. },
  216. {
  217. "kind": "Service",
  218. "apiVersion": "v1",
  219. "metadata": {
  220. "name": "${JENKINS_SERVICE_NAME}",
  221. "annotations": {
  222. "service.alpha.openshift.io/dependencies": "[{\"name\": \"${JNLP_SERVICE_NAME}\", \"namespace\": \"\", \"kind\": \"Service\"}]",
  223. "service.openshift.io/infrastructure": "true"
  224. },
  225. "creationTimestamp": null
  226. },
  227. "spec": {
  228. "ports": [
  229. {
  230. "name": "web",
  231. "protocol": "TCP",
  232. "port": 80,
  233. "targetPort": 8080,
  234. "nodePort": 0
  235. }
  236. ],
  237. "selector": {
  238. "name": "${JENKINS_SERVICE_NAME}"
  239. },
  240. "type": "ClusterIP",
  241. "sessionAffinity": "None"
  242. }
  243. }
  244. ],
  245. "parameters": [
  246. {
  247. "name": "JENKINS_SERVICE_NAME",
  248. "displayName": "Jenkins Service Name",
  249. "description": "The name of the OpenShift Service exposed for the Jenkins container.",
  250. "value": "jenkins"
  251. },
  252. {
  253. "name": "JNLP_SERVICE_NAME",
  254. "displayName": "Jenkins JNLP Service Name",
  255. "description": "The name of the service used for master/slave communication.",
  256. "value": "jenkins-jnlp"
  257. },
  258. {
  259. "name": "ENABLE_OAUTH",
  260. "displayName": "Enable OAuth in Jenkins",
  261. "description": "Whether to enable OAuth OpenShift integration. If false, the static account 'admin' will be initialized with the password 'password'.",
  262. "value": "true"
  263. },
  264. {
  265. "name": "JVM_ARCH",
  266. "displayName": "Jenkins JVM Architecture",
  267. "description": "Whether Jenkins runs with a 32 bit (i386) or 64 bit (x86_64) JVM.",
  268. "value": "i386"
  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": "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-ephemeral-template"
  291. }
  292. }