From cf59e7024d8c2dd4d8f2373466312e87e7ff1696 Mon Sep 17 00:00:00 2001 From: grimlokason Date: Thu, 28 Apr 2022 17:36:36 +0200 Subject: [PATCH 1/4] Update ingress.yaml add the possibility to use multiple FQDN on UI and Docker registries --- .../templates/ingress.yaml | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/charts/nexus-repository-manager/templates/ingress.yaml b/charts/nexus-repository-manager/templates/ingress.yaml index 198fdfe6..3fcf53af 100644 --- a/charts/nexus-repository-manager/templates/ingress.yaml +++ b/charts/nexus-repository-manager/templates/ingress.yaml @@ -32,6 +32,21 @@ spec: {{- end }} {{- end }} rules: +{{- if .Values.ingress.hostMulti }} +{{- $hostPath := .Values.ingress.hostPath -}} +{{ range $repo := .Values.ingress.hostMulti }} + - host: {{ $repo }} + http: + paths: + - path: {{ $hostPath }} + pathType: Prefix + backend: + service: + name: {{ $fullName }} + port: + number: 8081 +{{- end }} {{- /* range of .Values.ingress.hostRepo */ -}} +{{ else }} - host: {{ .Values.ingress.hostRepo }} http: paths: @@ -42,7 +57,7 @@ spec: name: {{ $fullName }} port: number: 8081 - +{{- end }} {{- /* .Values.ingress.hostMulti */ -}} {{ if .Values.nexus.docker.enabled }} {{ range $registry := .Values.nexus.docker.registries }} --- @@ -70,6 +85,20 @@ spec: - {{ $registry.host | quote }} secretName: {{ $registry.secretName }} rules: +{{- if $registry.hostMulti }} +{{ range $repo := $registry.hostMulti }} + - host: {{ $repo }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ $fullName | trunc 49 }}-docker-{{ $registry.port }} + port: + number: {{ $registry.port }} +{{- end }} {{- /* range of $registry.hostMulti */ -}} +{{ else }} - host: {{ $registry.host }} http: paths: @@ -80,6 +109,7 @@ spec: name: {{ $fullName | trunc 49 }}-docker-{{ $registry.port }} port: number: {{ $registry.port }} +{{- end }} {{- /* registry.hostMulti */ -}} {{- end }} {{- /* range of nexus.docker.registries */ -}} {{- end }} {{- /* nexus.docker.enabled */ -}} {{- end }} {{- /* ingress.enabled */ -}} From cc655318e2692d29c23a07e7506074c49df7ae2f Mon Sep 17 00:00:00 2001 From: grimlokason Date: Thu, 28 Apr 2022 17:42:44 +0200 Subject: [PATCH 2/4] Update values.yaml Add multiHost for multiple FQDN for UI and registries in values.yaml --- charts/nexus-repository-manager/values.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/charts/nexus-repository-manager/values.yaml b/charts/nexus-repository-manager/values.yaml index 4299cd8d..8a9756da 100644 --- a/charts/nexus-repository-manager/values.yaml +++ b/charts/nexus-repository-manager/values.yaml @@ -15,6 +15,8 @@ nexus: enabled: false # registries: # - host: chart.local + # # Array to use multiple fqdn for the same registry. The host value should be present + # hostMulti: [] # port: 5000 # secretName: registry-secret env: @@ -107,6 +109,8 @@ ingress: nginx.ingress.kubernetes.io/proxy-body-size: "0" hostPath: / hostRepo: repo.demo + # Array to use multiple fqdn for the same registry. The hostRepo value should be present + # hostMulti: [] # tls: # - secretName: nexus-local-tls # hosts: From 1f02b58a0154c69a95a2278d706a147c322613b4 Mon Sep 17 00:00:00 2001 From: grimlokason Date: Thu, 28 Apr 2022 17:47:55 +0200 Subject: [PATCH 3/4] Update README.md Add information about the hostMulti in README.md --- charts/nexus-repository-manager/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/charts/nexus-repository-manager/README.md b/charts/nexus-repository-manager/README.md index 69fb21cf..8e7c35b6 100644 --- a/charts/nexus-repository-manager/README.md +++ b/charts/nexus-repository-manager/README.md @@ -123,6 +123,7 @@ The following table lists the configurable parameters of the Nexus chart and the | `nexus.docker.enabled` | Enable/disable Docker support | `false` | | `nexus.docker.registries` | Support multiple Docker registries | (see below) | | `nexus.docker.registries[0].host` | Host for the Docker registry | `cluster.local` | +| `nexus.docker.registries[0].hostMulti` | Array of the hosts for the Docker registry in case of multiple FQDN | | [] | `nexus.docker.registries[0].port` | Port for the Docker registry | `5000` | | `nexus.docker.registries[0].secretName` | TLS Secret Name for the ingress | `registrySecret` | | `nexus.env` | Nexus Repository environment variables | `[{INSTALL4J_ADD_VM_PARAMS: -Xms1200M -Xmx1200M -XX:MaxDirectMemorySize=2G -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap}]` | @@ -148,6 +149,7 @@ The following table lists the configurable parameters of the Nexus chart and the | `ingress.annotations` | Annotations to enhance ingress configuration | `{kubernetes.io/ingress.class: nginx}` | | `ingress.tls.secretName` | Name of the secret storing TLS cert, `false` to use the Ingress' default certificate | `nexus-tls` | | `ingress.path` | Path for ingress rules. GCP users should set to `/*`. | `/` | +| `ingress.hostMulti` | Array of the hosts for the UI in case of multiple FQDN | | [] | `tolerations` | tolerations list | `[]` | | `config.enabled` | Enable configmap | `false` | | `config.mountPath` | Path to mount the config | `/sonatype-nexus-conf` | From b3d450e548bc0ef5f60c3be43ed6e8e44330c0f6 Mon Sep 17 00:00:00 2001 From: grimlokason Date: Thu, 28 Apr 2022 17:51:34 +0200 Subject: [PATCH 4/4] Update README.md correct default values for ingress.hostMulti and nexus.docker.registries[0].hostMulti --- charts/nexus-repository-manager/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/nexus-repository-manager/README.md b/charts/nexus-repository-manager/README.md index 8e7c35b6..0ebab714 100644 --- a/charts/nexus-repository-manager/README.md +++ b/charts/nexus-repository-manager/README.md @@ -123,7 +123,7 @@ The following table lists the configurable parameters of the Nexus chart and the | `nexus.docker.enabled` | Enable/disable Docker support | `false` | | `nexus.docker.registries` | Support multiple Docker registries | (see below) | | `nexus.docker.registries[0].host` | Host for the Docker registry | `cluster.local` | -| `nexus.docker.registries[0].hostMulti` | Array of the hosts for the Docker registry in case of multiple FQDN | | [] +| `nexus.docker.registries[0].hostMulti` | Array of the hosts for the Docker registry in case of multiple FQDN | `[]`| | `nexus.docker.registries[0].port` | Port for the Docker registry | `5000` | | `nexus.docker.registries[0].secretName` | TLS Secret Name for the ingress | `registrySecret` | | `nexus.env` | Nexus Repository environment variables | `[{INSTALL4J_ADD_VM_PARAMS: -Xms1200M -Xmx1200M -XX:MaxDirectMemorySize=2G -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap}]` | @@ -142,14 +142,14 @@ The following table lists the configurable parameters of the Nexus chart and the | `nexus.readinessProbe.failureThreshold` | Number of attempts before failure | 6 | | `nexus.readinessProbe.timeoutSeconds` | Time in seconds after readiness probe times out | `nil` | | `nexus.readinessProbe.path` | Path for ReadinessProbe | / | -| `nexus.hostAliases` | Aliases for IPs in /etc/hosts | [] | +| `nexus.hostAliases` | Aliases for IPs in /etc/hosts | [] | | `nexus.properties.override` | Set to true to override default nexus.properties | `false` | | `nexus.properties.data` | A map of custom nexus properties if `override` is set to true | `nexus.scripts.allowCreation: true` | | `ingress.enabled` | Create an ingress for Nexus Repository | `true` | | `ingress.annotations` | Annotations to enhance ingress configuration | `{kubernetes.io/ingress.class: nginx}` | | `ingress.tls.secretName` | Name of the secret storing TLS cert, `false` to use the Ingress' default certificate | `nexus-tls` | | `ingress.path` | Path for ingress rules. GCP users should set to `/*`. | `/` | -| `ingress.hostMulti` | Array of the hosts for the UI in case of multiple FQDN | | [] +| `ingress.hostMulti` | Array of the hosts for the UI in case of multiple FQDN | `[]` | | `tolerations` | tolerations list | `[]` | | `config.enabled` | Enable configmap | `false` | | `config.mountPath` | Path to mount the config | `/sonatype-nexus-conf` |