From 4ba2913a7036a65b0f595a816c61e412930708f8 Mon Sep 17 00:00:00 2001 From: Asara Date: Sat, 8 Jul 2023 17:15:44 -0400 Subject: [PATCH] Lets try with some secrets --- argo/apps/templates/helm-apps.yaml | 6 ++ argo/apps/values.yaml | 5 ++ argo/miniflux/values.yaml | 53 ++++++++++++++ argo/secrets/Chart.yaml | 5 ++ argo/secrets/templates/external-secrets.yaml | 77 ++++++++++++++++++++ argo/secrets/values.yaml | 12 +++ 6 files changed, 158 insertions(+) create mode 100644 argo/miniflux/values.yaml create mode 100644 argo/secrets/Chart.yaml create mode 100644 argo/secrets/templates/external-secrets.yaml create mode 100644 argo/secrets/values.yaml diff --git a/argo/apps/templates/helm-apps.yaml b/argo/apps/templates/helm-apps.yaml index 6851a93..00e9d0c 100644 --- a/argo/apps/templates/helm-apps.yaml +++ b/argo/apps/templates/helm-apps.yaml @@ -11,6 +11,12 @@ spec: server: https://kubernetes.default.svc namespace: {{ .namespace }} sources: + - repoURL: 'https://git.minhas.io/Asara/k8s.git' + targetRevision: master + path: argo/secrets + helm: + valueFiles: + - $values/argo/{{ .app }}/values.yaml - repoURL: {{ .repoURL }} chart: {{ .chart }} targetRevision: {{ .revision }} diff --git a/argo/apps/values.yaml b/argo/apps/values.yaml index 61dd569..cf3b31e 100644 --- a/argo/apps/values.yaml +++ b/argo/apps/values.yaml @@ -25,3 +25,8 @@ helmApps: repoURL: https://okgolove.github.io/helm-charts chart: goldpinger revision: 5.5.0 + - app: miniflux + namespace: miniflux + repoURL: https://charts.gabe565.com + chart: miniflux + revision: 0.6.1 diff --git a/argo/miniflux/values.yaml b/argo/miniflux/values.yaml new file mode 100644 index 0000000..87baf15 --- /dev/null +++ b/argo/miniflux/values.yaml @@ -0,0 +1,53 @@ +--- +# internal +name: miniflux +namespace: miniflux +externalSecrets: + secretStoreRef: miniflux + secrets: + - secretKey: miniflux_admin_pw + key: miniflux + property: miniflux_admin_pw + - secretKey: miniflux_db_url + key: miniflux + property: miniflux_db_url +istio: + commonName: rss.minhas.io + ingressSelector: ingressgateway-internal + issuer: letsencrypt-prod + port: 80 + backendHost: miniflux + sans: + - miniflux.minhas.io + +# app config +env: + - name: BASE_URL + value: https://rss.minhas.io + - name: LISTEN_ADDR + value: 0.0.0.0:80 + - name: RUN_MIGRATIONS + value: 1 + - name: CREATE_ADMIN + value: 1 + - name: ADMIN_USERNAME + value: admin + - name: DATABASE_URL + valueFrom: + secretKeyRef: + name: miniflux + key: miniflux_db_url + - name: ADMIN_PASSWORD + valueFrom: + secretKeyRef: + name: miniflux + key: miniflux_admin_pw + +service: + main: + ports: + http: + port: 80 + +postgresql: + enabled: false diff --git a/argo/secrets/Chart.yaml b/argo/secrets/Chart.yaml new file mode 100644 index 0000000..2fc1aff --- /dev/null +++ b/argo/secrets/Chart.yaml @@ -0,0 +1,5 @@ +--- +apiVersion: v2 +name: external-secrets +version: 1.0.0 +... diff --git a/argo/secrets/templates/external-secrets.yaml b/argo/secrets/templates/external-secrets.yaml new file mode 100644 index 0000000..d24f258 --- /dev/null +++ b/argo/secrets/templates/external-secrets.yaml @@ -0,0 +1,77 @@ +{{ if .Values.externalSecrets }} +--- +apiVersion: v1 +kind: Namespace +metadata: + name: {{ .Values.namespace }} +... +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.name }} + namespace: {{ .Values.namespace }} +... +--- +apiVersion: v1 +kind: Secret +type: kubernetes.io/service-account-token +metadata: + name: serviceaccounttoken + namespace: {{ .Values.namespace }} + annotations: + kubernetes.io/service-account.name: {{ .Values.name | quote }} +... +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ .Values.name }}-tokenreview-binding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: system:auth-delegator +subjects: +- kind: ServiceAccount + name: {{ .Values.name }} + namespace: {{ .Values.namespace }} +... +--- +apiVersion: external-secrets.io/v1beta1 +kind: SecretStore +metadata: + name: {{ .Values.name }} + namespace: {{ .Values.namespace }} +spec: + provider: + vault: + server: "https://vault.service.masked.name:8200" + path: "kv" + version: "v2" + caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUROVENDQWgyZ0F3SUJBZ0lVWXA4eG81dDJsSkZQM1NpRDFmSmlyZ0dVUUowd0RRWUpLb1pJaHZjTkFRRUwKQlFBd0ZqRVVNQklHQTFVRUF4TUxiV0Z6YTJWa0xtNWhiV1V3SGhjTk1qQXdPREk1TVRreU16RXlXaGNOTXpBdwpPREkzTVRreU16UXlXakFXTVJRd0VnWURWUVFERXd0dFlYTnJaV1F1Ym1GdFpUQ0NBU0l3RFFZSktvWklodmNOCkFRRUJCUUFEZ2dFUEFEQ0NBUW9DZ2dFQkFNSTdvUitLSHZ2em5mbmFBWERNTzVxcFNUQ0FZQ3lmakZFb2hZSmYKbE9jbkxPTlhiM2Y2c1A1ZDFlbHRMK1VUcTBSVlU1VVAwYU5XN2hxRFRhNDFNUncwSkNEdEI2OHlLZFlxMmhaZgo5N2dBK2xqM01FSlU2UlRBS0xyZzc1R1JoL0FiTkVJZ3d2UHVIS1c2aE1idHdPeU05REZVLy9XM3hwdXNhbFh5ClJNRnpBSGZTRGo5Y2krVXlnVXQ5SElOV2QvU21NR0cvOFBnaGFSaGZFNDR3UkZNcVllemVsaUl0MkpJczQzQlYKN0hxRzBPZXY5V1BlWG1pYVpVWUtRZXRIaVFxUjE0TXhpdjFJR3pDbXd3Tis5YjR0WnRaVGE1OG9NNWRQWGZiYgpsckVMUUU1T3NQYU50TXRFUjNNZ3hvdkROM1ZTQ0dIL08vR3lhRVdWYW5ZNVVGOENBd0VBQWFON01Ia3dEZ1lEClZSMFBBUUgvQkFRREFnRUdNQThHQTFVZEV3RUIvd1FGTUFNQkFmOHdIUVlEVlIwT0JCWUVGQlk4alczZkRWVXAKVVJ0MXByaG1ETWprVmlrZ01COEdBMVVkSXdRWU1CYUFGQlk4alczZkRWVXBVUnQxcHJobURNamtWaWtnTUJZRwpBM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GpNK1VRY0F4dVpRdEE0TStyaUMxK2prdWRlMXVZTDBzekM2WTkKNEtldGZ2Yk5rZWRTYVY1eUphUktDQmhSY0M0L0dqcEJHL29kUS81QWZCUEFGalpxaGNJSldCclZZYlRRVkM3OQpoTUExaXdXSlBtVDlMc2pNU1VmeEZUUHp4Um5OWFFpS0Z6NWtUMk9pUzFucWg4YU9jeVU5WUM5Mjhwa2lmTkpWCktva3VEZXpKRk03aWUzZCtFY0JrMVY5bEh3T1dkdG89Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K + auth: + kubernetes: + mountPath: "k8s-teapot" + role: {{ .Values.name | quote }} + secretRef: + name: "serviceaccounttoken" +... +--- +apiVersion: external-secrets.io/v1beta1 +kind: ExternalSecret +metadata: + name: {{ .Values.name }} + namespace: {{ .Values.namespace }} +spec: + secretStoreRef: + name: {{ .Values.externalSecrets.secretStoreRef }} + kind: SecretStore + data: +{{- range .Values.externalSecrets.secrets }} + - secretKey: {{ .secretKey }} + remoteRef: + key: {{ .key }} + property: {{ .property }} +{{- end }} +... +{{ end }} diff --git a/argo/secrets/values.yaml b/argo/secrets/values.yaml new file mode 100644 index 0000000..cad8300 --- /dev/null +++ b/argo/secrets/values.yaml @@ -0,0 +1,12 @@ +--- +name: miniflux +namespace: miniflux +externalSecrets: + secretStoreRef: miniflux + secrets: + - secretKey: miniflux_admin_pw + key: miniflux + property: miniflux_admin_pw + - secretKey: miniflux_db_url + key: miniflux + property: miniflux_db_url