{{- if .Values.giteaSecret.create }} {{- $secretName := include "gitea.secretName" . }} {{- $existingSecret := lookup "v1" "Secret" .Release.Namespace $secretName }} {{- if not $existingSecret }} {{- $runnerToken := printf "GENERATED_%s" (randAlphaNum 48) }} {{- $awsAccessKeyId := printf "GENERATED_%s" (randAlphaNum 32) }} {{- $awsSecretAccessKey := printf "GENERATED_%s" (randAlphaNum 64) }} {{- $kubeconfig := "apiVersion: v1\nclusters: []\ncontexts: []\ncurrent-context: \"\"\nkind: Config\npreferences: {}\nusers: []" }} {{- $dockerConfigJson := "{\"auths\":{}}" }} apiVersion: v1 kind: Secret metadata: name: {{ $secretName }} namespace: {{ .Release.Namespace | quote }} labels: {{- include "gitea.labels" . | nindent 4 }} {{- if .Values.giteaSecret.keep }} annotations: helm.sh/resource-policy: keep {{- end }} type: Opaque stringData: runner-registration-token: {{ $runnerToken | quote }} aws-access-key-id: {{ $awsAccessKeyId | quote }} aws-secret-access-key: {{ $awsSecretAccessKey | quote }} kubeconfig: |- {{ $kubeconfig | nindent 4 }} docker-config.json: |- {{ $dockerConfigJson | nindent 4 }} {{- end }} {{- end }}