feat: update jinja delimiters back to default (#1269)

* feat: update jinja delimiters back to default

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

* feat: remove cert-manager promrules

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

* fix: update talos csr approver

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-01-29 17:11:37 -05:00
1 parent 5fa8b9685a
commit df642e5425
55 files changed
+295 -358

No files matched your search

@@ -3,4 +3,3 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./helmrelease.yaml
- ./prometheusrule.yaml
@@ -1,59 +0,0 @@
---
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: cert-manager.rules
spec:
groups:
- name: cert-manager
rules:
- alert: CertManagerAbsent
expr: |
absent(up{job="cert-manager"})
for: 15m
labels:
severity: critical
annotations:
description: >
New certificates will not be able to be minted, and existing ones can't be renewed until cert-manager is back.
runbook_url: https://gitlab.com/uneeq-oss/cert-manager-mixin/-/blob/master/RUNBOOK.md#certmanagerabsent
summary: "Cert Manager has dissapeared from Prometheus service discovery."
- name: certificates
rules:
- alert: CertManagerCertExpirySoon
expr: |
avg by (exported_namespace, namespace, name) (certmanager_certificate_expiration_timestamp_seconds - time()) < (21 * 24 * 3600)
for: 15m
labels:
severity: warning
annotations:
description: >
The domain that this cert covers will be unavailable after {{ $value | humanizeDuration }}.
Clients using endpoints that this cert protects will start to fail in {{ $value | humanizeDuration }}.
runbook_url: https://gitlab.com/uneeq-oss/cert-manager-mixin/-/blob/master/RUNBOOK.md#certmanagercertexpirysoon
summary: |
The cert {{ $labels.name }} is {{ $value | humanizeDuration }} from expiry, it should have renewed over a week ago.
- alert: CertManagerCertNotReady
expr: |
max by (name, exported_namespace, namespace, condition) (certmanager_certificate_ready_status{condition!="True"} == 1)
for: 15m
labels:
severity: critical
annotations:
description: >
This certificate has not been ready to serve traffic for at least
10m. If the cert is being renewed or there is another valid cert, the ingress
controller _may_ be able to serve that instead.
runbook_url: https://gitlab.com/uneeq-oss/cert-manager-mixin/-/blob/master/RUNBOOK.md#certmanagercertnotready
summary: "The cert {{ $labels.name }} is not ready to serve traffic."
- alert: CertManagerHittingRateLimits
expr: |
sum by (host) (rate(certmanager_http_acme_client_request_count{status="429"}[5m])) > 0
for: 15m
labels:
severity: critical
annotations:
description: >
Depending on the rate limit, cert-manager may be unable to generate certificates for up to a week.
runbook_url: https://gitlab.com/uneeq-oss/cert-manager-mixin/-/blob/master/RUNBOOK.md#certmanagerhittingratelimits
summary: "Cert manager hitting LetsEncrypt rate limits."
@@ -4,4 +4,4 @@ kind: Secret
metadata:
name: cert-manager-secret
stringData:
api-token: "#{ cloudflare.token }#"
api-token: "{{ cloudflare.token }}"
@@ -18,7 +18,7 @@ spec:
interval: 30m
retryInterval: 1m
timeout: 5m
#% if cloudflare.enabled %#
{% if cloudflare.enabled %}
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
@@ -41,4 +41,4 @@ spec:
interval: 30m
retryInterval: 1m
timeout: 5m
#% endif %#
{% endif %}
@@ -1,4 +1,4 @@
#% if cloudflare.enabled %#
{% if 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 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: "{{ flux.github.webhook.token }}"
@@ -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,7 +2,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
#% if not feature_gates.dual_stack_ipv4_first %#
{% if not feature_gates.dual_stack_ipv4_first %}
- ./cilium-l2.yaml
#% endif %#
{% endif %}
- ./helmrelease.yaml
@@ -23,6 +23,6 @@ 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 %}
@@ -4,11 +4,11 @@ kind: Kustomization
resources:
- ./namespace.yaml
- ./cilium/ks.yaml
#% if distribution in ['talos'] %#
{% if distribution in ['talos'] %}
- ./kubelet-csr-approver/ks.yaml
#% endif %#
{% endif %}
- ./metrics-server/ks.yaml
#% if distribution in ['k0s', 'talos'] %#
{% if distribution in ['k0s', 'talos'] %}
- ./spegel/ks.yaml
#% endif %#
{% endif %}
- ./reloader/ks.yaml
@@ -24,13 +24,13 @@ spec:
keepHistory: false
values:
spegel:
#% if distribution in ['k0s'] %#
{% if distribution in ['k0s'] %}
containerdSock: /run/k0s/containerd.sock
containerdRegistryConfigPath: /var/lib/k0s/containerd/certs.d
#% elif distribution in ['talos'] %#
{% elif distribution in ['talos'] %}
containerdSock: /run/containerd/containerd.sock
containerdRegistryConfigPath: /etc/cri/conf.d/hosts
#% endif %#
{% endif %}
service:
registry:
hostPort: 29999
@@ -4,10 +4,10 @@ kind: Secret
metadata:
name: cloudflared-secret
stringData:
TUNNEL_ID: "#{ cloudflare.tunnel.id }#"
TUNNEL_ID: "{{ cloudflare.tunnel.id }}"
credentials.json: |
{
"AccountTag": "#{ cloudflare.tunnel.account_id }#",
"TunnelSecret": "#{ cloudflare.tunnel.secret }#",
"TunnelID": "#{ cloudflare.tunnel.id }#"
"AccountTag": "{{ cloudflare.tunnel.account_id }}",
"TunnelSecret": "{{ cloudflare.tunnel.secret }}",
"TunnelID": "{{ cloudflare.tunnel.id }}"
}
@@ -70,7 +70,7 @@ spec:
annotations:
external-dns.alpha.kubernetes.io/target: "external.${SECRET_DOMAIN}"
hosts:
- host: &host "{{ .Release.Name }}-external.${SECRET_DOMAIN}"
- host: &host "{% raw %}{{ .Release.Name }}{% endraw %}-external.${SECRET_DOMAIN}"
paths:
- path: /
service:
@@ -83,7 +83,7 @@ spec:
enabled: true
className: internal
hosts:
- host: &host "{{ .Release.Name }}-internal.${SECRET_DOMAIN}"
- host: &host "{% raw %}{{ .Release.Name }}{% endraw %}-internal.${SECRET_DOMAIN}"
paths:
- path: /
service:
@@ -4,4 +4,4 @@ kind: Secret
metadata:
name: external-dns-secret
stringData:
api-token: "#{ cloudflare.token }#"
api-token: "{{ cloudflare.token }}"
@@ -3,6 +3,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./staging.yaml
#% if cloudflare.acme.production %#
{% if 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: "{{ cloudflare.tunnel.ingress_vip }}"
externalTrafficPolicy: Cluster
ingressClassResource:
name: external
@@ -64,11 +64,11 @@ spec:
proxy-buffer-size: 16k
ssl-protocols: TLSv1.3 TLSv1.2
extraArgs:
#% if cloudflare.acme.production %#
{% if 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: "{{ cloudflare.ingress_vip }}"
externalTrafficPolicy: Cluster
ingressClassResource:
name: internal
@@ -61,11 +61,11 @@ spec:
proxy-buffer-size: 16k
ssl-protocols: TLSv1.3 TLSv1.2
extraArgs:
#% if cloudflare.acme.production %#
{% if 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: "{{ cloudflare.gateway_vip }}"
externalTrafficPolicy: Cluster
@@ -6,13 +6,13 @@ metadata:
namespace: flux-system
spec:
interval: 30m
url: "#{ flux.github.address }#"
#% if flux.github.address.startswith('ssh://') %#
url: "{{ flux.github.address }}"
{% if flux.github.address.startswith('ssh://') %}
secretRef:
name: github-deploy-key
#% endif %#
{% endif %}
ref:
branch: "#{ flux.github.branch|default('main', true) }#"
branch: "{{ flux.github.branch|default('main', true) }}"
ignore: |
# exclude all
/*
@@ -1,4 +1,4 @@
#% if cloudflare.enabled %#
{% if cloudflare.enabled %}
---
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
@@ -8,4 +8,4 @@ metadata:
spec:
interval: 1h
url: https://kubernetes-sigs.github.io/external-dns
#% endif %#
{% endif %}
@@ -1,4 +1,4 @@
#% if cloudflare.enabled %#
{% if cloudflare.enabled %}
---
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
@@ -8,4 +8,4 @@ metadata:
spec:
interval: 1h
url: https://kubernetes.github.io/ingress-nginx
#% endif %#
{% endif %}
@@ -1,4 +1,4 @@
#% if cloudflare.enabled %#
{% if cloudflare.enabled %}
---
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
@@ -8,4 +8,4 @@ metadata:
spec:
interval: 1h
url: https://ori-edge.github.io/k8s_gateway
#% endif %#
{% endif %}
@@ -4,18 +4,18 @@ kind: Kustomization
resources:
- ./bjw-s.yaml
- ./cilium.yaml
#% if cloudflare.enabled %#
{% if cloudflare.enabled %}
- ./external-dns.yaml
- ./ingress-nginx.yaml
- ./k8s-gateway.yaml
#% endif %#
{% endif %}
- ./jetstack.yaml
- ./metrics-server.yaml
- ./openebs.yaml
#% if distribution in ['talos'] %#
{% if distribution in ['talos'] %}
- ./postfinance.yaml
#% endif %#
{% endif %}
- ./stakater.yaml
#% if distribution in ['k0s', 'talos'] %#
{% if distribution in ['k0s', 'talos'] %}
- ./xenitab.yaml
#% endif %#
{% endif %}
@@ -1,4 +1,4 @@
#% if distribution in ['talos'] %#
{% if distribution in ['talos'] %}
---
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
@@ -8,4 +8,4 @@ metadata:
spec:
interval: 1h
url: https://postfinance.github.io/kubelet-csr-approver
#% endif %#
{% endif %}
@@ -1,4 +1,4 @@
#% if distribution in ['k0s', 'talos'] %#
{% if distribution in ['k0s', 'talos'] %}
---
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
@@ -9,4 +9,4 @@ spec:
type: oci
interval: 5m
url: oci://ghcr.io/xenitab/helm-charts
#% endif %#
{% endif %}
@@ -6,8 +6,8 @@ metadata:
namespace: flux-system
stringData:
SECRET_EXAMPLE: Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...
#% if cloudflare.enabled %#
SECRET_DOMAIN: "#{ cloudflare.domain }#"
SECRET_ACME_EMAIL: "#{ cloudflare.acme.email }#"
SECRET_CLOUDFLARE_TUNNEL_ID: "#{ cloudflare.tunnel.id }#"
#% endif %#
{% if cloudflare.enabled %}
SECRET_DOMAIN: "{{ cloudflare.domain }}"
SECRET_ACME_EMAIL: "{{ cloudflare.acme.email }}"
SECRET_CLOUDFLARE_TUNNEL_ID: "{{ cloudflare.tunnel.id }}"
{% endif %}
@@ -5,9 +5,9 @@ metadata:
name: cluster-settings
namespace: flux-system
data:
TIMEZONE: "#{ timezone }#"
CLUSTER_CIDR: "#{ cluster.pod_network.split(',')[0] }#"
NODE_CIDR: "#{ cluster.nodes.host_network }#"
#% if feature_gates.dual_stack_ipv4_first %#
CLUSTER_CIDR_V6: "#{ cluster.pod_network.split(',')[1] }#"
#% endif %#
TIMEZONE: "{{ timezone }}"
CLUSTER_CIDR: "{{ cluster.pod_network.split(',')[0] }}"
NODE_CIDR: "{{ cluster.nodes.host_network }}"
{% if feature_gates.dual_stack_ipv4_first %}
CLUSTER_CIDR_V6: "{{ cluster.pod_network.split(',')[1] }}"
{% endif %}
@@ -5,36 +5,36 @@ metadata:
name: home-kubernetes
spec:
hosts:
#% for item in cluster.nodes.inventory %#
#% if item.controller %#
{% for item in cluster.nodes.inventory %}
{% if item.controller %}
- role: controller+worker
#% else %#
{% else %}
- role: worker
#% endif %#
{% endif %}
ssh:
address: "#{ item.address }#"
user: "#{ item.ssh_username }#"
#% if item.controller %#
address: "{{ item.address }}"
user: "{{ item.ssh_username }}"
{% if item.controller %}
installFlags:
- --disable-components=metrics-server
- --no-taints
#% endif %#
{% endif %}
files:
- name: bootstrap-scripts
src: scripts
hooks:
apply:
before:
- bash ~/apply-system.sh "#{ item.name }#"
#% if item.controller %#
- bash ~/apply-system.sh "{{ item.name }}"
{% if item.controller %}
- bash ~/apply-kube-vip.sh
#% endif %#
{% endif %}
reset:
before:
- bash ~/reset-cilium.sh
after:
- bash ~/reset-system.sh
#% endfor %#
{% endfor %}
k0s:
# renovate: datasource=github-releases depName=k0sproject/k0s
version: v1.29.1+k0s.0
@@ -55,21 +55,21 @@ spec:
listen-metrics-urls: http://0.0.0.0:2381
api:
sans:
#% if cluster.endpoint_vip %#
- "#{ cluster.endpoint_vip }#"
#% endif %#
#% for item in cluster.tls_sans %#
- "#{ item }#"
#% endfor %#
#% for item in controllers %#
#% if item.controller %#
- "#{ item.address }#"
- "#{ item.name }#"
#% endif %#
#% endfor %#
{% if cluster.endpoint_vip %}
- "{{ cluster.endpoint_vip }}"
{% endif %}
{% for item in cluster.tls_sans %}
- "{{ item }}"
{% endfor %}
{% for item in controllers %}
{% if item.controller %}
- "{{ item.address }}"
- "{{ item.name }}"
{% endif %}
{% endfor %}
network:
podCIDR: "#{ cluster.pod_network.split(',')[0] }#"
serviceCIDR: "#{ cluster.service_network.split(',')[0] }#"
podCIDR: "{{ cluster.pod_network.split(',')[0] }}"
serviceCIDR: "{{ cluster.service_network.split(',')[0] }}"
provider: custom
kubeProxy:
disabled: true
@@ -88,6 +88,6 @@ spec:
version: 1.14.6
namespace: kube-system
values: |2
#% filter indent(width=18, first=True) %#
#% include 'partials/cilium-values-init.partial.yaml.j2' %#
#% endfilter %#
{% filter indent(width=18, first=True) %}
{% include 'partials/cilium-values-init.partial.yaml.j2' %}
{% endfilter %}
@@ -9,10 +9,10 @@ mkdir -p /var/lib/k0s/manifests/kube-vip
# Create kube-vip rbac
cat <<EOF > /var/lib/k0s/manifests/kube-vip/rbac.yaml
#% include 'partials/kube-vip-rbac.partial.yaml.j2' %#
{% include 'partials/kube-vip-rbac.partial.yaml.j2' %}
EOF
# Create kube-vip daemonset
cat <<EOF > /var/lib/k0s/manifests/kube-vip/ds.yaml
#% include 'partials/kube-vip-ds.partial.yaml.j2' %#
{% include 'partials/kube-vip-ds.partial.yaml.j2' %}
EOF
@@ -22,7 +22,7 @@ EOF
fi
# Timezone
timedatectl set-timezone "#{ timezone }#"
timedatectl set-timezone "{{ timezone }}"
# Install Packages
apt-get install -y --no-install-recommends \
@@ -35,10 +35,10 @@ apt-get install -y --no-install-recommends \
chattr -i /etc/resolv.conf
rm -f /etc/resolv.conf
cat <<EOF > /etc/resolv.conf
search #{ cluster.nodes.search_domain|default('.', true) }#
#% for item in cluster.nodes.dns_servers %#
nameserver #{ item }#
#% endfor %#
search {{ cluster.nodes.search_domain|default('.', true) }}
{% for item in cluster.nodes.dns_servers %}
nameserver {{ item }}
{% endfor %}
EOF
chattr +i /etc/resolv.conf
@@ -1,4 +1,4 @@
---
#% filter indent(width=0, first=True) %#
#% include 'partials/cilium-values-init.partial.yaml.j2' %#
#% endfilter %#
{% filter indent(width=0, first=True) %}
{% include 'partials/cilium-values-init.partial.yaml.j2' %}
{% endfilter %}
@@ -9,9 +9,9 @@ helmCharts:
releaseName: kubelet-csr-approver
namespace: kube-system
valuesInline:
#% filter indent(width=6, first=True) %#
#% include 'partials/kubelet-csr-approver-values.partial.yaml.j2' %#
#% endfilter %#
{% filter indent(width=6, first=True) %}
{% include 'partials/kubelet-csr-approver-values.partial.yaml.j2' %}
{% endfilter %}
commonAnnotations:
meta.helm.sh/release-name: kubelet-csr-approver
meta.helm.sh/release-namespace: kube-system
@@ -6,50 +6,50 @@ talosVersion: v1.6.3
kubernetesVersion: v1.29.1
clusterName: &cluster home-kubernetes
endpoint: https://#{ cluster.endpoint_vip }#:6443
endpoint: https://{{ cluster.endpoint_vip }}:6443
clusterPodNets:
- "#{ cluster.pod_network.split(',')[0] }#"
- "{{ cluster.pod_network.split(',')[0] }}"
clusterSvcNets:
- "#{ cluster.service_network.split(',')[0] }#"
- "{{ cluster.service_network.split(',')[0] }}"
additionalApiServerCertSans: &sans
- "#{ cluster.endpoint_vip }#"
- "{{ cluster.endpoint_vip }}"
- 127.0.0.1
#% for item in cluster.tls_sans %#
- "#{ item }#"
#% endfor %#
{% for item in cluster.tls_sans %}
- "{{ item }}"
{% endfor %}
additionalMachineCertSans: *sans
cniConfig:
name: none
nodes:
#% for item in cluster.nodes.inventory %#
- hostname: "#{ item.name }#"
ipAddress: "#{ item.address }#"
#% if item.talos_disk_device.startswith('/') %#
installDisk: "#{ item.talos_disk_device }#"
#% else %#
{% for item in cluster.nodes.inventory %}
- hostname: "{{ item.name }}"
ipAddress: "{{ item.address }}"
{% if item.talos_disk_device.startswith('/') %}
installDisk: "{{ item.talos_disk_device }}"
{% else %}
installDiskSelector:
serial: "#{ item.talos_disk_device }#"
#% endif %#
#% if item.controller %#
serial: "{{ item.talos_disk_device }}"
{% endif %}
{% if item.controller %}
controlPlane: true
#% else %#
{% else %}
controlPlane: false
#% endif %#
{% endif %}
networkInterfaces:
- interface: eth0
dhcp: false
addresses:
- "#{ item.address }#/#{ cluster.nodes.host_network.split('/') | last }#"
- "{{ item.address }}/{{ cluster.nodes.host_network.split('/') | last }}"
mtu: 1500
routes:
- network: 0.0.0.0/0
gateway: "#{ cluster.nodes.host_network | nthhost(1) }#"
#% if item.controller %#
gateway: "{{ cluster.nodes.host_network | nthhost(1) }}"
{% if item.controller %}
vip:
ip: "#{ cluster.endpoint_vip }#"
#% endif %#
#% endfor %#
ip: "{{ cluster.endpoint_vip }}"
{% endif %}
{% endfor %}
controlPlane:
patches:
@@ -92,7 +92,7 @@ controlPlane:
rotate-server-certificates: true
nodeIP:
validSubnets:
- "#{ cluster.nodes.host_network }#"
- "{{ cluster.nodes.host_network }}"
# Enable KubePrism
- &kubePrismPatch |-
@@ -107,9 +107,9 @@ controlPlane:
machine:
network:
nameservers:
#% for item in cluster.nodes.dns_servers %#
- #{ item }#
#% endfor %#
{% for item in cluster.nodes.dns_servers %}
- {{ item }}
{% endfor %}
# Configure NTP
- &ntpPatch |-
@@ -147,7 +147,7 @@ controlPlane:
extraArgs:
listen-metrics-urls: http://0.0.0.0:2381
advertisedSubnets:
- "#{ cluster.nodes.host_network }#"
- "{{ cluster.nodes.host_network }}"
# Disable default API server admission plugins.
- |-