nexus3-template.yaml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. apiVersion: v1
  2. kind: Template
  3. labels:
  4. template: nexus3-template
  5. metadata:
  6. name: nexus3
  7. annotations:
  8. description: Sonatype Nexus 3 template
  9. tags: ci,nexus
  10. objects:
  11. - apiVersion: v1
  12. kind: ImageStream
  13. metadata:
  14. labels:
  15. app: ${SERVICE_NAME}
  16. name: ${SERVICE_NAME}
  17. spec:
  18. tags:
  19. - from:
  20. kind: DockerImage
  21. name: docker.io/sonatype/nexus3:${NEXUS_VERSION}
  22. name: ${NEXUS_VERSION}
  23. - apiVersion: v1
  24. kind: DeploymentConfig
  25. metadata:
  26. labels:
  27. app: ${SERVICE_NAME}
  28. name: ${SERVICE_NAME}
  29. spec:
  30. replicas: 1
  31. selector:
  32. deploymentconfig: ${SERVICE_NAME}
  33. strategy:
  34. rollingParams:
  35. intervalSeconds: 1
  36. maxSurge: 25%
  37. maxUnavailable: 0
  38. timeoutSeconds: 1200
  39. updatePeriodSeconds: 1
  40. post:
  41. failurePolicy: Abort
  42. execNewPod:
  43. containerName: ${SERVICE_NAME}
  44. command:
  45. - "/bin/bash"
  46. - "-c"
  47. - "curl -o /tmp/nexus-functions -s https://raw.githubusercontent.com/OpenShiftDemos/nexus/master/scripts/nexus-functions; source /tmp/nexus-functions; add_nexus3_redhat_repos admin admin123 http://${SERVICE_NAME}:8081"
  48. type: Rolling
  49. template:
  50. metadata:
  51. labels:
  52. deploymentconfig: ${SERVICE_NAME}
  53. spec:
  54. containers:
  55. - env:
  56. - name: CONTEXT_PATH
  57. value: /
  58. image: ' '
  59. imagePullPolicy: IfNotPresent
  60. livenessProbe:
  61. exec:
  62. command:
  63. - echo
  64. - ok
  65. failureThreshold: 3
  66. initialDelaySeconds: 30
  67. periodSeconds: 10
  68. successThreshold: 1
  69. timeoutSeconds: 1
  70. name: ${SERVICE_NAME}
  71. ports:
  72. - containerPort: 8081
  73. protocol: TCP
  74. readinessProbe:
  75. failureThreshold: 3
  76. httpGet:
  77. path: /
  78. port: 8081
  79. scheme: HTTP
  80. initialDelaySeconds: 30
  81. periodSeconds: 10
  82. successThreshold: 1
  83. timeoutSeconds: 1
  84. resources:
  85. limits:
  86. memory: ${MAX_MEMORY}
  87. requests:
  88. memory: 512Mi
  89. terminationMessagePath: /dev/termination-log
  90. volumeMounts:
  91. - mountPath: /nexus-data
  92. name: ${SERVICE_NAME}-data
  93. dnsPolicy: ClusterFirst
  94. restartPolicy: Always
  95. securityContext: {}
  96. terminationGracePeriodSeconds: 30
  97. volumes:
  98. - name: ${SERVICE_NAME}-data
  99. emptyDir: {}
  100. test: false
  101. triggers:
  102. - type: ConfigChange
  103. - imageChangeParams:
  104. automatic: true
  105. containerNames:
  106. - ${SERVICE_NAME}
  107. from:
  108. kind: ImageStreamTag
  109. name: ${SERVICE_NAME}:${NEXUS_VERSION}
  110. type: ImageChange
  111. - apiVersion: v1
  112. kind: Service
  113. metadata:
  114. labels:
  115. app: ${SERVICE_NAME}
  116. name: ${SERVICE_NAME}
  117. spec:
  118. ports:
  119. - name: 8081-tcp
  120. port: 8081
  121. protocol: TCP
  122. targetPort: 8081
  123. selector:
  124. deploymentconfig: ${SERVICE_NAME}
  125. sessionAffinity: None
  126. type: ClusterIP
  127. - apiVersion: v1
  128. kind: Route
  129. metadata:
  130. labels:
  131. app: ${SERVICE_NAME}
  132. name: ${SERVICE_NAME}
  133. spec:
  134. port:
  135. targetPort: 8081-tcp
  136. to:
  137. kind: Service
  138. name: ${SERVICE_NAME}
  139. weight: 100
  140. parameters:
  141. - displayName: Sonatype Nexus Service Name
  142. name: SERVICE_NAME
  143. required: true
  144. value: nexus
  145. - displayName: Sonatype Nexus version
  146. name: NEXUS_VERSION
  147. required: true
  148. value: 3.14.0
  149. - description: Max memory allocated to the Nexus pod
  150. displayName: Max Memory
  151. name: MAX_MEMORY
  152. required: true
  153. value: 2Gi