Compare commits
13 Commits
adec591290
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
b6c201775a
|
|||
|
be9dc8438b
|
|||
|
873e73c310
|
|||
|
5c8cda5cc4
|
|||
|
ac0d5244d3
|
|||
|
92345e5f1e
|
|||
|
47b85437e3
|
|||
|
9c3c4005ed
|
|||
|
5eeba518a9
|
|||
|
f5798dae4c
|
|||
|
1da24905ef
|
|||
|
b0a1d04d7d
|
|||
|
7d5b09c623
|
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -1,2 +1,3 @@
|
||||
_secrets.yaml filter=git-crypt diff=git-crypt
|
||||
secrets.yaml filter=git-crypt diff=git-crypt
|
||||
*.agekey filter=git-crypt diff=git-crypt
|
||||
|
||||
28
.pre-commit-config.yaml
Normal file
28
.pre-commit-config.yaml
Normal 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
|
||||
3
.secretsignore
Normal file
3
.secretsignore
Normal file
@@ -0,0 +1,3 @@
|
||||
_secrets.yaml
|
||||
secrets.yaml
|
||||
*.agekey
|
||||
2
committed.toml
Normal file
2
committed.toml
Normal file
@@ -0,0 +1,2 @@
|
||||
style = "conventional"
|
||||
ignore_author_re = "Flux"
|
||||
@@ -29,5 +29,15 @@ patches:
|
||||
- !patch vip
|
||||
- !patch tailscale
|
||||
- !patch cilium
|
||||
- !patch spegel
|
||||
- !patch longhorn
|
||||
- !patch longhorn-user-volume
|
||||
- !patch local-path-provisioner-volume
|
||||
- !patch limit-ephemeral
|
||||
- !patch metrics
|
||||
patchesControlPlane:
|
||||
- !patch allow-control-plane-workloads
|
||||
- !patch sops
|
||||
- !patch cluster-variables
|
||||
- !patch metrics-cluster
|
||||
- !patch gateway-api
|
||||
|
||||
BIN
nodes/testing/_age.agekey
Normal file
BIN
nodes/testing/_age.agekey
Normal file
Binary file not shown.
@@ -4,5 +4,7 @@ installDisk: /dev/vda
|
||||
autoInstall: true
|
||||
cluster:
|
||||
name: testing
|
||||
production: false
|
||||
controlPlaneIp: 192.168.1.100
|
||||
secretsFile: !realpath _secrets.yaml
|
||||
sopsKeyFile: !realpath _age.agekey
|
||||
|
||||
BIN
nodes/titan/_age.agekey
Normal file
BIN
nodes/titan/_age.agekey
Normal file
Binary file not shown.
@@ -3,5 +3,7 @@ gateway: 10.0.0.1
|
||||
installDisk: /dev/sda
|
||||
cluster:
|
||||
name: titan
|
||||
production: true
|
||||
controlPlaneIp: 10.0.2.1
|
||||
secretsFile: !realpath _secrets.yaml
|
||||
sopsKeyFile: !realpath _age.agekey
|
||||
|
||||
16
patches/cluster-variables.yaml
Normal file
16
patches/cluster-variables.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
cluster:
|
||||
inlineManifests:
|
||||
- name: cluster-variables
|
||||
contents: |
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: flux-system
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: cluster-variables
|
||||
namespace: flux-system
|
||||
data:
|
||||
cluster_env: {%- if node.cluster.production %} production {%- else %} staging {%- endif %}
|
||||
3
patches/gateway-api.yaml
Normal file
3
patches/gateway-api.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
cluster:
|
||||
extraManifests:
|
||||
- https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.4.1/standard-install.yaml
|
||||
5
patches/limit-ephemeral.yaml
Normal file
5
patches/limit-ephemeral.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
apiVersion: v1alpha1
|
||||
kind: VolumeConfig
|
||||
name: EPHEMERAL
|
||||
provisioning:
|
||||
maxSize: 30GB
|
||||
8
patches/local-path-provisioner-volume.yaml
Normal file
8
patches/local-path-provisioner-volume.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
apiVersion: v1alpha1
|
||||
kind: UserVolumeConfig
|
||||
name: local-path-provisioner
|
||||
provisioning:
|
||||
diskSelector:
|
||||
match: system_disk
|
||||
grow: true
|
||||
maxSize: 10GB
|
||||
8
patches/longhorn-user-volume.yaml
Normal file
8
patches/longhorn-user-volume.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
apiVersion: v1alpha1
|
||||
kind: UserVolumeConfig
|
||||
name: longhorn
|
||||
provisioning:
|
||||
diskSelector:
|
||||
match: system_disk
|
||||
grow: true
|
||||
maxSize: 2000GB
|
||||
10
patches/longhorn.yaml
Normal file
10
patches/longhorn.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
machine:
|
||||
kubelet:
|
||||
extraMounts:
|
||||
- destination: /var/lib/longhorn
|
||||
type: bind
|
||||
source: /var/lib/longhorn
|
||||
options:
|
||||
- bind
|
||||
- rshared
|
||||
- rw
|
||||
4
patches/metrics-cluster.yaml
Normal file
4
patches/metrics-cluster.yaml
Normal file
@@ -0,0 +1,4 @@
|
||||
cluster:
|
||||
extraManifests:
|
||||
- https://raw.githubusercontent.com/alex1989hu/kubelet-serving-cert-approver/main/deploy/standalone-install.yaml
|
||||
- https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
|
||||
4
patches/metrics.yaml
Normal file
4
patches/metrics.yaml
Normal file
@@ -0,0 +1,4 @@
|
||||
machine:
|
||||
kubelet:
|
||||
extraArgs:
|
||||
rotate-server-certificates: true
|
||||
16
patches/openebs.yaml
Normal file
16
patches/openebs.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
machine:
|
||||
# This is only needed on nodes that will have storage
|
||||
sysctls:
|
||||
vm.nr_hugepages: "1024"
|
||||
nodeLabels:
|
||||
openebs.io/engine: mayastor
|
||||
# This is needed on ALL nodes
|
||||
kubelet:
|
||||
extraMounts:
|
||||
- destination: /var/local
|
||||
type: bind
|
||||
source: /var/local
|
||||
options:
|
||||
- bind
|
||||
- rshared
|
||||
- rw
|
||||
17
patches/sops.yaml
Normal file
17
patches/sops.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
cluster:
|
||||
inlineManifests:
|
||||
- name: sops-key
|
||||
contents: |
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: flux-system
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: sops-gpg
|
||||
namespace: flux-system
|
||||
data:
|
||||
age.agekey: |
|
||||
{{ helper.load_secret(node.cluster.sopsKeyFile) }}
|
||||
7
patches/spegel.yaml
Normal file
7
patches/spegel.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
machine:
|
||||
files:
|
||||
- path: /etc/cri/conf.d/20-customization.part
|
||||
op: create
|
||||
content: |
|
||||
[plugins."io.containerd.cri.v1.images"]
|
||||
discard_unpacked_layers = false
|
||||
@@ -3,7 +3,5 @@ kind: ExtensionServiceConfig
|
||||
name: tailscale
|
||||
environment:
|
||||
- TS_AUTHKEY={{ config.tailscale.authKey }}
|
||||
- TS_EXTRA_ARGS=--login-server {{ config.tailscale.loginServer }} --advertise-tags "tag:cluster-{{ node.cluster.name }}"
|
||||
{% if node.advertiseRoutes %}
|
||||
- TS_ROUTES={{ helper.tailscale_subnet(node.gateway, node.netmask) }}
|
||||
{% endif %}
|
||||
- TS_EXTRA_ARGS=--login-server {{ config.tailscale.loginServer }} --advertise-tags=tag:cluster-{{ node.cluster.name }}
|
||||
- TS_ROUTES={% if node.advertiseRoutes -%} {{ helper.tailscale_subnet(node.gateway, node.netmask) }} {%- endif %}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
# Adapted from: https://enix.io/en/blog/pxe-talos/
|
||||
|
||||
import base64
|
||||
import functools
|
||||
import json
|
||||
import pathlib
|
||||
@@ -71,6 +72,9 @@ def tailscale_subnet(gateway: str, netmask: str):
|
||||
netmask_bits = IPAddress(netmask).netmask_bits()
|
||||
return f"{IPAddress(gateway) & IPAddress(netmask)}/{netmask_bits}"
|
||||
|
||||
def load_secret(path: str):
|
||||
with open(path) as f:
|
||||
return base64.b64encode(f.read().encode()).decode()
|
||||
|
||||
@functools.cache
|
||||
def get_schematic_id(schematic: str):
|
||||
@@ -165,7 +169,7 @@ def main():
|
||||
template_args = {
|
||||
"config": config,
|
||||
"root": ROOT,
|
||||
"helper": {"tailscale_subnet": tailscale_subnet},
|
||||
"helper": {"tailscale_subnet": tailscale_subnet, "load_secret": load_secret},
|
||||
}
|
||||
|
||||
nodes = []
|
||||
|
||||
Reference in New Issue
Block a user