Skip to content

Commit

Permalink
Various fixes and some tidying up (#472)
Browse files Browse the repository at this point in the history
* Fix

* Deploy from branch

* Add certificate

* Tweaks

* Stop it from ignoring things

* Remove patch

* Fix a typo

* Try patches again

* Cert-manager tweaks
  • Loading branch information
Jonnobrow authored Aug 12, 2024
1 parent 3e67fe7 commit 850ecac
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 36 deletions.
28 changes: 3 additions & 25 deletions .taskfiles/flux.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,12 @@
---
version: "3"

env:
GITHUB_USER: jonnobrow

tasks:
sync:
desc: Sync flux-system with the Git Repository
vars:
cluster: '{{.cluster| default "coffee-shop-2"}}'
cmds:
- flux reconcile source git flux-system
- flux reconcile source git -n flux-system {{.cluster}}
- flux get kustomizations --watch
silent: true

generatekey:
desc: Generates a git secret for flux
cmds:
- |
flux create secret git coffee-shop-auth \
--url=ssh://[email protected]/jonnobrow/coffee-shop \
--ssh-key-algorithm=ecdsa \
--ssh-ecdsa-curve=p521
bootstrap:
desc: Bootstrap cluster with flux
cmds:
- |
flux bootstrap github \
--owner=$GITHUB_USER \
--repository=coffee-shop \
--branch=main \
--path=./cluster/base \
--personal
silent: true
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ kind: Secret
metadata:
creationTimestamp: null
name: cloudflare-api-token-secret
namespace: cert-manager
sops:
kms: []
gcp_kms: []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,5 @@ spec:
values:
crds:
enabled: true
extraArgs:
- --dns01-recursive-nameservers=1.1.1.1:53
- --dns01-recursive-nameservers-only
dns01RecursiveNameserversOnly: true
dns01RecursiveNameservers: "1.1.1.1,1.0.0.1"
dns01RecursiveNameservers: "https://1.1.1.1:443/dns-query,https://1.0.0.1:443/dns-query"
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./helmrepository.yaml
- ./helmrelease.yaml
- ./cloudflare-api-token-secret.secret.sops.yaml
- helmrepository.yaml
- helmrelease.yaml
- cloudflare-api-token-secret.secret.sops.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: "${SECRET_DOMAIN/./-}"
namespace: cert-manager
spec:
secretName: "${SECRET_DOMAIN/./-}-tls"
issuerRef:
name: letsencrypt-prod
kind: ClusterIssuer
commonName: "${SECRET_DOMAIN}"
dnsNames:
- "${SECRET_DOMAIN}"
- "*.${SECRET_DOMAIN}"
26 changes: 24 additions & 2 deletions kubernetes/coffee-shop-2/apps/cert-manager/ks.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: app
namespace: cert-manager
namespace: flux-system
spec:
interval: 1h
targetNamespace: cert-manager
Expand All @@ -12,12 +13,13 @@ spec:
kind: GitRepository
namespace: flux-system
name: coffee-shop-2
wait: true
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: issuers
namespace: cert-manager
namespace: flux-system
spec:
interval: 1h
targetNamespace: cert-manager
Expand All @@ -29,3 +31,23 @@ spec:
name: coffee-shop-2
dependsOn:
- name: app
wait: true
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: certificates
namespace: flux-system
spec:
interval: 1h
targetNamespace: cert-manager
path: ./kubernetes/coffee-shop-2/apps/cert-manager/certificates
prune: true
sourceRef:
kind: GitRepository
namespace: flux-system
name: coffee-shop-2
dependsOn:
- name: app
- name: issuers
wait: true
5 changes: 5 additions & 0 deletions kubernetes/coffee-shop-2/apps/cert-manager/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- namespace.yaml
- ks.yaml
1 change: 1 addition & 0 deletions kubernetes/coffee-shop-2/apps/metallb/ks.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
Expand Down
1 change: 1 addition & 0 deletions kubernetes/coffee-shop-2/cluster/apps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ spec:
kind: Kustomization
metadata:
name: not-used
namespace: not-used
spec:
decryption:
provider: sops
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/coffee-shop-2/cluster/config/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
interval: 30m
url: ssh://[email protected]/Jonnobrow/coffee-shop.git
ref:
branch: coffee-shop-2.0/main
branch: coffee-shop-2.0/initial-migration
secretRef:
name: github-deploy-key
ignore: |
Expand Down

0 comments on commit 850ecac

Please sign in to comment.