Skip to content

Commit

Permalink
feat: allow multiple ingress hostnames (#74)
Browse files Browse the repository at this point in the history
* allow multiple ingress hostnames

* fix: make default for ingress.additionalHostnames blank array

* fix: update default values to shrink diff on PR to upstream

* fix: increment chart version to expose feature add

* docs: provide example of ingress.additionalHostnames in README
  • Loading branch information
santiagon610 authored Feb 18, 2024
1 parent 2fc77ef commit 5ca9c62
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 4 deletions.
2 changes: 1 addition & 1 deletion charts/vaultwarden/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ maintainers:
- name: guerzon
email: [email protected]
url: https://github.com/guerzon
version: 0.22.0
version: 0.22.1
kubeVersion: ">=1.12.0-0"
16 changes: 15 additions & 1 deletion charts/vaultwarden/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,19 @@ ingress:
allowList: "10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16"
```

If you intend on making your ingress available via multiple hostnames, you can invoke the `ingress.additionalHostnames` as follows:

```yaml
ingress:
enabled: true
class: "nginx"
tlsSecret: vw-contoso-com-crt
hostname: vaultwarden.contoso.com
additionalHostnames:
- vw.contoso.com
allowList: "10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16"
```

### AWS LB Controller

When using AWS, the [AWS Load Balancer controller](https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.4/deploy/installation/) can be used together with [ACM](https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.4/guide/ingress/cert_discovery/).
Expand Down Expand Up @@ -414,7 +427,7 @@ helm -n $NAMESPACE uninstall $RELEASE_NAME
| `smtp.acceptInvalidCerts` | Accept Invalid Certificates | `false` |
| `smtp.debug` | SMTP debugging | `false` |

### Exposure settings
### Exposure settings

| Name | Description | Value |
| --------------------------------- | ------------------------------------------------------------------------------ | -------------------- |
Expand All @@ -435,6 +448,7 @@ helm -n $NAMESPACE uninstall $RELEASE_NAME
| `ingress.labels` | Additional labels for the ingress resource. | `{}` |
| `ingress.tls` | Enable TLS on the ingress resource. | `true` |
| `ingress.hostname` | Hostname for the ingress. | `warden.contoso.com` |
| `ingress.additionalHostnames` | Additional hostnames for the ingress. | `[]` |
| `ingress.path` | Default application path for the ingress | `/` |
| `ingress.pathWs` | Path for the websocket ingress | `/notifications/hub` |
| `ingress.pathType` | Path type for the ingress | `Prefix` |
Expand Down
28 changes: 27 additions & 1 deletion charts/vaultwarden/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{{- $ingress := .Values.ingress -}}
{{- $websocket := .Values.websocket -}}
{{- $fullname := .Release.fullname -}}
{{- if $ingress.enabled }}
{{- $newAPIversion := .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
{{- if $newAPIversion }}
Expand Down Expand Up @@ -49,9 +51,33 @@ spec:
tls:
- hosts:
- {{ $ingress.hostname | quote }}
{{- range $ingress.additionalHostnames }}
- {{ . | quote }}
{{- end }}
secretName: {{ $ingress.tlsSecret }}
{{- end }}
rules:
{{- range $ingress.additionalHostnames }}
- host: {{ . | quote }}
http:
paths:
- path: {{ $ingress.path }}
pathType: {{ $ingress.pathType }}
backend:
service:
name: {{ include "vaultwarden.fullname" $ }}
port:
name: "http"
{{- if $websocket.enabled }}
- path: {{ $ingress.pathWs }}
pathType: {{ $ingress.pathTypeWs }}
backend:
service:
name: {{ include "vaultwarden.fullname" $ }}
port:
name: "websocket"
{{- end }}
{{- end }}
- host: {{ $ingress.hostname | quote }}
http:
paths:
Expand All @@ -62,7 +88,7 @@ spec:
name: {{ include "vaultwarden.fullname" . }}
port:
name: "http"
{{- if .Values.websocket.enabled }}
{{- if $websocket.enabled }}
- path: {{ $ingress.pathWs }}
pathType: {{ $ingress.pathTypeWs }}
backend:
Expand Down
3 changes: 3 additions & 0 deletions charts/vaultwarden/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,9 @@ ingress:
## @param ingress.hostname Hostname for the ingress.
##
hostname: "warden.contoso.com"
## @param ingress.additionalHostnames Additional hostnames for the ingress.
##
additionalHostnames: []
## @param ingress.path Default application path for the ingress
##
path: "/"
Expand Down
2 changes: 1 addition & 1 deletion generate-readme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ fi
docker build -t readme-gen readme-generator-for-helm/

# Run the tool and mount the current project directory.
docker run --rm -v $(pwd):/mnt -w /mnt readme-gen readme-generator -v charts/vaultwarden/values.yaml -r charts/vaultwarden/README.md
docker run --rm --privileged -v $(pwd):/mnt -w /mnt readme-gen readme-generator -v charts/vaultwarden/values.yaml -r charts/vaultwarden/README.md

0 comments on commit 5ca9c62

Please sign in to comment.