Skip to content

Commit

Permalink
feat(external-secrets): use cert-manager to generate/inject CA for we…
Browse files Browse the repository at this point in the history
…bhooks
  • Loading branch information
tosuke committed Nov 21, 2022
1 parent 62806ca commit 136d120
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
23 changes: 22 additions & 1 deletion external-secrets/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace: external-secrets
resources:
- namespace.yaml
- gcpsm-cluster-secret-store.yaml
- webhook-ca.yaml

helmCharts:
- name: external-secrets
Expand All @@ -16,9 +17,29 @@ helmCharts:
includeCRDs: true
valuesInline:
certController:
create: false
webhook:
tolerations:
- operator: Exists
key: "node-role.kubernetes.io/master"
tolerations:
- operator: Exists
key: "node-role.kubernetes.io/master"
key: "node-role.kubernetes.io/master"

patches:
- target:
group: apiextensions.k8s.io
version: v1
kind: CustomResourceDefinition
patch: |-
- op: add
path: /metadata/annotations/cert-manager.io~1inject-ca-from
value: external-secrets/external-secrets-webhook-ca
- target:
group: admissionregistration.k8s.io
version: v1
kind: ValidatingWebhookConfiguration
patch: |-
- op: add
path: /metadata/annotations/cert-manager.io~1inject-ca-from
value: external-secrets/external-secrets-webhook-ca
17 changes: 17 additions & 0 deletions external-secrets/webhook-ca.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: external-secrets-webhook-ca
spec:
issuerRef:
kind: ClusterIssuer
name: selfsigned-issuer
secretName: homelab-external-secrets-webhook # hard-coded for deploy/homelab-external-secrets-webhook
commonName: external-secrets-webhook-ca
subject:
organizations: ["external-secrets"]
dnsNames:
- homelab-external-secrets-webhook.external-secrets.svc
- homelab-external-secrets-webhook.external-secrets.svc.cluster.local
duration: 4560h # 190 days
renewBefore: 2400h # 100 days

0 comments on commit 136d120

Please sign in to comment.