Last active
May 16, 2020 15:25
-
-
Save eumel8/9c4986af96591b3f62e0b239dbff0885 to your computer and use it in GitHub Desktop.
Helm template for httpasswd user in Kubernetes Ingress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: networking.k8s.io/v1beta1 | |
kind: Ingress | |
metadata: | |
name: {{ $.Values.Name }} | |
annotations: | |
kubernetes.io/ingress.class: nginx | |
external-dns.alpha.kubernetes.io/target: {{ $.Values.ClusterName }} | |
nginx.ingress.kubernetes.io/rewrite-target: / | |
nginx.ingress.kubernetes.io/affinity: cookie | |
{{- if .Values.htaccess.enabled }} | |
nginx.ingress.kubernetes.io/auth-realm: Authentication Required - {{ .Values.Name }} | |
nginx.ingress.kubernetes.io/auth-secret: {{ .Values.Name }}-htaccess-secret | |
nginx.ingress.kubernetes.io/auth-type: basic | |
{{- end }} | |
certmanager.k8s.io/cluster-issuer: {{ $.Values.Issuer }} | |
spec: | |
rules: | |
- host: {{ $.Values.ApplicationInternetName }} | |
http: | |
paths: | |
- path: / | |
backend: | |
serviceName: {{ $.Values.Name }} | |
servicePort: 80 | |
tls: | |
- hosts: | |
- {{ $.Values.ApplicationInternetName }} | |
secretName: {{ $.Values.Name }}-tls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{- if and .Values.htaccess.enabled (not .Values.htaccess.existingSecret) }} | |
--- | |
apiVersion: v1 | |
kind: Secret | |
metadata: | |
name: {{ .Values.Name }}-htaccess-secret | |
labels: | |
app.kubernetes.io/managed-by: {{ .Values.Name }} | |
type: Opaque | |
data: | |
auth: {{ (index .Values.htaccess.auth) | b64enc }} | |
{{- end }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
htaccess: | |
enabled: true | |
existingSecret: "" | |
auth: | | |
user1:password_hash1 | |
user2:password_hash2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment