jenkins-ephemeral-template.json 8.7 KB

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