diff --git a/chart/templates/_helpers.tpl b/chart/templates/_helpers.tpl index 11868d58..a7b5df38 100644 --- a/chart/templates/_helpers.tpl +++ b/chart/templates/_helpers.tpl @@ -23,6 +23,24 @@ Create the name of the autosync service account to use {{- end -}} {{- end -}} +{{/* +Create kyoo auth name +*/}} +{{- define "kyoo.auth.fullname" -}} +{{- printf "%s-%s" (include "kyoo.fullname" .) .Values.auth.name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create the name of the auth service account to use +*/}} +{{- define "kyoo.auth.serviceAccountName" -}} +{{- if .Values.auth.serviceAccount.create -}} + {{ default (include "kyoo.auth.fullname" .) .Values.auth.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.auth.serviceAccount.name }} +{{- end -}} +{{- end -}} + {{/* Create kyoo back name */}} diff --git a/chart/templates/auth/deployment.yaml b/chart/templates/auth/deployment.yaml new file mode 100644 index 00000000..1dd02822 --- /dev/null +++ b/chart/templates/auth/deployment.yaml @@ -0,0 +1,93 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + {{- with (mergeOverwrite (deepCopy .Values.global.deploymentAnnotations) .Values.auth.deploymentAnnotations) }} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- end }} + name: {{ include "kyoo.auth.fullname" . }} + labels: + {{- include "kyoo.labels" (dict "context" . "component" .Values.auth.name "name" .Values.auth.name) | nindent 4 }} +spec: + replicas: {{ .Values.auth.replicaCount }} + {{- with .Values.auth.updateStrategy }} + strategy: + {{- toYaml . | nindent 4 }} + {{- end }} + selector: + matchLabels: + {{- include "kyoo.selectorLabels" (dict "context" . "name" .Values.auth.name) | nindent 6 }} + template: + metadata: + {{- with (mergeOverwrite (deepCopy .Values.global.podAnnotations) .Values.auth.podAnnotations) }} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- end }} + labels: + {{- include "kyoo.labels" (dict "context" . "component" .Values.auth.name "name" .Values.auth.name) | nindent 8 }} + {{- with (mergeOverwrite (deepCopy .Values.global.podLabels) .Values.auth.podLabels) }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.auth.imagePullSecrets | default .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.global.securityContext }} + securityContext: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "kyoo.auth.serviceAccountName" . }} + containers: + - name: main + image: {{ .Values.auth.kyoo_auth.image.repository | default (printf "%s/kyoo_auth" .Values.global.image.repositoryBase) }}:{{ default (include "kyoo.defaultTag" .) .Values.auth.kyoo_auth.image.tag }} + imagePullPolicy: {{ default .Values.global.image.imagePullPolicy }} + args: + {{- with .Values.auth.kyoo_auth.extraArgs }} + {{- toYaml . | nindent 12 }} + {{- end }} + env: + - name: KYOO_URL + value: "http://{{ include "kyoo.back.fullname" . }}:5000/api" + {{- with (concat .Values.global.extraEnv .Values.auth.kyoo_auth.extraEnv) }} + {{- toYaml . | nindent 12 }} + {{- end }} + ports: + - name: main + containerPort: 8901 + protocol: TCP + {{- with .Values.auth.kyoo_auth.livenessProbe }} + livenessProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.auth.kyoo_auth.readinessProbe }} + readinessProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.auth.kyoo_auth.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.auth.kyoo_auth.containerSecurityContext }} + securityContext: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.auth.kyoo_auth.extraVolumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.auth.extraContainers }} + {{- tpl (toYaml .) $ | nindent 8 }} + {{- end }} + {{- with .Values.auth.extraInitContainers }} + initContainers: + {{- tpl (toYaml .) $ | nindent 6 }} + {{- end }} + {{- with .Values.auth.extraVolumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} \ No newline at end of file diff --git a/chart/templates/auth/service.yaml b/chart/templates/auth/service.yaml new file mode 100644 index 00000000..894e0907 --- /dev/null +++ b/chart/templates/auth/service.yaml @@ -0,0 +1,24 @@ +apiVersion: v1 +kind: Service +metadata: +{{- if .Values.auth.service.annotations }} + annotations: + {{- range $key, $value := .Values.auth.service.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} +{{- end }} + name: {{ include "kyoo.auth.fullname" . }} + labels: + {{- include "kyoo.labels" (dict "context" . "component" .Values.auth.name "name" .Values.auth.name) | nindent 4 }} + {{- with .Values.auth.service.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.auth.service.type }} + ports: + - port: 4568 + targetPort: 4568 + protocol: TCP + name: main + selector: + {{- include "kyoo.selectorLabels" (dict "context" . "name" .Values.auth.name) | nindent 4 }} diff --git a/chart/templates/auth/serviceaccount.yaml b/chart/templates/auth/serviceaccount.yaml new file mode 100644 index 00000000..2f3a828a --- /dev/null +++ b/chart/templates/auth/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.auth.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +automountServiceAccountToken: {{ .Values.auth.serviceAccount.automount }} +metadata: + name: {{ include "kyoo.auth.serviceAccountName" . }} + labels: + {{- include "kyoo.labels" (dict "context" . "component" .Values.auth.name "name" .Values.auth.name) | nindent 4 }} + {{- with .Values.auth.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }}