Compare commits

..

5 Commits

Author SHA1 Message Date
Olu Shiyanbade
3bafb6516c Set replicas to 1 2022-12-15 16:46:02 +00:00
Olu Shiyanbade
0d832f8909 Use statefulsets for resiliency 2022-12-15 16:43:07 +00:00
Olu Shiyanbade
1207dee299 fix lint errors 2022-11-22 11:10:58 +00:00
Olu Shiyanbade
14472c593b delete local pv and pvc yamls 2022-11-22 10:46:46 +00:00
Olu Shiyanbade
85adad84ef Use dynamic provisioning and stateful sets 2022-11-22 01:25:13 +00:00
18 changed files with 62 additions and 102 deletions

View File

@@ -14,11 +14,7 @@
--> -->
# ⚠️ Archive Notice # ⚠️ Archive Notice
As of October 24, 2023, we will be making the following changes to this repository and the available helm charts: As of October 24, 2023, we will no longer update or support the [Single-Instance OSS/Pro Kubernetes Chart](https://github.com/sonatype/nxrm3-helm-repository/tree/main/nexus-repository-manager).
1. We will no longer update or support the [Helm Chart for Single-Instance Kubernetes Deployments using OrientDB](https://github.com/sonatype/nxrm3-helm-repository/tree/main/nexus-repository-manager). This is because deploying Nexus Repository in containers with an embedded database has been known to corrupt the database under some circumstances. We strongly recommend that you use an external PostgreSQL database for Kubernetes deployments.
2. There is not nor do we anticipate their being a Helm chart available for single-instance Kubernetes deployments using PostgreSQL.
3. The only Helm chart we will support is the [Helm Chart for Resilient AWS deployments using EKS](https://github.com/sonatype/nxrm3-helm-repository/tree/main/nxrm-aws-resiliency), which allows you to deploy Nexus Repository in an EKS cluster as described in our [resilient deployment options documentation](https://help.sonatype.com/repomanager3/planning-your-implementation/resiliency-and-high-availability/single-node-cloud-resilient-deployment-example-using-aws).
## Helm Charts for Sonatype Nexus Repository Manager 3 ## Helm Charts for Sonatype Nexus Repository Manager 3
@@ -29,7 +25,7 @@ See the [AWS Single-Instance Resiliency Chart](https://github.com/sonatype/nxrm3
* Planning to configure a single Nexus Repository Pro instance within your Kubernetes/EKS cluster with two or more nodes spread across different AZs within an AWS region * Planning to configure a single Nexus Repository Pro instance within your Kubernetes/EKS cluster with two or more nodes spread across different AZs within an AWS region
* Using an external PostgreSQL database (required) * Using an external PostgreSQL database (required)
See the [Single-Instance OSS/Pro Helm Chart](https://github.com/sonatype/nxrm3-helm-repository/tree/main/nexus-repository-manager) if you are doing the following: See the [Single-Instance OSS/Pro Kubernetes Chart](https://github.com/sonatype/nxrm3-helm-repository/tree/main/nexus-repository-manager) if you are doing the following:
* Using embedded OrientDB (required) * Using embedded OrientDB (required)
* Deploying either Nexus Repository Pro or OSS to an on-premises environment with bare metal/VM server (Node) * Deploying either Nexus Repository Pro or OSS to an on-premises environment with bare metal/VM server (Node)
* Deploying a single Nexus Repository instance within a Kubernetes cluster that has a single Node configured * Deploying a single Nexus Repository instance within a Kubernetes cluster that has a single Node configured

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -3,10 +3,10 @@ name: nexus-repository-manager
# This is the chart version. This version number should be incremented each time you make changes # This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version. # to the chart and its templates, including the app version.
version: 45.1.0 version: 43.0.0
# This is the version number of the application being deployed. This version number should be # This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. # incremented each time you make changes to the application.
appVersion: 3.45.1 appVersion: 3.43.0
description: Sonatype Nexus Repository Manager - Universal Binary repository description: Sonatype Nexus Repository Manager - Universal Binary repository

View File

@@ -12,14 +12,9 @@
Eclipse Foundation. All other trademarks are the property of their respective owners. Eclipse Foundation. All other trademarks are the property of their respective owners.
--> -->
# ⚠️ Archive Notice # ⚠️ Archive Notice
As of October 24, 2023, we will be making the following changes to this repository and the available helm charts: As of October 24, 2023, we will no longer update or support this Helm chart.
1. We will no longer update or support this Helm chart for Kubernetes deployments using OrientDB. This is because deploying Nexus Repository in containers with an embedded database has been known to corrupt the database under some circumstances. We strongly recommend that you use an external PostgreSQL database for Kubernetes deployments.
2. There is not nor do we anticipate their being a Helm chart available for single-instance Kubernetes deployments using PostgreSQL.
3. The only Helm chart we will support is the [Helm Chart for Resilient AWS deployments using EKS](https://github.com/sonatype/nxrm3-helm-repository/tree/main/nxrm-aws-resiliency), which allows you to deploy Nexus Repository in an EKS cluster as described in our [resilient deployment options documentation](https://help.sonatype.com/repomanager3/planning-your-implementation/resiliency-and-high-availability/single-node-cloud-resilient-deployment-example-using-aws).
# Nexus Repository # Nexus Repository

View File

@@ -6,7 +6,7 @@ deploymentStrategy: Recreate
image: image:
# Sonatype Official Public Image # Sonatype Official Public Image
repository: sonatype/nexus3 repository: sonatype/nexus3
tag: 3.45.1 tag: 3.43.0
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
imagePullSecrets: imagePullSecrets:
# for image registries that require login, specify the name of the existing # for image registries that require login, specify the name of the existing

View File

@@ -15,13 +15,13 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes # This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version. # to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/) # Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 45.1.0 version: 43.0.0
# This is the version number of the application being deployed. This version number should be # This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to # incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using. # follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes. # It is recommended to use it with quotes.
appVersion: 3.45.1 appVersion: 3.43.0
keywords: keywords:
- artifacts - artifacts

View File

@@ -63,4 +63,4 @@ spec:
- --txt-owner-id=external-dns - --txt-owner-id=external-dns
env: env:
- name: AWS_DEFAULT_REGION - name: AWS_DEFAULT_REGION
value: {{ .Values.deployment.clusterRegion }} value: {{ .Values.statefulset.clusterRegion }}

View File

@@ -39,12 +39,12 @@ metadata:
name: fluent-bit-cluster-info name: fluent-bit-cluster-info
namespace: {{ .Values.namespaces.cloudwatchNs }} namespace: {{ .Values.namespaces.cloudwatchNs }}
data: data:
cluster.name: {{ .Values.deployment.clusterName }} cluster.name: {{ .Values.statefulset.clusterName }}
http.server: "On" http.server: "On"
http.port: "2020" http.port: "2020"
read.head: "Off" read.head: "Off"
read.tail: "On" read.tail: "On"
logs.region: {{ .Values.deployment.logsRegion }} logs.region: {{ .Values.statefulset.logsRegion }}
--- ---
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
@@ -77,7 +77,7 @@ data:
[INPUT] [INPUT]
Name tail Name tail
Tag nexus.nexus-log Tag nexus.nexus-log
Path /var/log/containers/{{ .Chart.Name }}-{{ .Chart.Version }}.{{ .Release.Name }}-nxrm.deployment*{{ .Values.namespaces.nexusNs }}_nxrm-app-*.log Path /var/log/containers/{{ .Chart.Name }}-{{ .Chart.Version | replace "." "-" }}-{{ .Release.Name }}-{{ .Values.statefulset.name }}*{{ .Values.namespaces.nexusNs }}_nxrm-app-*.log
Parser docker Parser docker
DB /var/fluent-bit/state/flb_container.db DB /var/fluent-bit/state/flb_container.db
Mem_Buf_Limit 5MB Mem_Buf_Limit 5MB
@@ -112,7 +112,7 @@ data:
[INPUT] [INPUT]
Name tail Name tail
Tag nexus.request-log Tag nexus.request-log
Path /var/log/containers/{{ .Chart.Name }}-{{ .Chart.Version }}.{{ .Release.Name }}-nxrm.deployment*{{ .Values.namespaces.nexusNs }}_request-log-*.log Path /var/log/containers/{{ .Chart.Name }}-{{ .Chart.Version | replace "." "-" }}-{{ .Release.Name }}-{{ .Values.statefulset.name }}*{{ .Values.namespaces.nexusNs }}_request-log-*.log
Parser docker Parser docker
DB /var/fluent-bit/state/flb_container.db DB /var/fluent-bit/state/flb_container.db
Mem_Buf_Limit 5MB Mem_Buf_Limit 5MB
@@ -147,7 +147,7 @@ data:
[INPUT] [INPUT]
Name tail Name tail
Tag nexus.audit-log Tag nexus.audit-log
Path /var/log/containers/{{ .Chart.Name }}-{{ .Chart.Version }}.{{ .Release.Name }}-nxrm.deployment*{{ .Values.namespaces.nexusNs }}_audit-log-*.log Path /var/log/containers/{{ .Chart.Name }}-{{ .Chart.Version | replace "." "-" }}-{{ .Release.Name }}-{{ .Values.statefulset.name }}*{{ .Values.namespaces.nexusNs }}_audit-log-*.log
Parser docker Parser docker
DB /var/fluent-bit/state/flb_container.db DB /var/fluent-bit/state/flb_container.db
Mem_Buf_Limit 5MB Mem_Buf_Limit 5MB
@@ -182,7 +182,7 @@ data:
[INPUT] [INPUT]
Name tail Name tail
Tag nexus.tasks-log Tag nexus.tasks-log
Path /var/log/containers/{{ .Chart.Name }}-{{ .Chart.Version }}.{{ .Release.Name }}-nxrm.deployment*{{ .Values.namespaces.nexusNs }}_tasks-log-*.log Path /var/log/containers/{{ .Chart.Name }}-{{ .Chart.Version | replace "." "-" }}-{{ .Release.Name }}-{{ .Values.statefulset.name }}*{{ .Values.namespaces.nexusNs }}_tasks-log-*.log
Parser docker Parser docker
DB /var/fluent-bit/state/flb_container.db DB /var/fluent-bit/state/flb_container.db
Mem_Buf_Limit 5MB Mem_Buf_Limit 5MB
@@ -263,7 +263,7 @@ spec:
spec: spec:
containers: containers:
- name: fluent-bit - name: fluent-bit
image: amazon/aws-for-fluent-bit:{{ .Values.deployment.fluentBitVersion }} image: amazon/aws-for-fluent-bit:{{ .Values.statefulset.fluentBitVersion }}
imagePullPolicy: Always imagePullPolicy: Always
env: env:
- name: AWS_REGION - name: AWS_REGION

View File

@@ -1,28 +0,0 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: {{ .Chart.Name }}-{{ .Chart.Version }}.{{ .Release.Name }}-ebs-pv
spec:
capacity:
storage: {{ .Values.pv.storage }}
volumeMode: Filesystem
accessModes:
- {{ .Values.pv.accessModes }}
persistentVolumeReclaimPolicy: {{ .Values.pv.reclaimPolicy }}
storageClassName: local-storage
local:
path: {{ .Values.pv.path }}
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: topology.kubernetes.io/zone
operator: In
values:
{{- range $zone := .Values.pv.zones }}
- {{ $zone }}
{{- end }}

View File

@@ -1,12 +0,0 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Chart.Name }}-{{ .Chart.Version }}.{{ .Release.Name }}-ebs-claim
namespace: {{ .Values.namespaces.nexusNs }}
spec:
accessModes:
- {{ .Values.pvc.accessModes }}
storageClassName: local-storage
resources:
requests:
storage: {{ .Values.pvc.storage }}

View File

@@ -1,12 +1,13 @@
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: StatefulSet
metadata: metadata:
name: {{ .Chart.Name }}-{{ .Chart.Version }}.{{ .Release.Name }}-{{ .Values.deployment.name }} name: {{ .Chart.Name }}-{{ .Chart.Version | replace "." "-"}}-{{ .Release.Name }}-{{ .Values.statefulset.name }}
namespace: {{ .Values.namespaces.nexusNs }} namespace: {{ .Values.namespaces.nexusNs }}
labels: labels:
app: nxrm app: nxrm
spec: spec:
replicas: 1 replicas: 1
serviceName: "{{ .Chart.Name }}-{{ .Chart.Version | replace "." "-"}}-{{ .Release.Name }}-{{ .Values.statefulset.name }}"
selector: selector:
matchLabels: matchLabels:
app: nxrm app: nxrm
@@ -21,7 +22,7 @@ spec:
# otherwise the side car containers will crash a couple of times and backoff whilst waiting # otherwise the side car containers will crash a couple of times and backoff whilst waiting
# for nxrm-app to start and this increases the total start up time. # for nxrm-app to start and this increases the total start up time.
- name: chown-nexusdata-owner-to-nexus-and-init-log-dir - name: chown-nexusdata-owner-to-nexus-and-init-log-dir
image: {{ .Values.deployment.initContainer.image.repository }}:{{ .Values.deployment.initContainer.image.tag }} image: {{ .Values.statefulset.initContainer.image.repository }}:{{ .Values.statefulset.initContainer.image.tag }}
command: [/bin/sh] command: [/bin/sh]
args: args:
- -c - -c
@@ -34,19 +35,20 @@ spec:
touch -a /nexus-data/log/request.log && touch -a /nexus-data/log/request.log &&
chown -R '200:200' /nexus-data chown -R '200:200' /nexus-data
volumeMounts: volumeMounts:
- name: nexusdata - name: nexus-data
mountPath: /nexus-data mountPath: /nexus-data
terminationGracePeriodSeconds: 20
containers: containers:
- name: nxrm-app - name: nxrm-app
image: {{ .Values.deployment.container.image.repository }}:{{ .Values.deployment.container.image.tag }} image: {{ .Values.statefulset.container.image.repository }}:{{ .Values.statefulset.container.image.tag }}
securityContext: securityContext:
runAsUser: 200 runAsUser: 200
imagePullPolicy: {{ .Values.deployment.container.pullPolicy }} imagePullPolicy: {{ .Values.statefulset.container.pullPolicy }}
ports: ports:
- containerPort: {{ .Values.deployment.container.containerPort }} - containerPort: {{ .Values.statefulset.container.containerPort }}
env: env:
- name: DB_NAME - name: DB_NAME
value: "{{ .Values.deployment.container.env.nexusDBName }}" value: "{{ .Values.statefulset.container.env.nexusDBName }}"
- name: DB_PASSWORD - name: DB_PASSWORD
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
@@ -70,41 +72,38 @@ spec:
- name: NEXUS_SECURITY_RANDOMPASSWORD - name: NEXUS_SECURITY_RANDOMPASSWORD
value: "false" value: "false"
- name: INSTALL4J_ADD_VM_PARAMS - name: INSTALL4J_ADD_VM_PARAMS
value: "{{ .Values.deployment.container.env.install4jAddVmParams }} -Dnexus.licenseFile=/nxrm-secrets/{{ .Values.secret.license.alias }} \ value: "{{ .Values.statefulset.container.env.install4jAddVmParams }} -Dnexus.licenseFile=/nxrm-secrets/{{ .Values.secret.license.alias }} \
-Dnexus.datastore.enabled=true -Djava.util.prefs.userRoot=${NEXUS_DATA}/javaprefs \ -Dnexus.datastore.enabled=true -Djava.util.prefs.userRoot=${NEXUS_DATA}/javaprefs \
-Dnexus.datastore.nexus.jdbcUrl=jdbc:postgresql://${DB_HOST}:{{ .Values.deployment.container.env.nexusDBPort }}/${DB_NAME} \ -Dnexus.datastore.nexus.jdbcUrl=jdbc:postgresql://${DB_HOST}:{{ .Values.statefulset.container.env.nexusDBPort }}/${DB_NAME} \
-Dnexus.datastore.nexus.username=${DB_USER} \ -Dnexus.datastore.nexus.username=${DB_USER} \
-Dnexus.datastore.nexus.password=${DB_PASSWORD}" -Dnexus.datastore.nexus.password=${DB_PASSWORD}"
volumeMounts: volumeMounts:
- mountPath: /nxrm-secrets - mountPath: /nxrm-secrets
name: nxrm-secrets name: nxrm-secrets
- name: nexusdata - name: nexus-data
mountPath: /nexus-data mountPath: /nexus-data
- name: logback-tasklogfile-override - name: logback-tasklogfile-override
mountPath: /nexus-data/etc/logback/logback-tasklogfile-appender-override.xml mountPath: /nexus-data/etc/logback/logback-tasklogfile-appender-override.xml
subPath: logback-tasklogfile-appender-override.xml subPath: logback-tasklogfile-appender-override.xml
- name: request-log - name: request-log
image: {{ .Values.deployment.requestLogContainer.image.repository }}:{{ .Values.deployment.requestLogContainer.image.tag }} image: {{ .Values.statefulset.requestLogContainer.image.repository }}:{{ .Values.statefulset.requestLogContainer.image.tag }}
args: [/bin/sh, -c, 'tail -n+1 -F /nexus-data/log/request.log'] args: [/bin/sh, -c, 'tail -n+1 -F /nexus-data/log/request.log']
volumeMounts: volumeMounts:
- name: nexusdata - name: nexus-data
mountPath: /nexus-data mountPath: /nexus-data
- name: audit-log - name: audit-log
image: {{ .Values.deployment.auditLogContainer.image.repository }}:{{ .Values.deployment.auditLogContainer.image.tag }} image: {{ .Values.statefulset.auditLogContainer.image.repository }}:{{ .Values.statefulset.auditLogContainer.image.tag }}
args: [/bin/sh, -c, 'tail -n+1 -F /nexus-data/log/audit/audit.log'] args: [/bin/sh, -c, 'tail -n+1 -F /nexus-data/log/audit/audit.log']
volumeMounts: volumeMounts:
- name: nexusdata - name: nexus-data
mountPath: /nexus-data mountPath: /nexus-data
- name: tasks-log - name: tasks-log
image: {{ .Values.deployment.taskLogContainer.image.repository }}:{{ .Values.deployment.taskLogContainer.image.tag }} image: {{ .Values.statefulset.taskLogContainer.image.repository }}:{{ .Values.statefulset.taskLogContainer.image.tag }}
args: [/bin/sh, -c, 'tail -n+1 -F /nexus-data/log/tasks/allTasks.log'] args: [/bin/sh, -c, 'tail -n+1 -F /nexus-data/log/tasks/allTasks.log']
volumeMounts: volumeMounts:
- name: nexusdata - name: nexus-data
mountPath: /nexus-data mountPath: /nexus-data
volumes: volumes:
- name: nexusdata
persistentVolumeClaim:
claimName: {{ .Chart.Name }}-{{ .Chart.Version }}.{{ .Release.Name }}-ebs-claim
- name: nxrm-secrets - name: nxrm-secrets
csi: csi:
driver: secrets-store.csi.k8s.io driver: secrets-store.csi.k8s.io
@@ -118,3 +117,12 @@ spec:
items: items:
- key: logback-tasklogfile-appender-override.xml - key: logback-tasklogfile-appender-override.xml
path: logback-tasklogfile-appender-override.xml path: logback-tasklogfile-appender-override.xml
volumeClaimTemplates:
- metadata:
name: nexus-data
spec:
accessModes: [ "{{.Values.pvc.accessModes }}" ]
storageClassName: "{{ .Chart.Name }}-{{ .Chart.Version}}-{{ .Release.Name }}-ebs-storage"
resources:
requests:
storage: {{.Values.pvc.storage }}

View File

@@ -1,7 +1,11 @@
apiVersion: storage.k8s.io/v1 apiVersion: storage.k8s.io/v1
kind: StorageClass kind: StorageClass
metadata: metadata:
name: {{ .Chart.Name }}-{{ .Chart.Version }}.{{ .Release.Name }}-local-storage name: "{{ .Chart.Name }}-{{ .Chart.Version}}-{{ .Release.Name }}-ebs-storage"
namespace: {{ .Values.namespaces.nexusNs }} namespace: {{ .Values.namespaces.nexusNs }}
provisioner: kubernetes.io/no-provisioner provisioner: kubernetes.io/aws-ebs
parameters:
type: io1
fsType: "ext4"
iopsPerGB: "{{ .Values.storageClass.iopsPerGB }}"
volumeBindingMode: WaitForFirstConsumer volumeBindingMode: WaitForFirstConsumer

View File

@@ -6,9 +6,9 @@ namespaces:
externaldns: externaldns:
domainFilter: example.com #your root domain e.g example.com domainFilter: example.com #your root domain e.g example.com
awsZoneType: private # hosted zone to look at (valid values are public, private or no value for both) awsZoneType: private # hosted zone to look at (valid values are public, private or no value for both)
deployment: statefulset:
clusterRegion: us-east-1 clusterRegion: us-east-1
name: nxrm.deployment name: nxrm-statefulset
clusterName: nxrm-nexus clusterName: nxrm-nexus
logsRegion: us-east-1 logsRegion: us-east-1
fluentBitVersion: 2.28.0 fluentBitVersion: 2.28.0
@@ -19,7 +19,7 @@ deployment:
container: container:
image: image:
repository: sonatype/nexus3 repository: sonatype/nexus3
tag: 3.41.1 tag: 3.44.0
containerPort: 8081 containerPort: 8081
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
env: env:
@@ -59,16 +59,13 @@ ingress:
alb.ingress.kubernetes.io/subnets: subnet-1,subnet-2 #comma separated list of subnet ids, comment out if you don't use docker repositories alb.ingress.kubernetes.io/subnets: subnet-1,subnet-2 #comma separated list of subnet ids, comment out if you don't use docker repositories
alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":443}]' #comment out if you don't use docker repositories alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":443}]' #comment out if you don't use docker repositories
alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:us-east-1:0000000000000:certificate/00000000-1111-2222-3333-444444444444 # Comment out if you don't use docker repositories - The AWS Certificate Manager ARN for your HTTPS certificate alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:us-east-1:0000000000000:certificate/00000000-1111-2222-3333-444444444444 # Comment out if you don't use docker repositories - The AWS Certificate Manager ARN for your HTTPS certificate
external-dns.alpha.kubernetes.io/hostname: dockerrepo1.example.com, dockerrepo2.example.com, dockerrepo3.example.com # Add more docker subdomains using dockerrepoName.example.com othereise comment out if you don't use docker repositories external-dns.alpha.kubernetes.io/hostname: dockerrepo1.example.com, dockerrepo2.example.com, dockerrepo3.example.com # Add more docker subdomains using dockerrepoName.example.com otherwise comment out if you don't use docker repositories
pv: storageClass:
storage: 120Gi
volumeMode: Filesystem
accessModes: ReadWriteOnce
reclaimPolicy: Retain
path: /mnt
zones: zones:
zone1: us-east-1a zone1: zone1
zone2: us-east-1b zone2: zone2
zone3: zone3
iopsPerGB: "10"
pvc: pvc:
accessModes: ReadWriteOnce accessModes: ReadWriteOnce
storage: 100Gi storage: 100Gi