diff --git a/Chart.yaml b/Chart.yaml deleted file mode 100644 index 14cdfc3..0000000 --- a/Chart.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: v2 -name: home-server -description: A Helm chart for deploying the home-server application -type: application -version: 0.1.0 -appVersion: "1.0.0" - -dependencies: - - name: dns - version: 0.1.0 - repository: "file://charts/dns" diff --git a/charts/dns/templates/bind-slave.yaml b/charts/dns/templates/bind-slave.yaml new file mode 100644 index 0000000..091e96e --- /dev/null +++ b/charts/dns/templates/bind-slave.yaml @@ -0,0 +1,138 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: bind-slave-config +data: + named.conf: | + include "/etc/bind/externaldns-key.conf"; + + options { + directory "/var/cache/bind"; + + recursion yes; + allow-query { any; }; + + listen-on port 53 { any; }; + listen-on-v6 port 53 { any; }; + + forwarders { + 10.40.0.254; + }; + + dnssec-validation auto; + }; + + zone "." IN { + type hint; + file "/usr/share/dns/root.hints"; + }; + + zone "hxme.net." IN { + type master; + file "/etc/bind/db.hxme.net"; + allow-update { key "externaldns-key"; }; + }; + db.hxme.net: | + $TTL 3600 + @ IN SOA ns1.hxme.net. admin.hxme.net. ( + 1 ; Serial + 7200 ; Refresh + 1800 ; Retry + 1209600 ; Expire + 86400 ) ; Negative Cache TTL + ; + @ IN NS ns1.hxme.net. + ns1 IN A 10.40.0.110 + @ IN A 10.40.0.110 + www IN A 10.40.0.110 +--- +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: bind-slave +spec: + selector: + matchLabels: + app: bind-slave + template: + metadata: + labels: + app: bind-slave + spec: + hostNetwork: true + dnsPolicy: ClusterFirstWithHostNet + securityContext: + fsGroup: 999 + initContainers: + - name: fetch-root-hints + image: debian:12 + command: + - sh + - -c + - | + apt update && apt -y install curl + curl -sfSL https://www.internic.net/domain/named.cache -o /usr/share/dns/root.hints + volumeMounts: + - mountPath: /usr/share/dns + name: root-hints + containers: + - name: bind-slave + image: internetsystemsconsortium/bind9:9.18 + command: ["named", "-g", "-c", "/etc/bind/named.conf"] + ports: + - containerPort: 53 + protocol: UDP + - containerPort: 53 + protocol: TCP + volumeMounts: + - name: config + mountPath: /etc/bind/named.conf + subPath: named.conf + - name: config + mountPath: /etc/bind/db.hxme.net + subPath: db.hxme.net + - name: dns-secrets + mountPath: /etc/bind/externaldns-key.conf + subPath: externaldns-key.conf + - name: bind-cache + mountPath: /var/cache/bind + - name: bind-rundir + mountPath: /var/run/named + - name: root-hints + mountPath: /usr/share/dns + volumes: + - name: dns-secrets + secret: + secretName: dns-secrets + - name: config + configMap: + name: bind-slave-config + - name: bind-cache + emptyDir: {} + - name: bind-rundir + emptyDir: {} + - name: root-hints + emptyDir: {} + +--- +apiVersion: v1 +kind: Service +metadata: + name: bind-master + namespace: default +spec: + type: LoadBalancer + externalTrafficPolicy: Local + selector: + app: bind-master + ports: + - name: dns-udp + port: 53 + protocol: UDP + targetPort: 53 + - name: dns-tcp + port: 53 + protocol: TCP + targetPort: 53 + diff --git a/deployments/manifests/00-namespaces.yaml b/deployments/manifests/00-namespaces.yaml index 6b84b30..73496f4 100644 --- a/deployments/manifests/00-namespaces.yaml +++ b/deployments/manifests/00-namespaces.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Namespace metadata: - name: home-server-prod + name: home-server --- apiVersion: v1 kind: Namespace diff --git a/deployments/manifests/20-dev.yaml b/deployments/manifests/20-dev.yaml index 300838c..0e1ebe5 100644 --- a/deployments/manifests/20-dev.yaml +++ b/deployments/manifests/20-dev.yaml @@ -1,15 +1,14 @@ --- -apiVersion: helm.toolkit.fluxcd.io/v2beta1 -kind: HelmRelease +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization metadata: name: home-server-dev - namespace: home-server-dev + namespace: flux-system spec: interval: 1m - chart: - spec: - chart: ./ - sourceRef: - kind: GitRepository - name: home-server-dev - namespace: flux-system + path: ./deployments + prune: true + sourceRef: + kind: GitRepository + name: home-server-dev + targetNamespace: home-server-dev diff --git a/deployments/manifests/20-prod.yaml b/deployments/manifests/20-prod.yaml index 9dd5a3e..1f5d4bd 100644 --- a/deployments/manifests/20-prod.yaml +++ b/deployments/manifests/20-prod.yaml @@ -1,15 +1,14 @@ --- -apiVersion: helm.toolkit.fluxcd.io/v2beta1 -kind: HelmRelease +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization metadata: name: home-server-prod - namespace: home-server-prod + namespace: flux-system spec: interval: 1m - chart: - spec: - chart: ./ - sourceRef: - kind: GitRepository - name: home-server-prod - namespace: flux-system + path: ./deployments + prune: true + sourceRef: + kind: GitRepository + name: home-server-prod + targetNamespace: home-server