diff --git a/myapp/custom-values.yaml b/myapp/custom-values.yaml index 8be1251..a31b5e4 100644 --- a/myapp/custom-values.yaml +++ b/myapp/custom-values.yaml @@ -59,13 +59,13 @@ config: APP_DEBUG: "false" secret: - - DB_HOST: mysql.default.svc.cluster.local - DB_NAME: applicationdb - DB_USER: appuser - DB_PASSWORD: MyStrongPassword123 + name: applicationtest-myapp-secret +vault: + secretStore: vault + secretPath: applicationtest + refreshInterval: 1h # This is for setting up a service more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/ service: # This sets the service type more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types diff --git a/myapp/templates/deployment.yaml b/myapp/templates/deployment.yaml index 2792549..2b82f70 100644 --- a/myapp/templates/deployment.yaml +++ b/myapp/templates/deployment.yaml @@ -42,7 +42,7 @@ spec: - configMapRef: name: {{ include "myapp.fullname" . }}-config - secretRef: - name: {{ include "myapp.fullname" . }}-secret + name: {{ .Values.secret.name }} imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - name: http diff --git a/myapp/templates/external-secret.yaml b/myapp/templates/external-secret.yaml new file mode 100644 index 0000000..5bb77d4 --- /dev/null +++ b/myapp/templates/external-secret.yaml @@ -0,0 +1,19 @@ +apiVersion: external-secrets.io/v1 +kind: ExternalSecret +metadata: + name: {{ include "myapp.fullname" . }}-secret + +spec: + refreshInterval: {{ .Values.vault.refreshInterval }} + + secretStoreRef: + name: {{ .Values.vault.secretStore }} + kind: ClusterSecretStore + + target: + name: {{ include "myapp.fullname" . }}-secret + creationPolicy: Owner + + dataFrom: + - extract: + key: {{ .Values.vault.secretPath }} diff --git a/myapp/templates/secret.yaml b/myapp/templates/secret.yaml deleted file mode 100644 index 69ac935..0000000 --- a/myapp/templates/secret.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v1 -kind: Secret - -metadata: - name: {{ include "myapp.fullname" . }}-secret - -type: Opaque - -stringData: - -{{- range $key, $value := .Values.secret }} - {{ $key }}: "{{ $value }}" -{{- end }}