Compare commits

...

9 Commits

37 changed files with 463 additions and 1 deletions

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
deploy.key filter=git-crypt diff=git-crypt

28
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,28 @@
default_install_hook_types: [pre-commit, commit-msg]
exclude: gotk-.*.yaml
repos:
- repo: builtin
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args:
- --allow-multiple-documents
- id: check-added-large-files
- id: check-merge-conflict
- id: check-executables-have-shebangs
- repo: https://github.com/crate-ci/typos
rev: v1.40.0
hooks:
- id: typos
- repo: https://github.com/sirwart/ripsecrets
rev: v0.1.11
hooks:
- id: ripsecrets-system
- repo: https://github.com/crate-ci/committed
rev: v1.1.8
hooks:
- id: committed

1
.secretsignore Normal file
View File

@@ -0,0 +1 @@
deploy.key

6
.typos.toml Normal file
View File

@@ -0,0 +1,6 @@
[default]
extend-ignore-re = [
"(?Rm)^.*(#|//)\\s*spellchecker:disable-line$",
"(?s)(#|//)\\s*spellchecker:off.*?\\n\\s*(#|//)\\s*spellchecker:on",
"(#|//)\\s*spellchecker:ignore-next-line\\n.*",
]

View File

@@ -0,0 +1,18 @@
apiVersion: notification.toolkit.fluxcd.io/v1beta3
kind: Alert
metadata:
name: telegram
namespace: flux-system
spec:
providerRef:
name: telegram
eventSeverity: error
eventSources:
- kind: GitRepository
name: "*"
- kind: Kustomization
name: "*"
- kind: HelmRepository
name: "*"
- kind: HelmRelease
name: "*"

View File

@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- secret-telegram.yaml
- provider.yaml
- alert.yaml

View File

@@ -0,0 +1,12 @@
apiVersion: notification.toolkit.fluxcd.io/v1beta3
kind: Provider
metadata:
name: telegram
namespace: flux-system
spec:
type: telegram
address: https://api.telegram.org
# TODO: Would be nice if this was not hard coded
channel: "-4748034121"
secretRef:
name: telegram

View File

@@ -0,0 +1,52 @@
apiVersion: v1
stringData:
token: ENC[AES256_GCM,data:azBE1dVSbYNZzpagsQrmEoYGIGFn/URQ3VrksQRhUKuJyCrc6o6360u/k38NKg==,iv:iYpqz6Ndh5QESa8yGPU1nKD8/sb3dgloNLa3HFDihnU=,tag:2w0eslkZQOIb+qPYgNmHIQ==,type:str]
kind: Secret
metadata:
name: telegram
namespace: flux-system
sops:
age:
- recipient: age1860txadrlqrjwnqh0g466re2nt8jk7xhj640pq9gpsddpg23uynqsp2hul
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBsN2VGQjBoZUp3TjU4YW1W
cnJ5QW9aY1FtdUFvcENZRnV5cXVjMkhEOFFjCkFMTm4yUjFZOG56YUVXRkE3SndI
eFQ2clF1ZDZicUtCNk9JYW15US9XSDQKLS0tIExHVDdsaVdyVktobWRaUmZPK2V1
NSsyVFRaeFJ6NUhOaDdPZy9yOVhVUXMK32YSPm1nDMvCFLbTTVcy3HdSVueUP2lS
dNr/myyFX3s8dkXHXJDj14XBu5O3Fk0ktHa2bFfvx+wosHPixG4TqQ==
-----END AGE ENCRYPTED FILE-----
- recipient: age1hktythzvsnth6u5en2lvag0tftnj9r03w7rpnzfgzgf5w95qxycq2azufj
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA0cDlERWorN1hXNlMxUnVp
TjZGcis4eVRBWWZVUG5nRzEwMy9Jd21DSFFvCk1ld2tEZWJvV3pHMmVsb2lDRk53
aitnbmJpaFE5NGxGd0N3VSt1N2N2WHcKLS0tIDRKMTN0bk9hcUNTNWpsaEMrY01R
ckU4YlF3Z0JXTGRaVnJnd1ZITHU3RzQKk/kNn84JwoWl/77wEyeljrTkYSTBSpAW
fDn4ddsrmays2kEb8ux0ZbqsNNrt3IhDYd0urks20INvS9BkXJMI0A==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2025-12-09T01:52:28Z"
mac: ENC[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AsjS2eFriOK8wMn3Awyl9V2zcEX
6F6+jzvVYUbxXZupCdJoZo7faaC8TyA10o2LxrcdFwLtjByVgVz3mYmpHVwQ
=BwkI
-----END PGP MESSAGE-----
fp: 1E0CF38FF7C9ADAED58B436ABA4A3D3607E5BA8E!
encrypted_regex: ^(data|stringData)$
version: 3.11.0

View File

@@ -58,6 +58,7 @@ if [ "${vip}" = "null" ]; then
fi
echo -n "Checking connection to ${bootstrap_ip}... "
# spellchecker:ignore-next-line
if nmap -Pn ${bootstrap_ip} -p 50000 | grep -q 'open'; then
echo "[Success]"
else
@@ -67,6 +68,7 @@ fi
count=0
max_retries=20
# spellchecker:ignore-next-line
while ! nmap -Pn ${vip} -p 50000 | grep -q 'open' && [ ${count} -lt ${max_retries} ]; do
if [ $count -eq 0 ]; then
echo -n "Bootstrapping Kubernetes"
@@ -122,5 +124,9 @@ cilium-cli status --wait
# cilium-cli connectivity test --namespace-labels pod-security.kubernetes.io/enforce=privileged
echo "Bootstrapping flux..."
flux bootstrap git --url ssh://git@huizinga.dev/infra/foundation --branch=main --path=clusters/${cluster_name} \
flux bootstrap git \
--url ssh://git@huizinga.dev/infra/foundation \
--branch=main \
--private-key-file=clusters/${cluster_name}/deploy.key -s \
--path=clusters/${cluster_name} \
--components-extra=source-watcher

BIN
clusters/testing/deploy.key Normal file

Binary file not shown.

View File

@@ -0,0 +1 @@
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBK59NC6hLyDf+9zeOQ0stZeay51UyUpoBgONh0xxJFIlgra5ojyhrrQVlfjcUqdLe5yijWU1nCxKpaFGDPMdNE4= flux@testing

View File

@@ -2,9 +2,16 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- flux-system/
- ../../controllers/artifacts.yaml
- ../../controllers/cilium/cilium.yaml
- ../../controllers/cert-manager/cert-manager.yaml
- ../../controllers/spegel/spegel.yaml
- ../../controllers/longhorn/longhorn.yaml
- ../../controllers/local-path-provisioner/local-path-provisioner.yaml
- ../../configs/artifacts.yaml
- ../../configs/letsencrypt/letsencrypt.yaml
- ../../configs/certificates/certificates.yaml
- ../../alerts/telegram

2
committed.toml Normal file
View File

@@ -0,0 +1,2 @@
style = "conventional"
ignore_author_re = "Flux"

View File

@@ -19,3 +19,23 @@ spec:
copy:
- from: "@foundation/controllers/cert-manager/**"
to: "@artifact/"
- name: spegel
originRevision: "@foundation"
copy:
- from: "@foundation/controllers/spegel/**"
to: "@artifact/"
- name: openebs
originRevision: "@foundation"
copy:
- from: "@foundation/controllers/openebs/**"
to: "@artifact/"
- name: longhorn
originRevision: "@foundation"
copy:
- from: "@foundation/controllers/longhorn/**"
to: "@artifact/"
- name: local-path-provisioner
originRevision: "@foundation"
copy:
- from: "@foundation/controllers/local-path-provisioner**"
to: "@artifact/"

View File

@@ -0,0 +1,28 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- github.com/rancher/local-path-provisioner/deploy?ref=v0.0.32
patches:
- patch: |-
kind: ConfigMap
apiVersion: v1
metadata:
name: local-path-config
namespace: local-path-storage
data:
config.json: |-
{
"nodePathMap":[
{
"node":"DEFAULT_PATH_FOR_NON_LISTED_NODES",
"paths":["/var/mnt/local-path-provisioner"]
}
]
}
- patch: |-
apiVersion: v1
kind: Namespace
metadata:
name: local-path-storage
labels:
pod-security.kubernetes.io/enforce: privileged

View File

@@ -0,0 +1,15 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: local-path-provisioner
namespace: flux-system
spec:
interval: 1h
retryInterval: 2m
timeout: 5m
sourceRef:
kind: ExternalArtifact
name: local-path-provisioner
path: ./
prune: true
wait: true

View File

@@ -0,0 +1,30 @@
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: longhorn
namespace: longhorn-system
spec:
interval: 12h
install:
strategy:
name: RetryOnFailure
retryInterval: 2m
upgrade:
strategy:
name: RetryOnFailure
retryInterval: 3m
chart:
spec:
chart: longhorn
# TODO: Is it safe to upgrade automatically to 1.x?
version: "1.10.x"
sourceRef:
kind: HelmRepository
name: longhorn
interval: 24h
valuesFrom:
- kind: ConfigMap
name: values-base
- kind: ConfigMap
name: values-overlay
optional: true

View File

@@ -0,0 +1,8 @@
apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository
metadata:
name: longhorn
namespace: longhorn-system
spec:
interval: 24h
url: https://charts.longhorn.io

View File

@@ -0,0 +1,15 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- namespace.yaml
- helm-repository.yaml
- helm-release.yaml
configurations:
- name-reference.yaml
configMapGenerator:
- name: values-base
namespace: cilium
files:
- values.yaml

View File

@@ -0,0 +1,6 @@
nameReference:
- kind: ConfigMap
version: v1
fieldSpecs:
- path: spec/valuesFrom/name
kind: HelmRelease

View File

@@ -0,0 +1,8 @@
apiVersion: v1
kind: Namespace
metadata:
name: longhorn-system
labels:
pod-security.kubernetes.io/enforce: privileged
pod-security.kubernetes.io/warn: privileged
pod-security.kubernetes.io/audit: privileged

View File

@@ -0,0 +1,10 @@
defaultSettings:
defaultDataPath: /var/mnt/longhorn
replicaAutoBalance: best-effort
defaultDataLocality: best-effort
freezeFilesystemForSnapshot: enabled
storageReservedPercentageForDefaultDisk: 0
storageMinimalAvailablePercentage: 10
storageOverProvisioningPercentage: 25
persistence:
defaultDataLocality: best-effort

View File

@@ -0,0 +1,15 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: longhorn
namespace: flux-system
spec:
interval: 1h
retryInterval: 2m
timeout: 5m
sourceRef:
kind: ExternalArtifact
name: longhorn
path: ./${cluster_env}
prune: true
wait: true

View File

@@ -0,0 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../base
configMapGenerator:
- name: values-overlay
namespace: cilium
files:
- values.yaml

View File

@@ -0,0 +1,4 @@
defaultSettings:
defaultReplicaCount: 2
persistence:
defaultClassReplicaCount: 2

View File

@@ -0,0 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../base
configMapGenerator:
- name: values-overlay
namespace: cilium
files:
- values.yaml

View File

@@ -0,0 +1,4 @@
defaultSettings:
defaultReplicaCount: 1
persistence:
defaultClassReplicaCount: 1

View File

@@ -0,0 +1,49 @@
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: openebs
namespace: openebs
spec:
interval: 12h
install:
strategy:
name: RetryOnFailure
retryInterval: 2m
upgrade:
strategy:
name: RetryOnFailure
retryInterval: 3m
chart:
spec:
chart: openebs
version: "4.x"
sourceRef:
kind: HelmRepository
name: openebs
interval: 24h
values:
loki:
enabled: false
alloy:
enabled: false
mayastor:
etcd:
replicaCount: 1
nats:
cluster:
replicas: 1
eventing:
enabled: false
obs:
callhome:
enabled: false
csi:
node:
initContainers:
enabled: false
engines:
local:
lvm:
enabled: false
zfs:
enabled: false

View File

@@ -0,0 +1,8 @@
apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository
metadata:
name: openebs
namespace: openebs
spec:
interval: 24h
url: https://openebs.github.io/openebs

View File

@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- namespace.yaml
- helm-repository.yaml
- helm-release.yaml

View File

@@ -0,0 +1,8 @@
apiVersion: v1
kind: Namespace
metadata:
name: openebs
labels:
pod-security.kubernetes.io/enforce: privileged
pod-security.kubernetes.io/warn: privileged
pod-security.kubernetes.io/audit: privileged

View File

@@ -0,0 +1,15 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: openebs
namespace: flux-system
spec:
interval: 1h
retryInterval: 2m
timeout: 5m
sourceRef:
kind: ExternalArtifact
name: openebs
path: ./
prune: true
wait: true

View File

@@ -0,0 +1,17 @@
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: spegel
namespace: spegel
spec:
interval: 1m
chart:
spec:
chart: spegel
interval: 5m
sourceRef:
kind: HelmRepository
name: spegel
values:
spegel:
containerdRegistryConfigPath: /etc/cri/conf.d/hosts

View File

@@ -0,0 +1,9 @@
apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository
metadata:
name: spegel
namespace: spegel
spec:
type: "oci"
interval: 5m0s
url: oci://ghcr.io/spegel-org/helm-charts

View File

@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- namespace.yaml
- helm-repository.yaml
- helm-release.yaml

View File

@@ -0,0 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
name: spegel
labels:
pod-security.kubernetes.io/enforce: privileged

View File

@@ -0,0 +1,15 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: spegel
namespace: flux-system
spec:
interval: 1h
retryInterval: 2m
timeout: 5m
sourceRef:
kind: ExternalArtifact
name: spegel
path: ./
prune: true
wait: true