Skip to content

Commit

Permalink
feat(external-dns): convert to app-template
Browse files Browse the repository at this point in the history
  • Loading branch information
buroa committed Jan 3, 2024
1 parent af13163 commit b5d94ab
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 52 deletions.
15 changes: 7 additions & 8 deletions kubernetes/apps/networking/external-dns/app/externalsecret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ spec:
target:
name: external-dns-secret
creationPolicy: Owner
data:
- secretKey: zone-id
remoteRef:
template:
engineVersion: v2
data:
CF_ZONE_ID: "{{ .CLOUDFLARE_ZONE_ID }}"
CF_API_TOKEN: "{{ .CLOUDFLARE_API_TOKEN }}"
dataFrom:
- extract:
key: cloudflare
property: CLOUDFLARE_ZONE_ID
- secretKey: api-token
remoteRef:
key: cloudflare
property: CLOUDFLARE_API_TOKEN
105 changes: 74 additions & 31 deletions kubernetes/apps/networking/external-dns/app/helmrelease.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
name: external-dns
name: &app external-dns
spec:
interval: 30m
chart:
spec:
chart: external-dns
version: 1.13.1
chart: app-template
version: 2.4.0
sourceRef:
kind: HelmRepository
name: external-dns-charts
name: bjw-s-charts
namespace: flux-system
install:
remediation:
Expand All @@ -23,31 +23,74 @@ spec:
uninstall:
keepHistory: false
values:
provider: cloudflare
env:
- name: CF_API_TOKEN
valueFrom:
secretKeyRef:
name: external-dns-secret
key: api-token
- name: CF_ZONE_ID
valueFrom:
secretKeyRef:
name: external-dns-secret
key: zone-id
extraArgs:
- --cloudflare-proxied
- --zone-id-filter=$(CF_ZONE_ID)
- --annotation-filter=external-dns.alpha.kubernetes.io/target
policy: sync
sources:
- service
- ingress
txtOwnerId: k8s
txtPrefix: k8s.
domainFilters:
- ${PUBLIC_DOMAIN}
controllers:
main:
strategy: Recreate
annotations:
reloader.stakater.com/auto: "true"
containers:
main:
image:
repository: registry.k8s.io/external-dns/external-dns
tag: v0.14.0@sha256:474077b3dfccb3021db0a6638274967d0f64ce60dd9730a6f464bee2f78b046f
args:
- --cloudflare-proxied
- --zone-id-filter=$(CF_ZONE_ID)
- --annotation-filter=external-dns.alpha.kubernetes.io/target
- --ingress-class=external
- --interval=1m
- --log-format=text
- --log-level=info
- --metrics-address=:7979
- --policy=sync
- --provider=cloudflare
- --registry=txt
- --source=ingress
- --txt-owner-id=k8s
- --txt-prefix=k8s.
envFrom:
- secretRef:
name: external-dns-secret
probes:
liveness: &probes
enabled: true
custom: true
spec:
httpGet:
path: /healthz
port: &port 7979
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
readiness: *probes
startup:
enabled: false
resources:
requests:
cpu: 5m
memory: 128M
limits:
memory: 256M
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
pod:
securityContext:
runAsUser: 568
runAsGroup: 568
runAsNonRoot: true
service:
main:
ports:
http:
port: *port
serviceAccount:
create: true
name: *app
serviceMonitor:
enabled: true
podAnnotations:
reloader.stakater.com/auto: "true"
main:
enabled: true
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ kind: Kustomization
resources:
- ./externalsecret.yaml
- ./helmrelease.yaml
- ./rbac.yaml
58 changes: 58 additions & 0 deletions kubernetes/apps/networking/external-dns/app/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: external-dns
labels:
app.kubernetes.io/instance: external-dns
app.kubernetes.io/name: external-dns
rules:
- apiGroups:
- ""
resources:
- nodes
verbs:
- list
- watch
- apiGroups:
- ""
resources:
- pods
verbs:
- get
- watch
- list
- apiGroups:
- ""
resources:
- services
- endpoints
verbs:
- get
- watch
- list
- apiGroups:
- extensions
- networking.k8s.io
resources:
- ingresses
verbs:
- get
- watch
- list
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: external-dns-viewer
labels:
app.kubernetes.io/instance: external-dns
app.kubernetes.io/name: external-dns
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: external-dns
subjects:
- kind: ServiceAccount
name: external-dns
namespace: networking
6 changes: 3 additions & 3 deletions kubernetes/apps/networking/k8s-gateway/app/helmrelease.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ spec:
enabled: true
port: 53
protocol: UDP
serviceMonitor:
main:
enabled: true
serviceAccount:
create: true
name: *app
serviceMonitor:
main:
enabled: true
9 changes: 0 additions & 9 deletions kubernetes/flux/repositories/helm/external-dns-charts.yaml

This file was deleted.

1 change: 0 additions & 1 deletion kubernetes/flux/repositories/helm/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ resources:
- ./coredns-charts.yaml
- ./deliveryhero-charts.yaml
- ./democratic-csi-charts.yaml
- ./external-dns-charts.yaml
- ./external-secrets-charts.yaml
- ./fairwinds-charts.yaml
- ./grafana-charts.yaml
Expand Down

0 comments on commit b5d94ab

Please sign in to comment.