refactor!: project updates (#1326)

* refactor!: flux is required again

Signed-off-by: Devin Buhl <devin@buhl.casa>

* fix: delimiter that chomps

Signed-off-by: Devin Buhl <devin@buhl.casa>

* fix: bootstrap_cloudflare logic

Signed-off-by: Devin Buhl <devin@buhl.casa>

* fix: update tests

Signed-off-by: Devin Buhl <devin@buhl.casa>

* fix: remove last quote

Signed-off-by: Devin Buhl <devin@buhl.casa>

* chore: update readme

Signed-off-by: Devin Buhl <devin@buhl.casa>

---------

Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
Devin Buhl authored and GitHub committed 2024-02-15 20:03:24 -05:00
1 parent 04ff4ef994
commit c17d543b21
93 files changed
+591 -755

No files matched your search

@@ -1 +0,0 @@
main = lambda data: data.get("flux", {}).get("enabled", False) == True
@@ -1 +1 @@
main = lambda data: data.get("cloudflare", {}).get("enabled", False) == True
main = lambda data: data.get("bootstrap_cloudflare", {}).get("enabled", False) == True
@@ -4,4 +4,4 @@ kind: Secret
metadata:
name: cert-manager-secret
stringData:
api-token: "{{ cloudflare.token }}"
api-token: "#{ bootstrap_cloudflare.token }#"
@@ -18,7 +18,7 @@ spec:
interval: 30m
retryInterval: 1m
timeout: 5m
{% if cloudflare.enabled %}
#% if bootstrap_cloudflare.enabled %#
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
@@ -41,4 +41,4 @@ spec:
interval: 30m
retryInterval: 1m
timeout: 5m
{% endif %}
#% endif %#
@@ -3,6 +3,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./namespace.yaml
{% if flux.github.webhook.enabled %}
- ./webhooks/ks.yaml
{% endif %}
@@ -1,6 +0,0 @@
main = lambda data: (
data.get("flux", {})
.get("github", {})
.get("webhook", {})
.get("enabled", False) == True
)
@@ -1,4 +1,4 @@
{% if cloudflare.enabled %}
#% if bootstrap_cloudflare.enabled %#
---
apiVersion: networking.k8s.io/v1
kind: Ingress
@@ -22,4 +22,4 @@ spec:
tls:
- hosts:
- *host
{% endif %}
#% endif %#
@@ -3,7 +3,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./secret.sops.yaml
{% if cloudflare.enabled %}
#% if bootstrap_cloudflare.enabled %#
- ./ingress.yaml
{% endif %}
#% endif %#
- ./receiver.yaml
@@ -4,4 +4,4 @@ kind: Secret
metadata:
name: github-webhook-token-secret
stringData:
token: "{{ flux.github.webhook.token }}"
token: "#{ bootstrap_github_webhook_token }#"
@@ -9,21 +9,21 @@ spec:
matchLabels:
kubernetes.io/os: linux
virtualRouters:
- localASN: {{ distribution.talos.bgp.local_asn }}
- localASN: #{ bootstrap_bgp.local_asn }#
neighbors:
{% if distribution.talos.bgp.peers %}
{% for item in distribution.talos.bgp.peers %}
- peerAddress: "{{ item }}/32"
peerASN: {{ distribution.talos.bgp.peer_asn }}
{% endfor %}
{% else %}
{% if nodes.default_gateway %}
- peerAddress: "{{ nodes.default_gateway }}/32"
{% else %}
- peerAddress: "{{ nodes.host_network | nthhost(1) }}/32"
{% endif %}
peerASN: {{ distribution.talos.bgp.peer_asn }}
{% endif %}
#% if bootstrap_bgp.peers %#
#% for item in bootstrap_bgp.peers %#
- peerAddress: "#{ item }#/32"
peerASN: #{ bootstrap_bgp.peer_asn }#
#% endfor %#
#% else %#
#% if bootstrap_node_default_gateway %#
- peerAddress: "#{ bootstrap_node_default_gateway }#/32"
#% else %#
- peerAddress: "#{ bootstrap_node_network | nthhost(1) }#/32"
#% endif %#
peerASN: #{ bootstrap_bgp.peer_asn }#
#% endif %#
serviceSelector:
matchExpressions:
- {key: somekey, operator: NotIn, values: ['never-used-value']}
@@ -34,4 +34,4 @@ metadata:
name: pool
spec:
cidrs:
- cidr: "${LOADBALANCER_CIDR}"
- cidr: "${BGP_ADVERTISED_CIDR}"
@@ -23,6 +23,6 @@ spec:
uninstall:
keepHistory: false
values:
{% filter indent(width=4, first=True) %}
{% include 'partials/cilium-values-full.partial.yaml.j2' %}
{% endfilter %}
#% filter indent(width=4, first=True) %#
#% include 'partials/cilium-values-full.partial.yaml.j2' %#
#% endfilter %#
@@ -2,11 +2,10 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
{% if distribution.talos.bgp.enabled %}
#% if bootstrap_bgp.enabled %#
- ./cilium-bgp.yaml
{% endif %}
{% if ( (not distribution.talos.bgp.enabled) and
(not feature_gates.dual_stack_ipv4_first) ) %}
#% endif %#
#% if ((not bootstrap_bgp.enabled) and (not bootstrap_feature_gates.dual_stack_ipv4_first)) %#
- ./cilium-l2.yaml
{% endif %}
#% endif %#
- ./helmrelease.yaml
@@ -1 +1 @@
main = lambda data: data.get("distribution", {}).get("type", "k3s") in ["talos"]
main = lambda data: data.get("bootstrap_distribution", "k3s") in ["talos"]
@@ -23,9 +23,9 @@ spec:
uninstall:
keepHistory: false
values:
{% filter indent(width=4, first=True) %}
{% include 'partials/kubelet-csr-approver-values.partial.yaml.j2' %}
{% endfilter %}
#% filter indent(width=4, first=True) %#
#% include 'partials/kubelet-csr-approver-values.partial.yaml.j2' %#
#% endfilter %#
metrics:
enable: true
serviceMonitor:
@@ -4,11 +4,11 @@ kind: Kustomization
resources:
- ./namespace.yaml
- ./cilium/ks.yaml
{% if distribution.type in ["talos"] %}
#% if bootstrap_distribution in ["talos"] %#
- ./kubelet-csr-approver/ks.yaml
{% endif %}
#% endif %#
- ./metrics-server/ks.yaml
{% if distribution.type in ["talos"] %}
#% if bootstrap_distribution in ["talos"] %#
- ./spegel/ks.yaml
{% endif %}
#% endif %#
- ./reloader/ks.yaml
@@ -28,4 +28,4 @@ spec:
readOnlyRootFileSystem: true
podMonitor:
enabled: true
namespace: "{% raw %}{{ .Release.Namespace }}{% endraw %}"
namespace: "{{ .Release.Namespace }}"
@@ -1 +1 @@
main = lambda data: data.get("distribution", {}).get("type", "k3s") in ["talos"]
main = lambda data: data.get("bootstrap_distribution", "k3s") in ["talos"]
@@ -1 +1 @@
main = lambda data: data.get("cloudflare", {}).get("enabled", False) == True
main = lambda data: data.get("bootstrap_cloudflare", {}).get("enabled", False) == True
@@ -4,10 +4,10 @@ kind: Secret
metadata:
name: cloudflared-secret
stringData:
TUNNEL_ID: "{{ cloudflare.tunnel.id }}"
TUNNEL_ID: "#{ bootstrap_cloudflare.tunnel.id }#"
credentials.json: |
{
"AccountTag": "{{ cloudflare.tunnel.account_id }}",
"TunnelSecret": "{{ cloudflare.tunnel.secret }}",
"TunnelID": "{{ cloudflare.tunnel.id }}"
"AccountTag": "#{ bootstrap_cloudflare.tunnel.account_id }#",
"TunnelSecret": "#{ bootstrap_cloudflare.tunnel.secret }#",
"TunnelID": "#{ bootstrap_cloudflare.tunnel.id }#"
}
@@ -82,7 +82,7 @@ spec:
annotations:
external-dns.alpha.kubernetes.io/target: "external.${SECRET_DOMAIN}"
hosts:
- host: &host "{% raw %}{{ .Release.Name }}{% endraw %}-external.${SECRET_DOMAIN}"
- host: &host "{{ .Release.Name }}-external.${SECRET_DOMAIN}"
paths:
- path: /
service:
@@ -95,7 +95,7 @@ spec:
enabled: true
className: internal
hosts:
- host: &host "{% raw %}{{ .Release.Name }}{% endraw %}-internal.${SECRET_DOMAIN}"
- host: &host "{{ .Release.Name }}-internal.${SECRET_DOMAIN}"
paths:
- path: /
service:
@@ -4,4 +4,4 @@ kind: Secret
metadata:
name: external-dns-secret
stringData:
api-token: "{{ cloudflare.token }}"
api-token: "#{ bootstrap_cloudflare.token }#"
@@ -3,6 +3,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./staging.yaml
{% if cloudflare.acme.production %}
#% if bootstrap_cloudflare.acme.production %#
- ./production.yaml
{% endif %}
#% endif %#
@@ -32,7 +32,7 @@ spec:
service:
annotations:
external-dns.alpha.kubernetes.io/hostname: "external.${SECRET_DOMAIN}"
io.cilium/lb-ipam-ips: "{{ cloudflare.tunnel.ingress_vip }}"
io.cilium/lb-ipam-ips: "#{ bootstrap_cloudflare.tunnel.ingress_vip }#"
externalTrafficPolicy: Cluster
ingressClassResource:
name: external
@@ -70,11 +70,11 @@ spec:
namespaceSelector:
any: true
extraArgs:
{% if cloudflare.acme.production %}
#% if bootstrap_cloudflare.acme.production %#
default-ssl-certificate: "network/${SECRET_DOMAIN/./-}-production-tls"
{% else %}
#% else %#
default-ssl-certificate: "network/${SECRET_DOMAIN/./-}-staging-tls"
{% endif %}
#% endif %#
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
@@ -29,7 +29,7 @@ spec:
replicaCount: 1
service:
annotations:
io.cilium/lb-ipam-ips: "{{ cloudflare.ingress_vip }}"
io.cilium/lb-ipam-ips: "#{ bootstrap_cloudflare.ingress_vip }#"
externalTrafficPolicy: Cluster
ingressClassResource:
name: internal
@@ -67,11 +67,11 @@ spec:
namespaceSelector:
any: true
extraArgs:
{% if cloudflare.acme.production %}
#% if bootstrap_cloudflare.acme.production %#
default-ssl-certificate: "network/${SECRET_DOMAIN/./-}-production-tls"
{% else %}
#% else %#
default-ssl-certificate: "network/${SECRET_DOMAIN/./-}-staging-tls"
{% endif %}
#% endif %#
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
@@ -30,5 +30,5 @@ spec:
type: LoadBalancer
port: 53
annotations:
io.cilium/lb-ipam-ips: "{{ cloudflare.gateway_vip }}"
io.cilium/lb-ipam-ips: "#{ bootstrap_cloudflare.gateway_vip }#"
externalTrafficPolicy: Cluster
@@ -1 +1 @@
main = lambda data: data.get("distribution", {}).get("type", "k3s") in ["k3s"]
main = lambda data: data.get("bootstrap_distribution", "k3s") in ["k3s"]
@@ -3,12 +3,12 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./namespace.yaml
{% if distribution.type in ['k3s', 'talos'] %}
#% if bootstrap_distribution in ['k3s', 'talos'] %#
- ./system-upgrade-controller/ks.yaml
{% endif %}
{% if distribution.type in ["k3s"] %}
#% endif %#
#% if bootstrap_distribution in ["k3s"] %#
- ./k3s/ks.yaml
{% endif %}
{% if distribution.type in ["talos"] and distribution.talos.schematicID %}
#% endif %#
#% if bootstrap_distribution in ["talos"] and bootstrap_talos.schematic_id %#
- ./talos/ks.yaml
{% endif %}
#% endif %#
@@ -1 +1 @@
main = lambda data: data.get("distribution", {}).get("type", "k3s") in ['k3s', 'talos']
main = lambda data: data.get("bootstrap_distribution", "k3s") in ["k3s", "talos"]
@@ -11,7 +11,7 @@ subjects:
- kind: ServiceAccount
name: system-upgrade
namespace: system-upgrade
{% if distribution.type in ["talos"] %}
#% if bootstrap_distribution in ["talos"] %#
---
apiVersion: talos.dev/v1alpha1
kind: ServiceAccount
@@ -20,4 +20,4 @@ metadata:
spec:
roles:
- os:admin
{% endif %}
#% endif %#
@@ -1,6 +1,4 @@
main = lambda data: (
data.get("distribution", {}).get("type", "k3s") in ["talos"] and
data.get("distribution", {})
.get("talos", {})
.get("schematicID", {})
data.get("bootstrap_distribution", "k3s") in ["talos"] and
data.get("talos", {}).get("schematic_id", {})
)
@@ -88,6 +88,6 @@ spec:
args:
- --nodes=$(NODE_IP)
- upgrade
- --image=factory.talos.dev/installer/{{ distribution.talos.schematicID }}:$(SYSTEM_UPGRADE_PLAN_LATEST_VERSION)
- --image=factory.talos.dev/installer/#{ bootstrap_talos.schematic_id }#:$(SYSTEM_UPGRADE_PLAN_LATEST_VERSION)
- --preserve=true
- --wait=false