jenkins-ephemeral-template.json 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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": "OPENSHIFT_JENKINS_JVM_ARCH",
  114. "value": "${JVM_ARCH}"
  115. },
  116. {
  117. "name": "KUBERNETES_MASTER",
  118. "value": "https://kubernetes.default:443"
  119. },
  120. {
  121. "name": "KUBERNETES_TRUST_CERTIFICATES",
  122. "value": "true"
  123. },
  124. {
  125. "name": "JNLP_SERVICE_NAME",
  126. "value": "${JNLP_SERVICE_NAME}"
  127. }
  128. ],
  129. "resources": {
  130. "limits": {
  131. "memory": "${MEMORY_LIMIT}"
  132. }
  133. },
  134. "volumeMounts": [
  135. {
  136. "name": "${JENKINS_SERVICE_NAME}-data",
  137. "mountPath": "/var/lib/jenkins"
  138. }
  139. ],
  140. "terminationMessagePath": "/dev/termination-log",
  141. "imagePullPolicy": "IfNotPresent",
  142. "capabilities": {},
  143. "securityContext": {
  144. "capabilities": {},
  145. "privileged": false
  146. }
  147. }
  148. ],
  149. "volumes": [
  150. {
  151. "name": "${JENKINS_SERVICE_NAME}-data",
  152. "emptyDir": {
  153. "medium": ""
  154. }
  155. }
  156. ],
  157. "restartPolicy": "Always",
  158. "dnsPolicy": "ClusterFirst"
  159. }
  160. }
  161. }
  162. },
  163. {
  164. "kind": "ServiceAccount",
  165. "apiVersion": "v1",
  166. "metadata": {
  167. "name": "${JENKINS_SERVICE_NAME}",
  168. "annotations": {
  169. "serviceaccounts.openshift.io/oauth-redirectreference.jenkins": "{\"kind\":\"OAuthRedirectReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"Route\",\"name\":\"${JENKINS_SERVICE_NAME}\"}}"
  170. }
  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": "ENABLE_OAUTH",
  257. "displayName": "Enable OAuth in Jenkins",
  258. "description": "Whether to enable OAuth OpenShift integration. If false, the static account 'admin' will be initialized with the password 'password'.",
  259. "value": "true"
  260. },
  261. {
  262. "name": "JVM_ARCH",
  263. "displayName": "Jenkins JVM Architecture",
  264. "description": "Whether Jenkins runs with a 32 bit (i386) or 64 bit (x86_64) JVM.",
  265. "value": "i386"
  266. },
  267. {
  268. "name": "MEMORY_LIMIT",
  269. "displayName": "Memory Limit",
  270. "description": "Maximum amount of memory the container can use.",
  271. "value": "512Mi"
  272. },
  273. {
  274. "name": "NAMESPACE",
  275. "displayName": "Jenkins ImageStream Namespace",
  276. "description": "The OpenShift Namespace where the Jenkins ImageStream resides.",
  277. "value": "openshift"
  278. },
  279. {
  280. "name": "JENKINS_IMAGE_STREAM_TAG",
  281. "displayName": "Jenkins ImageStreamTag",
  282. "description": "Name of the ImageStreamTag to be used for the Jenkins image.",
  283. "value": "jenkins:latest"
  284. }
  285. ],
  286. "labels": {
  287. "template": "jenkins-ephemeral-template"
  288. }
  289. }