Skip to content

Commit

Permalink
feat(certs): add ks to import certs from 1password (#7282)
Browse files Browse the repository at this point in the history
  • Loading branch information
onedr0p authored Apr 2, 2024
1 parent c8e6c89 commit fe8d23b
Show file tree
Hide file tree
Showing 18 changed files with 198 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ spec:
name: cloudflare-secret
key: CLOUDFLARE_API_KEY
selector:
dnsZones:
- devbu.io
dnsZones: ["devbu.io"]
---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/cert-manager.io/clusterissuer_v1.json
apiVersion: cert-manager.io/v1
Expand All @@ -40,5 +39,4 @@ spec:
name: cloudflare-secret
key: CLOUDFLARE_API_KEY
selector:
dnsZones:
- devbu.io
dnsZones: ["devbu.io"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/external-secrets.io/clusterexternalsecret_v1beta1.json
apiVersion: external-secrets.io/v1beta1
kind: ClusterExternalSecret
metadata:
name: devbu-io-tls
spec:
externalSecretName: devbu-io-tls
namespaceSelector:
matchExpressions:
- key: kubernetes.io/metadata.name
operator: In
values: ["cert-manager", "network"]
refreshTime: 1m
externalSecretSpec:
secretStoreRef:
kind: ClusterSecretStore
name: onepassword-connect
target:
name: devbu-io-tls
creationPolicy: Orphan
template:
engineVersion: v2
type: kubernetes.io/tls
metadata:
annotations:
cert-manager.io/alt-names: '*.devbu.io,devbu.io'
cert-manager.io/certificate-name: devbu-io
cert-manager.io/common-name: devbu.io
cert-manager.io/ip-sans: ""
cert-manager.io/issuer-group: ""
cert-manager.io/issuer-kind: ClusterIssuer
cert-manager.io/issuer-name: letsencrypt-production
cert-manager.io/uri-sans: ""
labels:
controller.cert-manager.io/fao: "true"
dataFrom:
- extract:
key: devbu-io-tls
decodingStrategy: Auto
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/kustomization
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./clusterexternalsecret.yaml
48 changes: 48 additions & 0 deletions kubernetes/main/apps/cert-manager/certificates/ks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: &app certificates-import
namespace: flux-system
spec:
targetNamespace: cert-manager
commonMetadata:
labels:
app.kubernetes.io/name: *app
dependsOn:
- name: external-secrets-stores
path: ./kubernetes/main/apps/cert-manager/certificates/import
prune: false
sourceRef:
kind: GitRepository
name: home-kubernetes
wait: true
interval: 30m
retryInterval: 1m
timeout: 5m
---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: &app certificates
namespace: flux-system
spec:
targetNamespace: cert-manager
commonMetadata:
labels:
app.kubernetes.io/name: *app
dependsOn:
- name: certificates-import
- name: cert-manager-issuers
- name: external-secrets-stores
path: ./kubernetes/main/apps/cert-manager/certificates/app
prune: false
sourceRef:
kind: GitRepository
name: home-kubernetes
wait: true
interval: 30m
retryInterval: 1m
timeout: 5m
1 change: 1 addition & 0 deletions kubernetes/main/apps/cert-manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ resources:
- ./namespace.yaml
# Flux-Kustomizations
- ./cert-manager/ks.yaml
- ./certificates/ks.yaml
28 changes: 3 additions & 25 deletions kubernetes/main/apps/network/nginx/ks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,6 @@
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: &app nginx-certificates
namespace: flux-system
spec:
targetNamespace: network
commonMetadata:
labels:
app.kubernetes.io/name: *app
dependsOn:
- name: cert-manager-issuers
path: ./kubernetes/main/apps/network/nginx/certificates
prune: false
sourceRef:
kind: GitRepository
name: home-kubernetes
wait: true
interval: 30m
retryInterval: 1m
timeout: 5m
---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: &app nginx-external
namespace: flux-system
Expand All @@ -34,8 +11,8 @@ spec:
labels:
app.kubernetes.io/name: *app
dependsOn:
- name: certificates
- name: external-secrets-stores
- name: nginx-certificates
path: ./kubernetes/main/apps/network/nginx/external
prune: false
sourceRef:
Expand All @@ -58,7 +35,8 @@ spec:
labels:
app.kubernetes.io/name: *app
dependsOn:
- name: nginx-certificates
- name: certificates
- name: external-secrets-stores
path: ./kubernetes/main/apps/network/nginx/internal
prune: false
sourceRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ spec:
name: cloudflare-secret
key: CLOUDFLARE_API_KEY
selector:
dnsZones:
- turbo.ac
dnsZones: ["turbo.ac"]
---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/cert-manager.io/clusterissuer_v1.json
apiVersion: cert-manager.io/v1
Expand All @@ -40,5 +39,4 @@ spec:
name: cloudflare-secret
key: CLOUDFLARE_API_KEY
selector:
dnsZones:
- turbo.ac
dnsZones: ["turbo.ac"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/external-secrets.io/clusterexternalsecret_v1beta1.json
apiVersion: external-secrets.io/v1beta1
kind: ClusterExternalSecret
metadata:
name: turbo-ac-tls
spec:
externalSecretName: turbo-ac-tls
namespaceSelector:
matchExpressions:
- key: kubernetes.io/metadata.name
operator: In
values: ["cert-manager", "network"]
refreshTime: 1m
externalSecretSpec:
secretStoreRef:
kind: ClusterSecretStore
name: onepassword-connect
target:
name: turbo-ac-tls
creationPolicy: Orphan
template:
engineVersion: v2
type: kubernetes.io/tls
metadata:
annotations:
cert-manager.io/alt-names: '*.turbo.ac,turbo.ac'
cert-manager.io/certificate-name: turbo-ac
cert-manager.io/common-name: turbo.ac
cert-manager.io/ip-sans: ""
cert-manager.io/issuer-group: ""
cert-manager.io/issuer-kind: ClusterIssuer
cert-manager.io/issuer-name: letsencrypt-production
cert-manager.io/uri-sans: ""
labels:
controller.cert-manager.io/fao: "true"
dataFrom:
- extract:
key: turbo-ac-tls
decodingStrategy: Auto
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/kustomization
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./clusterexternalsecret.yaml
48 changes: 48 additions & 0 deletions kubernetes/storage/apps/cert-manager/certificates/ks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: &app certificates-import
namespace: flux-system
spec:
targetNamespace: cert-manager
commonMetadata:
labels:
app.kubernetes.io/name: *app
dependsOn:
- name: external-secrets-stores
path: ./kubernetes/storage/apps/cert-manager/certificates/import
prune: false
sourceRef:
kind: GitRepository
name: home-kubernetes
wait: true
interval: 30m
retryInterval: 1m
timeout: 5m
---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: &app certificates
namespace: flux-system
spec:
targetNamespace: cert-manager
commonMetadata:
labels:
app.kubernetes.io/name: *app
dependsOn:
- name: certificates-import
- name: cert-manager-issuers
- name: external-secrets-stores
path: ./kubernetes/storage/apps/cert-manager/certificates/app
prune: false
sourceRef:
kind: GitRepository
name: home-kubernetes
wait: true
interval: 30m
retryInterval: 1m
timeout: 5m
1 change: 1 addition & 0 deletions kubernetes/storage/apps/cert-manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ resources:
- ./namespace.yaml
# Flux-Kustomizations
- ./cert-manager/ks.yaml
- ./certificates/ks.yaml
25 changes: 1 addition & 24 deletions kubernetes/storage/apps/network/nginx/ks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,6 @@
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: &app nginx-certificates
namespace: flux-system
spec:
targetNamespace: network
commonMetadata:
labels:
app.kubernetes.io/name: *app
dependsOn:
- name: cert-manager-issuers
path: ./kubernetes/storage/apps/network/nginx/certificates
prune: false
sourceRef:
kind: GitRepository
name: home-kubernetes
wait: true
interval: 30m
retryInterval: 1m
timeout: 5m
---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: &app nginx-internal
namespace: flux-system
Expand All @@ -34,7 +11,7 @@ spec:
labels:
app.kubernetes.io/name: *app
dependsOn:
- name: nginx-certificates
- name: certificates
path: ./kubernetes/storage/apps/network/nginx/internal
prune: false
sourceRef:
Expand Down

0 comments on commit fe8d23b

Please sign in to comment.