Initial commit
Label Sync / Label Sync (push) Failing after 1m7s
E2E / reject-invalid (bad-bgp-asn) (push) Skipped
E2E / reject-invalid (bad-mac-address) (push) Skipped
E2E / reject-invalid (bad-repo-url) (push) Skipped
E2E / reject-invalid (bad-vlan-tag) (push) Skipped
E2E / reject-invalid (duplicate-gateway-addrs) (push) Skipped
E2E / reject-invalid (duplicate-node-names) (push) Skipped
E2E / reject-invalid (gateway-node-collision) (push) Skipped
E2E / reject-invalid (missing-dns-token) (push) Skipped
E2E / reject-invalid (nested-cidr-overlap) (push) Skipped
E2E / reject-invalid (node-addr-outside-cidr) (push) Skipped
E2E / reject-invalid (tunnel-without-dns) (push) Skipped
E2E / accept-valid (selfhosted) (push) Skipped
E2E / reject-invalid (missing-known-hosts) (push) Skipped
E2E / reject-invalid (missing-schematic) (push) Skipped
E2E / reject-invalid (partial-bgp) (push) Skipped
E2E / accept-valid (internal) (push) Skipped
E2E / reject-invalid (missing-external-gateway) (push) Skipped
E2E / reject-invalid (node-uses-gateway-addr) (push) Skipped
E2E / reject-invalid (non-canonical-cidr) (push) Skipped
E2E / accept-valid (private) (push) Skipped
E2E / accept-valid (single-node) (push) Skipped
E2E / reject-invalid (overlapping-cidrs) (push) Skipped
E2E / reject-invalid (reserved-node-name) (push) Skipped
E2E / reject-invalid (tiny-svc-cidr) (push) Skipped
E2E / validator-tests (push) Skipped
E2E / accept-valid (direct) (push) Skipped
E2E / accept-valid (multi-controller) (push) Skipped
E2E / accept-valid (no-webhook) (push) Skipped
E2E / accept-valid (public) (push) Skipped

This commit is contained in:
2026-09-15 22:21:43 +03:00
committed by GitHub
commit e502e0ff76
171 changed files with 7520 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
---
creation_rules:
- path_regex: talos/.*\.sops\.ya?ml
mac_only_encrypted: true
age: "#{ age_key('public') }#"
- path_regex: (bootstrap|kubernetes)/.*\.sops\.ya?ml
encrypted_regex: "^(data|stringData)$"
mac_only_encrypted: true
age: "#{ age_key('public') }#"
stores:
yaml:
indent: 2
@@ -0,0 +1,15 @@
---
apiVersion: v1
kind: Secret
metadata:
name: deploy-key
namespace: flux-system
stringData:
identity: |
#% filter indent(width=4, first=False) %#
#{ deploy_key() }#
#% endfilter %#
known_hosts: |
#% filter indent(width=4, first=False) %#
#{ repository.known_hosts }#
#% endfilter %#
@@ -0,0 +1,60 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/helmfile
# Bootstraps core applications that provide a minimal runtime base for the
# cluster. These releases are installed first so the cluster has the resources
# Flux needs before its own reconciliation begins.
#
# After this bootstrap phase, Flux is ready to take over management of the
# application stack and continue reconciling downstream state.
helmDefaults:
cleanupOnFail: true
forceConflicts: true
wait: true
waitForJobs: true
bases:
- default.yaml
releases:
- name: cilium
namespace: kube-system
inherit:
- template: default
- name: coredns
namespace: kube-system
inherit:
- template: default
needs: ["kube-system/cilium"]
#% if spegel.enabled %#
- name: spegel
namespace: kube-system
inherit:
- template: default
needs: ["kube-system/coredns"]
#% endif %#
- name: cert-manager
namespace: cert-manager
inherit:
- template: default
#% if spegel.enabled %#
needs: ["kube-system/spegel"]
#% else %#
needs: ["kube-system/coredns"]
#% endif %#
- name: flux-operator
namespace: flux-system
inherit:
- template: default
needs: ["cert-manager/cert-manager"]
- name: flux-instance
namespace: flux-system
inherit:
- template: default
needs: ["flux-system/flux-operator"]
@@ -0,0 +1,37 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/helmfile
# Bootstraps cluster-wide Custom Resource Definitions (CRDs) by extracting them
# from upstream Helm charts and applying them directly with kubectl. The releases
# below are never reconciled with helmfile apply or helmfile sync — only their
# CRDs are rendered (via --include-crds) and piped to the cluster.
#
# Installing CRDs out-of-band ensures they exist before Flux begins reconciling
# workloads that reference them, avoiding the need for dependsOn chains on nearly
# every Kustomization that consumes a CRD-backed resource.
helmDefaults:
args:
- --include-crds
- --no-hooks
bases:
- default.yaml
releases:
#% if dns.provider == 'cloudflare' and ingress.mode != 'none' %#
- name: cloudflare-dns
namespace: network
inherit:
- template: default
#% endif %#
- name: envoy-gateway
namespace: network
inherit:
- template: default
- name: prometheus-operator-crds
namespace: observability
chart: oci://ghcr.io/prometheus-community/charts/prometheus-operator-crds
version: 29.0.0
@@ -0,0 +1,8 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/helmfile
templates:
default:
chart: '{{ (fromYaml (tpl (readFile "./templates/release.yaml.gotmpl") .)).chart }}'
version: '{{ (fromYaml (tpl (readFile "./templates/release.yaml.gotmpl") .)).version }}'
values:
- ./templates/values.yaml.gotmpl
@@ -0,0 +1,3 @@
{{- $oci := fromYaml (readFile (printf "../../kubernetes/apps/%s/%s/app/ocirepository.yaml" .Release.Namespace .Release.Name)) -}}
chart: {{ $oci.spec.url }}
version: {{ $oci.spec.ref.tag }}
@@ -0,0 +1 @@
{{ (fromYaml (readFile (printf "../../../kubernetes/apps/%s/%s/app/helmrelease.yaml" .Release.Namespace .Release.Name))).spec.values | toYaml }}
+105
View File
@@ -0,0 +1,105 @@
set no-exit-message
set quiet
set shell := ['bash', '-euo', 'pipefail', '-c']
set script-interpreter := ['bash', '-euo', 'pipefail']
set default-list
set default-script
kubernetes_dir := justfile_dir() + '/kubernetes'
[doc('Bootstrap the Talos cluster')]
[group('bootstrap')]
talos: talos-secret talos-apply talos-talosconfig talos-kubeconfig
[doc('Bootstrap apps into the Talos cluster')]
[group('bootstrap')]
apps: apps-ready apps-namespaces apps-secrets apps-crds apps-helm
just log info "Cluster is bootstrapped — Flux will start syncing the Git repository"
# No sops call or existence guard is needed: the bundle is stored already
# encrypted with the repo's age recipient, and existing bundles are left
# untouched.
[private]
[working-directory('../talos')]
talos-secret:
just log info "Generating secrets" stage "{{ recipe_name() }}"
topf secrets --confirm=false > /dev/null
[private]
[working-directory('../talos')]
talos-apply:
just log info "Applying talos config and bootstrapping" stage "{{ recipe_name() }}"
topf apply --auto-bootstrap --confirm=false
[private]
[working-directory('../talos')]
talos-talosconfig:
just log info "Generating talosconfig" stage "{{ recipe_name() }}"
topf talosconfig > talosconfig
# topf issues short-lived admin certs by default; 8760h keeps the
# kubeconfig usable long-term.
[private]
[working-directory('../talos')]
talos-kubeconfig:
just log info "Fetching kubeconfig" stage "{{ recipe_name() }}"
topf kubeconfig --validity 8760h > "{{ justfile_dir() }}/kubeconfig"
[private]
apps-crds:
just log info "Applying CRDs" stage "{{ recipe_name() }}"
if ! helmfile --file "{{ source_directory() }}/helmfile/crds.yaml" template --quiet | yq eval-all --exit-status 'select(.kind == "CustomResourceDefinition")' | kubectl apply --server-side --force-conflicts --filename -; then
just log fatal "Failed to apply crds"
fi
[private]
apps-helm:
just log info "Syncing helmfile" stage "{{ recipe_name() }}"
if ! helmfile --file "{{ source_directory() }}/helmfile/apps.yaml" sync --hide-notes; then
just log fatal "Failed to sync helmfile"
fi
[private]
apps-namespaces:
just log info "Applying namespaces for apps" stage "{{ recipe_name() }}"
for app in "{{ kubernetes_dir }}/apps"/*/; do
ns="$(basename "$app")"
if kubectl create namespace "$ns" --dry-run=client -o yaml \
| kubectl apply --server-side --filename - &>/dev/null; then
just log info "Namespace applied" namespace "$ns"
else
just log fatal "Failed to apply namespace" namespace "$ns"
fi
done
[private]
apps-secrets:
just log info "Applying secrets for apps" stage "{{ recipe_name() }}"
for secret in \
"{{ source_directory() }}/deploy-key.sops.yaml" \
"{{ source_directory() }}/sops-age.sops.yaml" \
"{{ kubernetes_dir }}/components/sops/cluster-secrets.sops.yaml"
do
name="$(basename "$secret" .sops.yaml)"
if sops decrypt "$secret" \
| kubectl --namespace flux-system apply --server-side --filename - &>/dev/null; then
just log info "Secret applied" resource "$name"
else
just log fatal "Failed to apply secret" resource "$name"
fi
done
# Wait until nodes register as Ready=False. They only become Ready=True once the CNI is healthy.
[private]
apps-ready:
just log info "Waiting for nodes to register as Ready=False" stage "{{ recipe_name() }}"
if ! kubectl wait nodes --for=condition=Ready=True --all --timeout=10s &>/dev/null; then
deadline=$((SECONDS + 600))
until kubectl wait nodes --for=condition=Ready=False --all --timeout=10s &>/dev/null; do
if (( SECONDS >= deadline )); then
just log fatal "Timed out waiting for nodes to register"
fi
just log info "Nodes not available, waiting for nodes to be available. Retrying in 5 seconds..."
sleep 5
done
fi
@@ -0,0 +1,8 @@
---
apiVersion: v1
kind: Secret
metadata:
name: sops-age
namespace: flux-system
stringData:
age.agekey: "#{ age_key('private') }#"
@@ -0,0 +1,52 @@
#% if dns.provider == 'cloudflare' %#
---
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-production
spec:
acme:
privateKeySecretRef:
name: letsencrypt-production
profile: shortlived
server: https://acme-v02.api.letsencrypt.org/directory
solvers:
- dns01:
cloudflare:
apiTokenSecretRef:
name: cert-manager-secret
key: api-token
selector:
dnsZones: ["${SECRET_DOMAIN}"]
#% else %#
---
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: selfsigned
spec:
selfSigned: {}
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: internal-ca
spec:
isCA: true
commonName: internal-ca
secretName: internal-ca
privateKey:
algorithm: ECDSA
size: 256
issuerRef:
name: selfsigned
kind: ClusterIssuer
---
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: internal-ca
spec:
ca:
secretName: internal-ca
#% endif %#
@@ -0,0 +1,20 @@
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: cert-manager
spec:
chartRef:
kind: OCIRepository
name: cert-manager
interval: 1h
values:
crds:
enabled: true
replicaCount: #{ 2 if nodes | length > 1 else 1 }#
dns01RecursiveNameservers: https://1.1.1.1:443/dns-query,https://1.0.0.1:443/dns-query
dns01RecursiveNameserversOnly: true
prometheus:
enabled: true
servicemonitor:
enabled: true
@@ -0,0 +1,10 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./clusterissuer.yaml
- ./helmrelease.yaml
- ./ocirepository.yaml
#% if dns.provider == 'cloudflare' %#
- ./secret.sops.yaml
#% endif %#
@@ -0,0 +1,13 @@
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: OCIRepository
metadata:
name: cert-manager
spec:
interval: 15m
layerSelector:
mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip
operation: copy
ref:
tag: v1.21.2
url: oci://quay.io/jetstack/charts/cert-manager
@@ -0,0 +1,9 @@
#% if dns.provider == 'cloudflare' %#
---
apiVersion: v1
kind: Secret
metadata:
name: cert-manager-secret
stringData:
api-token: "#{ dns.token }#"
#% endif %#
@@ -0,0 +1,30 @@
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: cert-manager
spec:
healthChecks:
- apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
name: cert-manager
namespace: cert-manager
- apiVersion: cert-manager.io/v1
kind: ClusterIssuer
name: #{ cluster_issuer }#
healthCheckExprs:
- apiVersion: cert-manager.io/v1
kind: ClusterIssuer
current: status.conditions.exists(e, e.type == 'Ready' && e.status == 'True')
interval: 1h
path: ./kubernetes/apps/cert-manager/cert-manager/app
postBuild:
substituteFrom:
- name: cluster-secrets
kind: Secret
prune: true
sourceRef:
kind: GitRepository
name: flux-system
namespace: flux-system
targetNamespace: cert-manager
@@ -0,0 +1,11 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: cert-manager
components:
- ../../components/sops
resources:
- ./namespace.yaml
- ./cert-manager/ks.yaml
@@ -0,0 +1,7 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: cert-manager
annotations:
kustomize.toolkit.fluxcd.io/prune: disabled
@@ -0,0 +1,31 @@
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: echo
spec:
chartRef:
kind: OCIRepository
name: echo
interval: 1h
values:
replicaCount: #{ 2 if nodes | length > 1 else 1 }#
config:
kubernetes: true
trustedProxies:
- "#{ kubernetes.pod_cidr }#"
httpRoute:
enabled: true
hostnames:
- "{{ .Release.Name }}.${SECRET_DOMAIN}"
parentRefs:
- name: envoy-#{ 'external' if ingress.mode != 'none' else 'internal' }#
namespace: network
monitoring:
serviceMonitor:
enabled: true
resources:
requests:
cpu: 10m
limits:
memory: 64Mi
@@ -0,0 +1,6 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./helmrelease.yaml
- ./ocirepository.yaml
@@ -0,0 +1,13 @@
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: OCIRepository
metadata:
name: echo
spec:
interval: 15m
layerSelector:
mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip
operation: copy
ref:
tag: 0.2.5
url: oci://ghcr.io/home-operations/charts/echo
@@ -0,0 +1,19 @@
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: echo
spec:
interval: 1h
path: ./kubernetes/apps/default/echo/app
postBuild:
substituteFrom:
- name: cluster-secrets
kind: Secret
prune: true
sourceRef:
kind: GitRepository
name: flux-system
namespace: flux-system
targetNamespace: default
wait: false
@@ -0,0 +1,11 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: default
components:
- ../../components/sops
resources:
- ./namespace.yaml
- ./echo/ks.yaml
@@ -0,0 +1,7 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: default
annotations:
kustomize.toolkit.fluxcd.io/prune: disabled
@@ -0,0 +1,136 @@
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: flux-instance
spec:
chartRef:
kind: OCIRepository
name: flux-instance
interval: 1h
values:
commonAnnotations:
fluxcd.controlplane.io/reconcileArtifactEvery: 1h
instance:
cluster:
networkPolicy: false
components:
- source-controller
- kustomize-controller
- helm-controller
- notification-controller
sync:
kind: GitRepository
url: "#{ repository.url }#"
#% if repository.url.startswith('ssh://') %#
pullSecret: deploy-key
#% endif %#
ref: "refs/heads/#{ repository.branch }#"
path: kubernetes/flux/cluster
commonMetadata:
labels:
app.kubernetes.io/name: flux
kustomize:
patches:
- # Increase the number of workers
patch: |
- op: add
path: /spec/template/spec/containers/0/args/-
value: --concurrent=10
- op: add
path: /spec/template/spec/containers/0/args/-
value: --requeue-dependency=5s
target:
kind: Deployment
name: (kustomize-controller|helm-controller|source-controller)
- # Increase the memory limits
patch: |
apiVersion: apps/v1
kind: Deployment
metadata:
name: all
spec:
template:
spec:
containers:
- name: manager
resources:
limits:
memory: 1Gi
target:
kind: Deployment
name: (kustomize-controller|helm-controller|source-controller)
- # Enable in-memory kustomize builds
patch: |
- op: add
path: /spec/template/spec/containers/0/args/-
value: --concurrent=20
- op: replace
path: /spec/template/spec/volumes/0
value:
name: temp
emptyDir:
medium: Memory
target:
kind: Deployment
name: kustomize-controller
- # Enable Helm repositories caching
patch: |
- op: add
path: /spec/template/spec/containers/0/args/-
value: --helm-cache-max-size=10
- op: add
path: /spec/template/spec/containers/0/args/-
value: --helm-cache-ttl=60m
- op: add
path: /spec/template/spec/containers/0/args/-
value: --helm-cache-purge-interval=5m
target:
kind: Deployment
name: source-controller
- # Flux near OOM detection for Helm
patch: |
- op: add
path: /spec/template/spec/containers/0/args/-
value: --feature-gates=OOMWatch=true
- op: add
path: /spec/template/spec/containers/0/args/-
value: --oom-watch-memory-threshold=95
- op: add
path: /spec/template/spec/containers/0/args/-
value: --oom-watch-interval=500ms
target:
kind: Deployment
name: helm-controller
- # Disable chart digest tracking
patch: |
- op: add
path: /spec/template/spec/containers/0/args/-
value: --feature-gates=DisableChartDigestTracking=true
target:
kind: Deployment
name: helm-controller
- # Controller-level SOPS decryption
patch: |
- op: add
path: /spec/template/spec/containers/0/args/-
value: --sops-age-secret=sops-age
target:
kind: Deployment
name: kustomize-controller
- # Watch configmaps and secrets attached to HelmReleases and Kustomizations
patch: |-
- op: add
path: /spec/template/spec/containers/0/args/-
value: --watch-configs-label-selector=owner!=helm
target:
kind: Deployment
name: (helm-controller|kustomize-controller)
- # Cancel health checks on new Kustomizations revisions
patch: |-
- op: add
path: /spec/template/spec/containers/0/args/-
value: --feature-gates=CancelHealthCheckOnNewRevision=true
target:
kind: Deployment
name: kustomize-controller
@@ -0,0 +1,22 @@
#% if repository.webhook_provider != 'none' %#
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: flux-webhook
spec:
hostnames: ["flux-webhook.${SECRET_DOMAIN}"]
parentRefs:
- name: envoy-#{ 'external' if ingress.mode != 'none' else 'internal' }#
namespace: network
sectionName: https
rules:
- backendRefs:
- name: webhook-receiver
namespace: flux-system
port: 80
matches:
- path:
type: PathPrefix
value: /hook/
#% endif %#
@@ -0,0 +1,11 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./helmrelease.yaml
- ./ocirepository.yaml
#% if repository.webhook_provider != 'none' %#
- ./secret.sops.yaml
- ./httproute.yaml
- ./receiver.yaml
#% endif %#
@@ -0,0 +1,13 @@
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: OCIRepository
metadata:
name: flux-instance
spec:
interval: 15m
layerSelector:
mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip
operation: copy
ref:
tag: 0.60.0
url: oci://ghcr.io/controlplaneio-fluxcd/charts/flux-instance
@@ -0,0 +1,21 @@
#% if repository.webhook_provider != 'none' %#
---
apiVersion: notification.toolkit.fluxcd.io/v1
kind: Receiver
metadata:
name: flux-webhook
spec:
type: #{ repository.webhook_provider }#
events: ["ping", "push"]
secretRef:
name: flux-webhook-token
resources:
- apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
name: flux-system
namespace: flux-system
- apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
name: flux-system
namespace: flux-system
#% endif %#
@@ -0,0 +1,9 @@
#% if repository.webhook_provider != 'none' %#
---
apiVersion: v1
kind: Secret
metadata:
name: flux-webhook-token
stringData:
token: "#{ webhook_token() }#"
#% endif %#
@@ -0,0 +1,21 @@
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: flux-instance
spec:
dependsOn:
- name: flux-operator
interval: 1h
path: ./kubernetes/apps/flux-system/flux-instance/app
postBuild:
substituteFrom:
- name: cluster-secrets
kind: Secret
prune: true
sourceRef:
kind: GitRepository
name: flux-system
namespace: flux-system
targetNamespace: flux-system
wait: false
@@ -0,0 +1,13 @@
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: flux-operator
spec:
chartRef:
kind: OCIRepository
name: flux-operator
interval: 1h
values:
serviceMonitor:
create: true
@@ -0,0 +1,6 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./helmrelease.yaml
- ./ocirepository.yaml
@@ -0,0 +1,13 @@
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: OCIRepository
metadata:
name: flux-operator
spec:
interval: 15m
layerSelector:
mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip
operation: copy
ref:
tag: 0.60.0
url: oci://ghcr.io/controlplaneio-fluxcd/charts/flux-operator
@@ -0,0 +1,19 @@
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: flux-operator
spec:
interval: 1h
path: ./kubernetes/apps/flux-system/flux-operator/app
postBuild:
substituteFrom:
- name: cluster-secrets
kind: Secret
prune: true
sourceRef:
kind: GitRepository
name: flux-system
namespace: flux-system
targetNamespace: flux-system
wait: true
@@ -0,0 +1,12 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: flux-system
components:
- ../../components/sops
resources:
- ./namespace.yaml
- ./flux-instance/ks.yaml
- ./flux-operator/ks.yaml
@@ -0,0 +1,7 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: flux-system
annotations:
kustomize.toolkit.fluxcd.io/prune: disabled
@@ -0,0 +1,91 @@
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: cilium
spec:
chartRef:
kind: OCIRepository
name: cilium
interval: 1h
values:
autoDirectNodeRoutes: true
bpf:
masquerade: true
# Ref: https://github.com/siderolabs/talos/issues/10002
hostLegacyRouting: true
#% if cilium_bgp_enabled %#
bgpControlPlane:
enabled: true
#% endif %#
cni:
# Required for pairing with Multus CNI
exclusive: false
cgroup:
automount:
enabled: false
hostRoot: /sys/fs/cgroup
# The stable bond name is defined in talos/all/20-network-links.yaml.tpl
devices: bond0+
dashboards:
enabled: true
endpointRoutes:
enabled: true
envoy:
enabled: false
gatewayAPI:
enabled: false
hubble:
enabled: false
ipam:
mode: kubernetes
ipv4NativeRoutingCIDR: "#{ kubernetes.pod_cidr }#"
k8sServiceHost: 127.0.0.1
k8sServicePort: 7445
kubeProxyReplacement: true
kubeProxyReplacementHealthzBindAddr: 0.0.0.0:10256
l2announcements:
enabled: true
loadBalancer:
algorithm: maglev
mode: "#{ cilium.loadbalancer_mode }#"
localRedirectPolicies:
enabled: true
operator:
dashboards:
enabled: true
prometheus:
enabled: true
serviceMonitor:
enabled: true
replicas: #{ 2 if nodes | length > 1 else 1 }#
rollOutPods: true
prometheus:
enabled: true
serviceMonitor:
enabled: true
trustCRDsExist: true
rollOutCiliumPods: true
routingMode: native
securityContext:
capabilities:
ciliumAgent:
- CHOWN
- KILL
- NET_ADMIN
- NET_RAW
- IPC_LOCK
- SYS_ADMIN
- SYS_RESOURCE
- PERFMON
- BPF
- DAC_OVERRIDE
- FOWNER
- SETGID
- SETUID
cleanCiliumState:
- NET_ADMIN
- SYS_ADMIN
- SYS_RESOURCE
socketLB:
enabled: true
@@ -0,0 +1,7 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./helmrelease.yaml
- ./ocirepository.yaml
- ./networks.yaml
@@ -0,0 +1,71 @@
---
apiVersion: cilium.io/v2alpha1
kind: CiliumLoadBalancerIPPool
metadata:
name: pool
spec:
allowFirstLastIPs: "No"
blocks:
- cidr: "#{ network.node_cidr }#"
---
apiVersion: cilium.io/v2alpha1
kind: CiliumL2AnnouncementPolicy
metadata:
name: l2-policy
spec:
loadBalancerIPs: true
# NOTE: interfaces might need to be set if you have more than one active NIC on your hosts
# interfaces:
# - ^eno[0-9]+
# - ^eth[0-9]+
nodeSelector:
matchLabels:
kubernetes.io/os: linux
#% if cilium_bgp_enabled %#
---
apiVersion: cilium.io/v2alpha1
kind: CiliumBGPAdvertisement
metadata:
name: bgp-advertisement-config
labels:
advertise: bgp
spec:
advertisements:
- advertisementType: Service
service:
addresses:
- LoadBalancerIP
selector:
matchExpressions:
- { key: somekey, operator: NotIn, values: ["never-used-value"] }
---
apiVersion: cilium.io/v2alpha1
kind: CiliumBGPPeerConfig
metadata:
name: bgp-peer-config-v4
spec:
families:
- afi: ipv4
safi: unicast
advertisements:
matchLabels:
advertise: bgp
---
apiVersion: cilium.io/v2alpha1
kind: CiliumBGPClusterConfig
metadata:
name: bgp-cluster-config
spec:
nodeSelector:
matchLabels:
kubernetes.io/os: linux
bgpInstances:
- name: instance-#{ cilium.bgp.node_asn }#
localASN: #{ cilium.bgp.node_asn }#
peers:
- name: peer-#{ cilium.bgp.router_asn }#-v4
peerASN: #{ cilium.bgp.router_asn }#
peerAddress: #{ cilium.bgp.router_addr }#
peerConfigRef:
name: bgp-peer-config-v4
#% endif %#
@@ -0,0 +1,13 @@
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: OCIRepository
metadata:
name: cilium
spec:
interval: 15m
layerSelector:
mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip
operation: copy
ref:
tag: 1.20.1
url: oci://quay.io/cilium/charts/cilium
@@ -0,0 +1,19 @@
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: cilium
spec:
interval: 1h
path: ./kubernetes/apps/kube-system/cilium/app
postBuild:
substituteFrom:
- name: cluster-secrets
kind: Secret
prune: true
sourceRef:
kind: GitRepository
name: flux-system
namespace: flux-system
targetNamespace: kube-system
wait: false
@@ -0,0 +1,69 @@
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: coredns
spec:
chartRef:
kind: OCIRepository
name: coredns
interval: 1h
values:
fullnameOverride: coredns
image:
repository: mirror.gcr.io/coredns/coredns
k8sAppLabelOverride: kube-dns
serviceAccount:
create: true
service:
name: kube-dns
clusterIP: "#{ kubernetes.coredns_addr }#"
replicaCount: #{ 2 if controller_count > 1 else 1 }#
priorityClassName: system-cluster-critical
servers:
- zones:
- zone: .
scheme: dns://
use_tcp: true
port: 53
plugins:
- name: errors
- name: health
configBlock: |-
lameduck 5s
- name: ready
- name: kubernetes
parameters: cluster.local in-addr.arpa ip6.arpa
configBlock: |-
pods verified
fallthrough in-addr.arpa ip6.arpa
- name: autopath
parameters: "@kubernetes"
- name: forward
parameters: . /etc/resolv.conf
- name: cache
configBlock: |-
prefetch 20
serve_stale
servfail 0
- name: loop
- name: reload
- name: loadbalance
- name: prometheus
parameters: 0.0.0.0:9153
- name: log
configBlock: |-
class error
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node-role.kubernetes.io/control-plane
operator: Exists
tolerations:
- key: CriticalAddonsOnly
operator: Exists
- key: node-role.kubernetes.io/control-plane
operator: Exists
effect: NoSchedule
@@ -0,0 +1,6 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./helmrelease.yaml
- ./ocirepository.yaml
@@ -0,0 +1,13 @@
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: OCIRepository
metadata:
name: coredns
spec:
interval: 15m
layerSelector:
mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip
operation: copy
url: oci://ghcr.io/coredns/charts/coredns
ref:
tag: 1.47.1
@@ -0,0 +1,19 @@
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: coredns
spec:
interval: 1h
path: ./kubernetes/apps/kube-system/coredns/app
postBuild:
substituteFrom:
- name: cluster-secrets
kind: Secret
prune: true
sourceRef:
kind: GitRepository
name: flux-system
namespace: flux-system
targetNamespace: kube-system
wait: false
@@ -0,0 +1,17 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: kube-system
components:
- ../../components/sops
resources:
- ./namespace.yaml
- ./cilium/ks.yaml
- ./coredns/ks.yaml
- ./metrics-server/ks.yaml
- ./reloader/ks.yaml
#% if spegel.enabled %#
- ./spegel/ks.yaml
#% endif %#
@@ -0,0 +1,21 @@
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: metrics-server
spec:
chartRef:
kind: OCIRepository
name: metrics-server
interval: 1h
values:
args:
- --kubelet-insecure-tls
- --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname
- --kubelet-use-node-status-port
- --metric-resolution=10s
- --kubelet-request-timeout=2s
metrics:
enabled: true
serviceMonitor:
enabled: true
@@ -0,0 +1,6 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./helmrelease.yaml
- ./ocirepository.yaml
@@ -0,0 +1,13 @@
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: OCIRepository
metadata:
name: metrics-server
spec:
interval: 15m
layerSelector:
mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip
operation: copy
ref:
tag: 3.14.0
url: oci://ghcr.io/home-operations/charts-mirror/metrics-server
@@ -0,0 +1,19 @@
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: metrics-server
spec:
interval: 1h
path: ./kubernetes/apps/kube-system/metrics-server/app
postBuild:
substituteFrom:
- name: cluster-secrets
kind: Secret
prune: true
sourceRef:
kind: GitRepository
name: flux-system
namespace: flux-system
targetNamespace: kube-system
wait: false
@@ -0,0 +1,7 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: kube-system
annotations:
kustomize.toolkit.fluxcd.io/prune: disabled
@@ -0,0 +1,17 @@
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: reloader
spec:
chartRef:
kind: OCIRepository
name: reloader
interval: 1h
values:
fullnameOverride: reloader
reloader:
readOnlyRootFileSystem: true
podMonitor:
enabled: true
namespace: "{{ .Release.Namespace }}"
@@ -0,0 +1,6 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./helmrelease.yaml
- ./ocirepository.yaml
@@ -0,0 +1,13 @@
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: OCIRepository
metadata:
name: reloader
spec:
interval: 15m
layerSelector:
mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip
operation: copy
ref:
tag: 2.2.17
url: oci://ghcr.io/stakater/charts/reloader
@@ -0,0 +1,19 @@
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: reloader
spec:
interval: 1h
path: ./kubernetes/apps/kube-system/reloader/app
postBuild:
substituteFrom:
- name: cluster-secrets
kind: Secret
prune: true
sourceRef:
kind: GitRepository
name: flux-system
namespace: flux-system
targetNamespace: kube-system
wait: false
@@ -0,0 +1,21 @@
#% if spegel.enabled %#
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: spegel
spec:
chartRef:
kind: OCIRepository
name: spegel
interval: 1h
values:
spegel:
containerdSock: /run/containerd/containerd.sock
containerdRegistryConfigPath: /etc/cri/conf.d/hosts
service:
registry:
hostPort: 29999
serviceMonitor:
enabled: true
#% endif %#
@@ -0,0 +1,8 @@
#% if spegel.enabled %#
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./helmrelease.yaml
- ./ocirepository.yaml
#% endif %#
@@ -0,0 +1,15 @@
#% if spegel.enabled %#
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: OCIRepository
metadata:
name: spegel
spec:
interval: 15m
layerSelector:
mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip
operation: copy
ref:
tag: 0.7.4
url: oci://ghcr.io/spegel-org/helm-charts/spegel
#% endif %#
@@ -0,0 +1,21 @@
#% if spegel.enabled %#
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: spegel
spec:
interval: 1h
path: ./kubernetes/apps/kube-system/spegel/app
postBuild:
substituteFrom:
- name: cluster-secrets
kind: Secret
prune: true
sourceRef:
kind: GitRepository
name: flux-system
namespace: flux-system
targetNamespace: kube-system
wait: false
#% endif %#
@@ -0,0 +1,37 @@
#% if dns.provider == 'cloudflare' and ingress.mode != 'none' %#
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: &app cloudflare-dns
spec:
chartRef:
kind: OCIRepository
name: cloudflare-dns
interval: 1h
values:
fullnameOverride: *app
provider: cloudflare
env:
- name: CF_API_TOKEN
valueFrom:
secretKeyRef:
name: &secret cloudflare-dns-secret
key: api-token
extraArgs:
- --cloudflare-dns-records-per-page=1000
- --cloudflare-proxied
- --crd-source-apiversion=externaldns.k8s.io/v1alpha1
- --crd-source-kind=DNSEndpoint
- --gateway-name=envoy-external
triggerLoopOnEvent: true
policy: sync
sources: ["crd", "gateway-httproute"]
txtPrefix: k8s.
txtOwnerId: default
domainFilters: ["${SECRET_DOMAIN}"]
serviceMonitor:
enabled: true
podAnnotations:
secret.reloader.stakater.com/reload: *secret
#% endif %#
@@ -0,0 +1,9 @@
#% if dns.provider == 'cloudflare' and ingress.mode != 'none' %#
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./secret.sops.yaml
- ./helmrelease.yaml
- ./ocirepository.yaml
#% endif %#
@@ -0,0 +1,15 @@
#% if dns.provider == 'cloudflare' and ingress.mode != 'none' %#
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: OCIRepository
metadata:
name: cloudflare-dns
spec:
interval: 15m
layerSelector:
mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip
operation: copy
ref:
tag: 1.22.0
url: oci://ghcr.io/home-operations/charts-mirror/external-dns
#% endif %#
@@ -0,0 +1,9 @@
#% if dns.provider == 'cloudflare' and ingress.mode != 'none' %#
---
apiVersion: v1
kind: Secret
metadata:
name: cloudflare-dns-secret
stringData:
api-token: "#{ dns.token }#"
#% endif %#
@@ -0,0 +1,21 @@
#% if dns.provider == 'cloudflare' and ingress.mode != 'none' %#
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: cloudflare-dns
spec:
interval: 1h
path: ./kubernetes/apps/network/cloudflare-dns/app
postBuild:
substituteFrom:
- name: cluster-secrets
kind: Secret
prune: true
sourceRef:
kind: GitRepository
name: flux-system
namespace: flux-system
targetNamespace: network
wait: true
#% endif %#
@@ -0,0 +1,12 @@
#% if ingress.mode == 'cloudflare-tunnel' %#
---
apiVersion: externaldns.k8s.io/v1alpha1
kind: DNSEndpoint
metadata:
name: cloudflare-tunnel
spec:
endpoints:
- dnsName: "external.${SECRET_DOMAIN}"
recordType: CNAME
targets: ["#{ cloudflare_tunnel_id() }#.cfargotunnel.com"]
#% endif %#
@@ -0,0 +1,86 @@
#% if ingress.mode == 'cloudflare-tunnel' %#
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: cloudflare-tunnel
spec:
chartRef:
kind: OCIRepository
name: cloudflare-tunnel
interval: 1h
values:
controllers:
cloudflare-tunnel:
strategy: RollingUpdate
annotations:
reloader.stakater.com/auto: "true"
containers:
app:
image:
repository: docker.io/cloudflare/cloudflared
tag: 2026.9.1
env:
NO_AUTOUPDATE: true
TUNNEL_METRICS: 0.0.0.0:8080
TUNNEL_POST_QUANTUM: true # disable when using http2
TUNNEL_TRANSPORT_PROTOCOL: quic # or http2
envFrom:
- secretRef:
name: cloudflare-tunnel-secret
args: ["tunnel", "run"]
probes:
liveness: &probes
enabled: true
custom: true
spec:
httpGet:
path: /ready
port: &port 8080
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
readiness: *probes
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities: { drop: ["ALL"] }
resources:
requests:
cpu: 10m
limits:
memory: 256Mi
defaultPodOptions:
securityContext:
runAsNonRoot: true
runAsUser: 65534
runAsGroup: 65534
service:
app:
ports:
http:
port: *port
serviceMonitor:
app:
endpoints:
- port: http
configMaps:
config:
data:
config.yaml: |-
ingress:
- hostname: "*.${SECRET_DOMAIN}"
originRequest:
http2Origin: true
originServerName: external.${SECRET_DOMAIN}
service: https://envoy-external.{{ .Release.Namespace }}.svc.cluster.local:443
- service: http_status:404
persistence:
config-file:
type: configMap
identifier: config
globalMounts:
- path: /etc/cloudflared/config.yaml
subPath: config.yaml
#% endif %#
@@ -0,0 +1,10 @@
#% if ingress.mode == 'cloudflare-tunnel' %#
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./dnsendpoint.yaml
- ./secret.sops.yaml
- ./helmrelease.yaml
- ./ocirepository.yaml
#% endif %#
@@ -0,0 +1,15 @@
#% if ingress.mode == 'cloudflare-tunnel' %#
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: OCIRepository
metadata:
name: cloudflare-tunnel
spec:
interval: 15m
layerSelector:
mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip
operation: copy
ref:
tag: 5.1.0
url: oci://ghcr.io/bjw-s-labs/helm/app-template
#% endif %#
@@ -0,0 +1,9 @@
#% if ingress.mode == 'cloudflare-tunnel' %#
---
apiVersion: v1
kind: Secret
metadata:
name: cloudflare-tunnel-secret
stringData:
TUNNEL_TOKEN: "#{ cloudflare_tunnel_secret() }#"
#% endif %#
@@ -0,0 +1,21 @@
#% if ingress.mode == 'cloudflare-tunnel' %#
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: cloudflare-tunnel
spec:
interval: 1h
path: ./kubernetes/apps/network/cloudflare-tunnel/app
postBuild:
substituteFrom:
- name: cluster-secrets
kind: Secret
prune: true
sourceRef:
kind: GitRepository
name: flux-system
namespace: flux-system
targetNamespace: network
wait: false
#% endif %#
@@ -0,0 +1,18 @@
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: "${SECRET_DOMAIN/./-}-production"
spec:
dnsNames:
- "${SECRET_DOMAIN}"
- "*.${SECRET_DOMAIN}"
duration: 160h
issuerRef:
name: #{ cluster_issuer }#
kind: ClusterIssuer
privateKey:
algorithm: ECDSA
secretName: "${SECRET_DOMAIN/./-}-production-tls"
usages:
- digital signature
@@ -0,0 +1,174 @@
---
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyProxy
metadata:
name: envoy
spec:
logging:
level:
default: info
provider:
type: Kubernetes
kubernetes:
envoyDeployment:
replicas: #{ 2 if nodes | length > 1 else 1 }#
container:
imageRepository: mirror.gcr.io/envoyproxy/envoy
resources:
requests:
cpu: 100m
limits:
memory: 1Gi
envoyService:
externalTrafficPolicy: Cluster
shutdown:
drainTimeout: 180s
telemetry:
metrics:
prometheus:
compression:
type: Zstd
---
apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
name: envoy
spec:
controllerName: gateway.envoyproxy.io/gatewayclass-controller
parametersRef:
group: gateway.envoyproxy.io
kind: EnvoyProxy
name: envoy
namespace: network
#% if ingress.mode != 'none' %#
---
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: envoy-external
annotations:
external-dns.kubernetes.io/target: external.${SECRET_DOMAIN}
spec:
gatewayClassName: envoy
infrastructure:
annotations:
external-dns.kubernetes.io/hostname: external.${SECRET_DOMAIN}
lbipam.cilium.io/ips: "#{ gateways.external }#"
listeners:
- name: http
protocol: HTTP
port: 80
allowedRoutes:
namespaces:
from: Same
- name: https
protocol: HTTPS
port: 443
allowedRoutes:
namespaces:
from: All
tls:
certificateRefs:
- kind: Secret
name: ${SECRET_DOMAIN/./-}-production-tls
#% endif %#
---
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: envoy-internal
annotations:
external-dns.kubernetes.io/target: internal.${SECRET_DOMAIN}
spec:
gatewayClassName: envoy
infrastructure:
annotations:
external-dns.kubernetes.io/hostname: internal.${SECRET_DOMAIN}
lbipam.cilium.io/ips: "#{ gateways.internal }#"
listeners:
- name: http
protocol: HTTP
port: 80
allowedRoutes:
namespaces:
from: Same
- name: https
protocol: HTTPS
port: 443
allowedRoutes:
namespaces:
from: All
tls:
certificateRefs:
- kind: Secret
name: ${SECRET_DOMAIN/./-}-production-tls
---
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: BackendTrafficPolicy
metadata:
name: envoy
spec:
compressor:
- type: Zstd
zstd: {}
- type: Brotli
brotli: {}
- type: Gzip
gzip: {}
retry:
numRetries: 2
retryOn:
triggers:
- reset
targetSelectors:
- group: gateway.networking.k8s.io
kind: Gateway
tcpKeepalive: {}
timeout:
http:
requestTimeout: 0s
---
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: ClientTrafficPolicy
metadata:
name: envoy
spec:
clientIPDetection:
xForwardedFor:
trustedCIDRs:
- "#{ kubernetes.pod_cidr }#"
http2:
onInvalidMessage: TerminateStream
http3: {}
targetSelectors:
- group: gateway.networking.k8s.io
kind: Gateway
tcpKeepalive: {}
tls:
minVersion: "1.2"
alpnProtocols:
- h2
- http/1.1
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: https-redirect
annotations:
external-dns.kubernetes.io/controller: none
spec:
parentRefs:
#% if ingress.mode != 'none' %#
- name: envoy-external
namespace: network
sectionName: http
#% endif %#
- name: envoy-internal
namespace: network
sectionName: http
rules:
- filters:
- type: RequestRedirect
requestRedirect:
scheme: https
statusCode: 301
@@ -0,0 +1,20 @@
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: envoy-gateway
spec:
chartRef:
kind: OCIRepository
name: envoy-gateway
interval: 1h
values:
global:
imageRegistry: mirror.gcr.io
config:
envoyGateway:
provider:
type: Kubernetes
kubernetes:
deploy:
type: GatewayNamespace
@@ -0,0 +1,9 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./certificate.yaml
- ./envoy.yaml
- ./helmrelease.yaml
- ./ocirepository.yaml
- ./podmonitor.yaml
@@ -0,0 +1,13 @@
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: OCIRepository
metadata:
name: envoy-gateway
spec:
interval: 15m
layerSelector:
mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip
operation: copy
ref:
tag: 1.9.1
url: oci://mirror.gcr.io/envoyproxy/gateway-helm
@@ -0,0 +1,18 @@
---
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: envoy-proxy
spec:
jobLabel: envoy-proxy
namespaceSelector:
matchNames:
- network
podMetricsEndpoints:
- port: metrics
path: /stats/prometheus
honorLabels: true
selector:
matchLabels:
app.kubernetes.io/component: proxy
app.kubernetes.io/name: envoy
@@ -0,0 +1,19 @@
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: envoy-gateway
spec:
interval: 1h
path: ./kubernetes/apps/network/envoy-gateway/app
postBuild:
substituteFrom:
- name: cluster-secrets
kind: Secret
prune: true
sourceRef:
kind: GitRepository
name: flux-system
namespace: flux-system
targetNamespace: network
wait: false
@@ -0,0 +1,21 @@
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: k8s-gateway
spec:
chartRef:
kind: OCIRepository
name: k8s-gateway
interval: 1h
values:
fullnameOverride: k8s-gateway
domain: "${SECRET_DOMAIN}"
ttl: 1
service:
type: LoadBalancer
port: 53
annotations:
lbipam.cilium.io/ips: "#{ gateways.dns }#"
externalTrafficPolicy: Cluster
watchedResources: ["HTTPRoute", "Service"]
@@ -0,0 +1,6 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./helmrelease.yaml
- ./ocirepository.yaml
@@ -0,0 +1,13 @@
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: OCIRepository
metadata:
name: k8s-gateway
spec:
interval: 1h
layerSelector:
mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip
operation: copy
ref:
tag: 3.7.3
url: oci://codeberg.org/k8s-gateway/charts/k8s-gateway
@@ -0,0 +1,19 @@
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: k8s-gateway
spec:
interval: 1h
path: ./kubernetes/apps/network/k8s-gateway/app
postBuild:
substituteFrom:
- name: cluster-secrets
kind: Secret
prune: true
sourceRef:
kind: GitRepository
name: flux-system
namespace: flux-system
targetNamespace: network
wait: false
@@ -0,0 +1,18 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: network
components:
- ../../components/sops
resources:
- ./namespace.yaml
#% if dns.provider == 'cloudflare' and ingress.mode != 'none' %#
- ./cloudflare-dns/ks.yaml
#% endif %#
#% if ingress.mode == 'cloudflare-tunnel' %#
- ./cloudflare-tunnel/ks.yaml
#% endif %#
- ./envoy-gateway/ks.yaml
- ./k8s-gateway/ks.yaml
@@ -0,0 +1,7 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: network
annotations:
kustomize.toolkit.fluxcd.io/prune: disabled
@@ -0,0 +1,7 @@
---
apiVersion: v1
kind: Secret
metadata:
name: cluster-secrets
stringData:
SECRET_DOMAIN: "#{ domain.name }#"
@@ -0,0 +1,5 @@
---
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component
resources:
- ./cluster-secrets.sops.yaml
@@ -0,0 +1,57 @@
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: cluster-apps
namespace: flux-system
spec:
decryption:
provider: sops
deletionPolicy: WaitForTermination
interval: 1h
path: ./kubernetes/apps
prune: true
sourceRef:
kind: GitRepository
name: flux-system
namespace: flux-system
wait: false
patches:
- # Add Kustomization defaults for all child Kustomizations
patch: |-
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: _
spec:
decryption:
provider: sops
deletionPolicy: WaitForTermination
patches:
- patch: |-
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: _
spec:
install:
crds: CreateReplace
strategy:
name: RetryOnFailure
rollback:
cleanupOnFail: true
recreate: true
upgrade:
cleanupOnFail: true
crds: CreateReplace
strategy:
name: RemediateOnFailure
remediation:
remediateLastFailure: true
retries: 2
target:
group: helm.toolkit.fluxcd.io
kind: HelmRelease
target:
group: kustomize.toolkit.fluxcd.io
kind: Kustomization
+10
View File
@@ -0,0 +1,10 @@
set quiet
set shell := ['bash', '-euo', 'pipefail', '-c']
set script-interpreter := ['bash', '-euo', 'pipefail']
set default-list
set default-script
[doc('Force Flux to pull in changes from your Git repository')]
[group('kube')]
reconcile:
flux --namespace flux-system reconcile kustomization flux-system --with-source
+20
View File
@@ -0,0 +1,20 @@
# Talos Patching
Machine configs are assembled by [topf](https://postfinance.github.io/topf/) from
`topf.yaml` plus the strategic merge patches in this directory.
<https://www.talos.dev/latest/talos-guides/configuration/patching/>
## Patch Directories
Patches merge in this order, alphabetically within each directory, with later
patches taking precedence:
- `all/`: applied to every node
- `control-plane/`: applied to control-plane nodes
- `worker/`: applied to worker nodes
- `node/${hostname}/`: applied to the node with the specified name
Files ending in `.yaml.tpl` are Go-templated per node; see the
[topf configuration model](https://postfinance.github.io/topf/main/configuration-model/)
for the available template variables.
@@ -0,0 +1,9 @@
apiVersion: v1alpha1
kind: UnattendedInstallConfig
provisioning:
diskSelector:
{{- if .Node.Data.installDisk }}
match: disk.dev_path == "{{ .Node.Data.installDisk }}" || "{{ .Node.Data.installDisk }}" in disk.symlinks
{{- else }}
match: disk.serial == "{{ .Node.Data.installDiskSerial }}"
{{- end }}
@@ -0,0 +1,4 @@
apiVersion: v1alpha1
kind: HostnameConfig
auto: "off"
hostname: "{{ .Node.Host }}"
@@ -0,0 +1,10 @@
machine:
certSANs:
#% for item in cert_sans %#
- "#{ item }#"
#% endfor %#
---
apiVersion: v1alpha1
kind: KubeNetworkConfig
podSubnets: ["#{ kubernetes.pod_cidr }#"]
serviceSubnets: ["#{ kubernetes.svc_cidr }#"]
@@ -0,0 +1,41 @@
#| Node networking as Talos 1.13+ typed network documents. The MAC-matched
link is enslaved to a single-link active-backup bond so every consumer
(Cilium devices, VLANs, the VIP, metrics) sees a stable interface name,
bond0, regardless of kernel NIC naming; a second NIC can join the bond
later without renaming anything. The bond name is also referenced by
`devices` in the cilium HelmRelease. #|
#% set link = 'bond0.' ~ network.vlan_tag if network.vlan_tag else 'bond0' %#
---
apiVersion: v1alpha1
kind: LinkAliasConfig
name: ethSel0
selector:
match: glob("{{ .Node.Data.macAddr }}", mac(link.hardware_addr))
---
apiVersion: v1alpha1
kind: BondConfig
name: bond0
links:
- ethSel0
bondMode: active-backup
mtu: {{ .Node.Data.mtu }}
#% if network.vlan_tag %#
---
apiVersion: v1alpha1
kind: VLANConfig
name: #{ link }#
parent: bond0
vlanID: #{ network.vlan_tag }#
mtu: {{ .Node.Data.mtu }}
#% endif %#
addresses:
- address: "{{ .Node.IP }}/#{ network.node_cidr.split('/') | last }#"
routes:
- gateway: "#{ network.default_gateway }#"
{{- if eq .Node.Role "control-plane" }}
---
apiVersion: v1alpha1
kind: Layer2VIPConfig
link: #{ link }#
name: "#{ kubernetes.api.addr }#"
{{- end }}
@@ -0,0 +1,8 @@
apiVersion: v1alpha1
kind: ResolverConfig
nameservers:
#% for item in network.dns_servers %#
- address: #{ item }#
#% endfor %#
searchDomains:
disableDefault: true
@@ -0,0 +1,7 @@
apiVersion: v1alpha1
kind: TimeSyncConfig
ntp:
servers:
#% for item in network.ntp_servers %#
- #{ item }#
#% endfor %#
@@ -0,0 +1,16 @@
apiVersion: v1alpha1
kind: KubeletConfig
config:
crashLoopBackOff:
maxContainerRestartPeriod: 60s
imageMaximumGCAge: 168h
maxParallelImagePulls: 3
serializeImagePulls: false
shutdownGracePeriod: 90s
shutdownGracePeriodCriticalPods: 60s
---
apiVersion: v1alpha1
kind: KubeNodeConfig
nodeIP:
validSubnets:
- #{ network.node_cidr }#
@@ -0,0 +1,12 @@
apiVersion: v1alpha1
kind: SysctlConfig
params:
fs.inotify.max_user_watches: "1048576" # Watchdog
fs.inotify.max_user_instances: "8192" # Watchdog
net.core.rmem_max: "7500000" # Cloudflared | QUIC
net.core.wmem_max: "7500000" # Cloudflared | QUIC
net.ipv4.neigh.default.gc_thresh1: "4096" # Prevent ARP cache overflows
net.ipv4.neigh.default.gc_thresh2: "8192" # Prevent ARP cache overflows
net.ipv4.neigh.default.gc_thresh3: "16384" # Prevent ARP cache overflows
net.ipv4.tcp_slow_start_after_idle: "0" # Preserve congestion window after idle
user.max_user_namespaces: "11255" # User Namespaces
@@ -0,0 +1,8 @@
apiVersion: v1alpha1
kind: CRICustomizationConfig
name: containerd
content: |
[plugins."io.containerd.cri.v1.images"]
discard_unpacked_layers = false
[plugins."io.containerd.cri.v1.runtime"]
device_ownership_from_security_context = true
@@ -0,0 +1,20 @@
{{- if .Node.Data.encryptDisk }}
# Encrypt system disk with TPM
apiVersion: v1alpha1
kind: VolumeConfig
name: STATE
encryption:
provider: luks2
keys:
- slot: 0
tpm: {}
---
apiVersion: v1alpha1
kind: VolumeConfig
name: EPHEMERAL
encryption:
provider: luks2
keys:
- slot: 0
tpm: {}
{{- end }}
@@ -0,0 +1,6 @@
{{- range .Node.Data.kernelModules }}
---
apiVersion: v1alpha1
kind: KernelModuleConfig
name: {{ . }}
{{- end }}
@@ -0,0 +1,7 @@
# Talos 1.14 defaults to running kubelet and pods in a sandboxed PID/mount
# namespace, which breaks workloads that rely on hostPID or host mounts
# (node-exporter, GPU plugins, in-tree iSCSI). Set to true to opt in; on
# encrypted disks expect a second reboot the first time it is enabled.
apiVersion: v1alpha1
kind: SecurityProfileConfig
workloadIsolation: false

Some files were not shown because too many files have changed in this diff Show More