jenkins-ephemeral-template.json 12 KB

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