Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the possibility to use multiple FQDN #198

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion charts/nexus-repository-manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}]` |
Expand All @@ -141,13 +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 | `[]` |
| `tolerations` | tolerations list | `[]` |
| `config.enabled` | Enable configmap | `false` |
| `config.mountPath` | Path to mount the config | `/sonatype-nexus-conf` |
Expand Down
32 changes: 31 additions & 1 deletion charts/nexus-repository-manager/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}
---
Expand Down Expand Up @@ -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:
Expand All @@ -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 */ -}}
4 changes: 4 additions & 0 deletions charts/nexus-repository-manager/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,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:
Expand Down Expand Up @@ -111,6 +113,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:
Expand Down