jenkins-ephemeral-template.json 8.7 KB

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