feat(helm): Add labels and annotations to helm chart

This commit is contained in:
Vegard Hagen
2023-04-10 21:14:07 +02:00
parent 9d5a579793
commit ad7ecb83fd
14 changed files with 68 additions and 30 deletions
-2
View File
@@ -16,9 +16,7 @@ spec:
namespace: arr
authOnly: true
auth:
host: auth-arr
cookieDomain: stonegarden.dev
cookieName: _arr_auth
whitelist:
- [email protected]
destination:
+2
View File
@@ -21,6 +21,8 @@ additionalVolumes:
value:
hostPath:
path: /disk/data
additionalLabels:
app.kubernetes.io/part-of: arr
auth:
enabled: true
create: false
+3
View File
@@ -1,5 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
commonLabels:
app.kubernetes.io/part-of: arr
app.kubernetes.io/managed-by: argocd
resources:
- cm-common-env.yaml
+1 -1
View File
@@ -2,7 +2,7 @@ name: auth
namespace: test
authOnly: true
auth:
host: auth-test
cookieDomain: stonegarden.dev
whitelist:
- [email protected]
- [email protected]
+3 -14
View File
@@ -1,21 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
commonLabels:
app.kubernetes.io/part-of: arr
resources:
- app1.yaml
- app2.yaml
- app3.yaml
- auth.yaml
#helmGlobals:
# chartHome: ../../helm
#
#helmCharts:
# - name: application
# valuesFile: auth.yaml
# - name: application
# valuesFile: app1.yaml
# - name: application
# valuesFile: app2.yaml
# - name: application
# valuesFile: app3.yaml
- auth.yaml
+19
View File
@@ -1,3 +1,22 @@
{{/*
Common labels
*/}}
{{- define "common.labels" -}}
app.kubernetes.io/name: {{ .Values.name }}
{{- with .Values.additionalLabels }}
{{ toYaml . }}
{{- end }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "common.annotations" -}}
{{- with .Values.annotations }}
{{ toYaml . }}
{{- end }}
{{- end }}
{{/*
Returns string "true" or empty which will be evaluated to boolean false
*/}}
@@ -4,6 +4,10 @@ kind: Deployment
metadata:
name: {{ .Values.name }}
namespace: {{ .Values.namespace }}
labels:
{{- include "common.labels" . | nindent 4 }}
annotations:
{{- include "common.annotations" . | nindent 4 }}
spec:
replicas: {{ .Values.replicas }}
selector:
@@ -4,6 +4,10 @@ kind: Service
metadata:
name: {{ .Values.name }}
namespace: {{ .Values.namespace }}
labels:
{{- include "common.labels" . | nindent 4 }}
annotations:
{{- include "common.annotations" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
@@ -5,7 +5,7 @@ metadata:
name: {{ .Values.name }}
namespace: {{ .Values.namespace }}
labels:
app: traefik
{{- include "common.labels" . | nindent 4 }}
spec:
entryPoints:
- websecure
@@ -6,19 +6,22 @@ metadata:
namespace: {{ .Values.namespace }}
labels:
app: traefik-forward-auth
{{- include "common.labels" . | nindent 4 }}
annotations:
{{- include "common.annotations" . | nindent 4 }}
data:
traefik-forward-auth.ini: |-
cookie-name = "{{ .Values.auth.cookieName }}"
log-level = "{{ .Values.auth.logLevel }}"
cookie-domain = "{{ .Values.auth.cookieDomain }}"
auth-host = "{{ .Values.auth.host}}.{{ .Values.auth.cookieDomain }}"
cookie-name = {{ .Values.auth.cookieName | default (print "_" .Values.namespace "_auth") | quote }}
cookie-domain = {{ .Values.auth.cookieDomain | quote }}
auth-host = {{ .Values.auth.host | default (print "auth-" .Values.namespace "." .Values.auth.cookieDomain ) | quote}}
log-level = {{ .Values.auth.logLevel | quote}}
{{- range .Values.auth.domains }}
domain = "{{ . }}"
domain = {{ . | quote }}
{{- end }}
{{- range .Values.auth.whitelist }}
whitelist = {{ . }}
whitelist = {{ . | quote }}
{{- end }}
{{- with .Values.auth.extraConfig -}}
{{ . | nindent 4 }}
{{- range $key, $val := .Values.auth.extraConfig -}}
{{ $key | nindent 4 }} = {{ $val | quote }}
{{- end }}
{{- end }}
@@ -4,6 +4,10 @@ kind: Deployment
metadata:
name: traefik-forward-auth
namespace: {{ .Values.namespace }}
labels:
{{- include "common.labels" . | nindent 4 }}
annotations:
{{- include "common.annotations" . | nindent 4 }}
spec:
replicas: 1
selector:
@@ -4,6 +4,10 @@ kind: Middleware
metadata:
name: traefik-forward-auth
namespace: {{ .Values.namespace }}
labels:
{{- include "common.labels" . | nindent 4 }}
annotations:
{{- include "common.annotations" . | nindent 4 }}
spec:
forwardAuth:
address: "http://traefik-forward-auth.{{ .Values.namespace }}.svc.cluster.local:{{ .Values.auth.port }}"
@@ -4,6 +4,10 @@ kind: Service
metadata:
name: traefik-forward-auth
namespace: {{ .Values.namespace }}
labels:
{{- include "common.labels" . | nindent 4 }}
annotations:
{{- include "common.annotations" . | nindent 4 }}
spec:
type: ClusterIP
selector:
+8 -4
View File
@@ -32,6 +32,10 @@ additionalVolumes:
# mountPath: /container/path
# value: {}
additionalLabels: {}
annotations: {}
resources: {}
# limits:
# cpu: 100m
@@ -47,10 +51,10 @@ auth:
# Set to "false" to reuse a different deployment in the same namespace
create: true
port: 4181
cookieName: _forward_auth
cookieDomain: stonegarden.dev
host: auth
cookieName: ""
cookieDomain: ""
host: ""
domains: {}
whitelist: {}
logLevel: error
extraConfig: {}
extraConfig: {}