nexus3-persistent-template.yaml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. apiVersion: v1
  2. kind: Template
  3. labels:
  4. template: nexus3-persistent-template
  5. metadata:
  6. name: nexus3-persistent
  7. annotations:
  8. description: Sonatype Nexus 3 persistent 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. recreateParams:
  35. timeoutSeconds: 1200
  36. post:
  37. failurePolicy: Abort
  38. execNewPod:
  39. containerName: ${SERVICE_NAME}
  40. command:
  41. - "/bin/bash"
  42. - "-c"
  43. - "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"
  44. type: Recreate
  45. template:
  46. metadata:
  47. labels:
  48. deploymentconfig: ${SERVICE_NAME}
  49. spec:
  50. containers:
  51. - env:
  52. - name: CONTEXT_PATH
  53. value: /
  54. image: ' '
  55. imagePullPolicy: IfNotPresent
  56. livenessProbe:
  57. exec:
  58. command:
  59. - echo
  60. - ok
  61. failureThreshold: 3
  62. initialDelaySeconds: 30
  63. periodSeconds: 10
  64. successThreshold: 1
  65. timeoutSeconds: 1
  66. name: ${SERVICE_NAME}
  67. ports:
  68. - containerPort: 8081
  69. protocol: TCP
  70. readinessProbe:
  71. failureThreshold: 3
  72. httpGet:
  73. path: /
  74. port: 8081
  75. scheme: HTTP
  76. initialDelaySeconds: 30
  77. periodSeconds: 10
  78. successThreshold: 1
  79. timeoutSeconds: 1
  80. resources:
  81. limits:
  82. memory: ${MAX_MEMORY}
  83. requests:
  84. memory: 512Mi
  85. terminationMessagePath: /dev/termination-log
  86. volumeMounts:
  87. - mountPath: /nexus-data
  88. name: ${SERVICE_NAME}-data
  89. dnsPolicy: ClusterFirst
  90. restartPolicy: Always
  91. securityContext: {}
  92. terminationGracePeriodSeconds: 30
  93. volumes:
  94. - name: ${SERVICE_NAME}-data
  95. persistentVolumeClaim:
  96. claimName: ${SERVICE_NAME}-pv
  97. test: false
  98. triggers:
  99. - type: ConfigChange
  100. - imageChangeParams:
  101. automatic: true
  102. containerNames:
  103. - ${SERVICE_NAME}
  104. from:
  105. kind: ImageStreamTag
  106. name: ${SERVICE_NAME}:${NEXUS_VERSION}
  107. type: ImageChange
  108. - apiVersion: v1
  109. kind: Service
  110. metadata:
  111. labels:
  112. app: ${SERVICE_NAME}
  113. name: ${SERVICE_NAME}
  114. spec:
  115. ports:
  116. - name: 8081-tcp
  117. port: 8081
  118. protocol: TCP
  119. targetPort: 8081
  120. selector:
  121. deploymentconfig: ${SERVICE_NAME}
  122. sessionAffinity: None
  123. type: ClusterIP
  124. - apiVersion: v1
  125. kind: Route
  126. metadata:
  127. labels:
  128. app: ${SERVICE_NAME}
  129. name: ${SERVICE_NAME}
  130. spec:
  131. port:
  132. targetPort: 8081-tcp
  133. to:
  134. kind: Service
  135. name: ${SERVICE_NAME}
  136. weight: 100
  137. - apiVersion: v1
  138. kind: PersistentVolumeClaim
  139. metadata:
  140. labels:
  141. app: ${SERVICE_NAME}
  142. name: ${SERVICE_NAME}-pv
  143. spec:
  144. accessModes:
  145. - ReadWriteOnce
  146. resources:
  147. requests:
  148. storage: ${VOLUME_CAPACITY}
  149. parameters:
  150. - displayName: Sonatype Nexus service name
  151. name: SERVICE_NAME
  152. required: true
  153. value: nexus
  154. - displayName: Sonatype Nexus version
  155. name: NEXUS_VERSION
  156. required: true
  157. value: 3.14.0
  158. - description: Volume space available for Sonatype Nexus e.g. 512Mi, 2Gi
  159. displayName: Volume Space for Nexus
  160. name: VOLUME_CAPACITY
  161. required: true
  162. value: 5Gi
  163. - description: Max memory allocated to the Nexus pod
  164. displayName: Max Memory
  165. name: MAX_MEMORY
  166. required: true
  167. value: 2Gi