Compare commits
102
Commits
hetzner
...
f49b08f50c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f49b08f50c | ||
|
|
327bb860b7 | ||
|
|
fd5451a5ef | ||
|
|
7333cb2780 | ||
|
|
feecf97cd5 | ||
|
|
b5bcec2663 | ||
|
|
0ad56405ee | ||
|
|
d050e8962a | ||
|
|
d925eeac3f | ||
|
|
2bde45e106 | ||
|
|
50752ca4b0 | ||
|
|
a2ed9555c0 | ||
|
|
14462dd870 | ||
|
|
0625eee297 | ||
|
|
2dc4ab6329 | ||
|
|
bbec0dfff4 | ||
|
|
6de826e030 | ||
|
|
bdba2b7af2 | ||
|
|
499a3462e7 | ||
|
|
daf6ccd0e4 | ||
|
|
a6a630000a | ||
|
|
ff9e58d44f | ||
|
|
8b94e4dd06 | ||
|
|
547a29e000 | ||
|
|
760f0482d4 | ||
|
|
440e268e4f | ||
|
|
24851f5a9b | ||
|
|
ded8efe7fb | ||
|
|
c10646d228 | ||
|
|
50d97209e6 | ||
|
|
46b2ff7d19 | ||
|
|
a4f1d179e9 | ||
|
|
9879de5a86 | ||
|
|
195e9bce25 | ||
|
|
4796606432 | ||
|
|
b1eab6a0fa | ||
|
|
f3c96b65d2 | ||
|
|
c7a375758f | ||
|
|
d0be48b65c | ||
|
|
40647318b4 | ||
|
|
cdb26904d2 | ||
|
|
3c06e046c2 | ||
|
|
17f1815e7f | ||
|
|
66e86e55ea | ||
|
|
43df412243 | ||
|
|
383ef9e9ac | ||
|
|
18abc5073b | ||
|
|
f8da2594ca | ||
|
|
e0359f0097 | ||
|
|
003333a061 | ||
|
|
a6071c504b | ||
|
|
08123457f1 | ||
|
|
757d88ed52 | ||
|
|
15defc686f | ||
|
|
abb7578328 | ||
|
|
bc87a7ca43 | ||
|
|
045880bdd6 | ||
|
|
bfcf57bcc5 | ||
|
|
7e3ebec95b | ||
|
|
0c31c3b1d5 | ||
|
|
5523feb563 | ||
|
|
cafa2fa0b3 | ||
|
|
a7fd4c0b97 | ||
|
|
e56a3a6c38 | ||
|
|
7b2eca07ab | ||
|
|
347ca041ba | ||
|
|
3f52bad854 | ||
|
|
c89c31adea | ||
|
|
68b293efe4 | ||
|
|
1f465cc0c1 | ||
|
|
6e22bd26b3 | ||
|
|
869880c152 | ||
|
|
31e95eb227 | ||
|
|
12675417bd | ||
|
|
8e081ddfda | ||
|
|
4b7517c9c5 | ||
|
|
f9bc53723f | ||
|
|
ee6417c18e | ||
|
|
1156dc0203 | ||
|
|
4151027e01 | ||
|
|
9269e9df1b | ||
|
|
d9374bc209 | ||
|
|
c570a476b5 | ||
|
|
a7f11ccf94 | ||
|
|
a7d540ca65 | ||
|
|
098bd98876 | ||
|
|
55d7b8201e | ||
|
|
9c0523e880 | ||
|
|
8372d562ad | ||
|
|
1bb11dfe3a | ||
|
|
624cd5aab6 | ||
|
|
71bdc6a709 | ||
|
|
714f20417b | ||
|
|
c32bec34bc | ||
|
|
6519a7673d | ||
|
|
d1c31cdb91 | ||
|
|
b3e88712bd | ||
|
|
06366ee5e6 | ||
|
|
9a2d213114 | ||
|
|
9482a0f551 | ||
|
|
5c53b8e06e | ||
|
|
b1dae28aa5 |
@@ -7,17 +7,19 @@ on:
|
|||||||
paths:
|
paths:
|
||||||
- "ansible/dashboards.yml"
|
- "ansible/dashboards.yml"
|
||||||
- "ansible/roles/observability-content/**"
|
- "ansible/roles/observability-content/**"
|
||||||
- ".gitea/workflows/dashboards.yml"
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
TF_VERSION: "1.7.0"
|
TF_VERSION: "1.7.0"
|
||||||
TF_VAR_hcloud_token: ${{ secrets.HCLOUD_TOKEN }}
|
|
||||||
TF_VAR_s3_access_key: ${{ secrets.S3_ACCESS_KEY }}
|
TF_VAR_s3_access_key: ${{ secrets.S3_ACCESS_KEY }}
|
||||||
TF_VAR_s3_secret_key: ${{ secrets.S3_SECRET_KEY }}
|
TF_VAR_s3_secret_key: ${{ secrets.S3_SECRET_KEY }}
|
||||||
TF_VAR_s3_endpoint: ${{ secrets.S3_ENDPOINT }}
|
TF_VAR_s3_endpoint: ${{ secrets.S3_ENDPOINT }}
|
||||||
TF_VAR_s3_bucket: ${{ secrets.S3_BUCKET }}
|
TF_VAR_s3_bucket: ${{ secrets.S3_BUCKET }}
|
||||||
TF_VAR_tailscale_tailnet: ${{ secrets.TAILSCALE_TAILNET }}
|
TF_VAR_tailscale_tailnet: ${{ secrets.TAILSCALE_TAILNET }}
|
||||||
|
TF_VAR_proxmox_endpoint: ${{ secrets.PROXMOX_ENDPOINT }}
|
||||||
|
TF_VAR_proxmox_api_token_id: ${{ secrets.PROXMOX_API_TOKEN_ID }}
|
||||||
|
TF_VAR_proxmox_api_token_secret: ${{ secrets.PROXMOX_API_TOKEN_SECRET }}
|
||||||
|
TF_VAR_proxmox_insecure: "true"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
dashboards:
|
dashboards:
|
||||||
@@ -51,25 +53,6 @@ jobs:
|
|||||||
-backend-config="secret_key=${{ secrets.S3_SECRET_KEY }}" \
|
-backend-config="secret_key=${{ secrets.S3_SECRET_KEY }}" \
|
||||||
-backend-config="skip_requesting_account_id=true"
|
-backend-config="skip_requesting_account_id=true"
|
||||||
|
|
||||||
- name: Detect runner egress IP
|
|
||||||
run: |
|
|
||||||
RUNNER_IP=$(curl -fsSL https://api.ipify.org)
|
|
||||||
echo "RUNNER_CIDR=[\"${RUNNER_IP}/32\"]" >> "$GITHUB_ENV"
|
|
||||||
echo "Runner egress IP: ${RUNNER_IP}"
|
|
||||||
|
|
||||||
- name: Open SSH/API for current runner CIDR
|
|
||||||
working-directory: terraform
|
|
||||||
run: |
|
|
||||||
terraform apply \
|
|
||||||
-refresh=false \
|
|
||||||
-target=hcloud_firewall.cluster \
|
|
||||||
-var="hcloud_token=${{ secrets.HCLOUD_TOKEN }}" \
|
|
||||||
-var="ssh_public_key=$HOME/.ssh/id_ed25519.pub" \
|
|
||||||
-var="ssh_private_key=$HOME/.ssh/id_ed25519" \
|
|
||||||
-var="allowed_ssh_ips=${RUNNER_CIDR}" \
|
|
||||||
-var="allowed_api_ips=${RUNNER_CIDR}" \
|
|
||||||
-auto-approve
|
|
||||||
|
|
||||||
- name: Install Python Dependencies
|
- name: Install Python Dependencies
|
||||||
run: |
|
run: |
|
||||||
apt-get update && apt-get install -y python3-pip
|
apt-get update && apt-get install -y python3-pip
|
||||||
|
|||||||
+839
-162
File diff suppressed because it is too large
Load Diff
+17
-123
@@ -8,109 +8,28 @@ on:
|
|||||||
required: true
|
required: true
|
||||||
default: ''
|
default: ''
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: prod-cluster
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
env:
|
env:
|
||||||
TF_VERSION: "1.7.0"
|
TF_VERSION: "1.7.0"
|
||||||
TF_VAR_hcloud_token: ${{ secrets.HCLOUD_TOKEN }}
|
|
||||||
TF_VAR_s3_access_key: ${{ secrets.S3_ACCESS_KEY }}
|
TF_VAR_s3_access_key: ${{ secrets.S3_ACCESS_KEY }}
|
||||||
TF_VAR_s3_secret_key: ${{ secrets.S3_SECRET_KEY }}
|
TF_VAR_s3_secret_key: ${{ secrets.S3_SECRET_KEY }}
|
||||||
TF_VAR_s3_endpoint: ${{ secrets.S3_ENDPOINT }}
|
TF_VAR_s3_endpoint: ${{ secrets.S3_ENDPOINT }}
|
||||||
TF_VAR_s3_bucket: ${{ secrets.S3_BUCKET }}
|
TF_VAR_s3_bucket: ${{ secrets.S3_BUCKET }}
|
||||||
TF_VAR_tailscale_tailnet: ${{ secrets.TAILSCALE_TAILNET }}
|
TF_VAR_tailscale_tailnet: ${{ secrets.TAILSCALE_TAILNET }}
|
||||||
B2_ACCOUNT_ID: ${{ secrets.B2_ACCOUNT_ID }}
|
TF_VAR_proxmox_endpoint: ${{ secrets.PROXMOX_ENDPOINT }}
|
||||||
B2_APPLICATION_KEY: ${{ secrets.B2_APPLICATION_KEY }}
|
TF_VAR_proxmox_api_token_id: ${{ secrets.PROXMOX_API_TOKEN_ID }}
|
||||||
|
TF_VAR_proxmox_api_token_secret: ${{ secrets.PROXMOX_API_TOKEN_SECRET }}
|
||||||
|
TF_VAR_proxmox_insecure: "true"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
pre-destroy-backup:
|
|
||||||
name: Pre-Destroy Backup
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: github.event.inputs.confirm == 'destroy'
|
|
||||||
environment: destroy
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Terraform
|
|
||||||
uses: hashicorp/setup-terraform@v3
|
|
||||||
with:
|
|
||||||
terraform_version: ${{ env.TF_VERSION }}
|
|
||||||
|
|
||||||
- name: Terraform Init
|
|
||||||
working-directory: terraform
|
|
||||||
run: |
|
|
||||||
terraform init \
|
|
||||||
-backend-config="endpoint=${{ secrets.S3_ENDPOINT }}" \
|
|
||||||
-backend-config="bucket=${{ secrets.S3_BUCKET }}" \
|
|
||||||
-backend-config="region=auto" \
|
|
||||||
-backend-config="access_key=${{ secrets.S3_ACCESS_KEY }}" \
|
|
||||||
-backend-config="secret_key=${{ secrets.S3_SECRET_KEY }}" \
|
|
||||||
-backend-config="skip_requesting_account_id=true"
|
|
||||||
|
|
||||||
- name: Setup SSH Keys
|
|
||||||
run: |
|
|
||||||
mkdir -p ~/.ssh
|
|
||||||
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
|
|
||||||
chmod 600 ~/.ssh/id_ed25519
|
|
||||||
echo "${{ secrets.SSH_PUBLIC_KEY }}" > ~/.ssh/id_ed25519.pub
|
|
||||||
chmod 644 ~/.ssh/id_ed25519.pub
|
|
||||||
|
|
||||||
- name: Get Control Plane IP
|
|
||||||
id: cp_ip
|
|
||||||
working-directory: terraform
|
|
||||||
run: |
|
|
||||||
PRIMARY_IP=$(terraform output -raw primary_control_plane_ip)
|
|
||||||
echo "PRIMARY_IP=${PRIMARY_IP}" >> "$GITHUB_ENV"
|
|
||||||
|
|
||||||
- name: Pre-Destroy pg_dump to B2
|
|
||||||
run: |
|
|
||||||
set +e
|
|
||||||
echo "Attempting pre-destroy backup to B2..."
|
|
||||||
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@${PRIMARY_IP} << 'EOF'
|
|
||||||
set -e
|
|
||||||
# Check if kubectl is available and cluster is up
|
|
||||||
if ! command -v kubectl &> /dev/null; then
|
|
||||||
echo "kubectl not found, skipping pre-destroy backup"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if we can reach the cluster
|
|
||||||
if ! kubectl cluster-info &> /dev/null; then
|
|
||||||
echo "Cannot reach cluster, skipping pre-destroy backup"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if CNP is deployed
|
|
||||||
if ! kubectl get namespace cnpg-cluster &> /dev/null; then
|
|
||||||
echo "CNP namespace not found, skipping pre-destroy backup"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Run backup using the pgdump image directly
|
|
||||||
BACKUP_FILE="rancher-backup-$(date +%Y%m%d-%H%M%S).sql.gz"
|
|
||||||
B2_ACCOUNT_ID="$(cat /etc/kubernetes/secret/b2_account_id 2>/dev/null || echo '')"
|
|
||||||
B2_APPLICATION_KEY="$(cat /etc/kubernetes/secret/b2_application_key 2>/dev/null || echo '')"
|
|
||||||
|
|
||||||
if [ -z "$B2_ACCOUNT_ID" ] || [ -z "$B2_APPLICATION_KEY" ]; then
|
|
||||||
echo "B2 credentials not found in secret, skipping pre-destroy backup"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
kubectl run pgdump-manual --image=ghcr.io/cloudnative-pg/pgbackrest:latest --restart=Never \
|
|
||||||
-n cnpg-cluster --dry-run=client -o yaml | \
|
|
||||||
kubectl apply -f -
|
|
||||||
|
|
||||||
echo "Waiting for backup job to complete..."
|
|
||||||
kubectl wait --for=condition=complete job/pgdump-manual -n cnpg-cluster --timeout=300s || true
|
|
||||||
kubectl logs job/pgdump-manual -n cnpg-cluster || true
|
|
||||||
kubectl delete job pgdump-manual -n cnpg-cluster --ignore-not-found=true || true
|
|
||||||
EOF
|
|
||||||
echo "Pre-destroy backup step completed (failure is non-fatal)"
|
|
||||||
|
|
||||||
destroy:
|
destroy:
|
||||||
name: Destroy Cluster
|
name: Destroy Cluster
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.event.inputs.confirm == 'destroy'
|
if: github.event.inputs.confirm == 'destroy'
|
||||||
environment: destroy
|
environment: destroy
|
||||||
needs: pre-destroy-backup
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -120,6 +39,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
terraform_version: ${{ env.TF_VERSION }}
|
terraform_version: ${{ env.TF_VERSION }}
|
||||||
|
|
||||||
|
- name: Setup SSH Keys
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
|
||||||
|
chmod 600 ~/.ssh/id_ed25519
|
||||||
|
echo "${{ secrets.SSH_PUBLIC_KEY }}" > ~/.ssh/id_ed25519.pub
|
||||||
|
chmod 644 ~/.ssh/id_ed25519.pub
|
||||||
|
|
||||||
- name: Terraform Init
|
- name: Terraform Init
|
||||||
working-directory: terraform
|
working-directory: terraform
|
||||||
run: |
|
run: |
|
||||||
@@ -131,19 +58,6 @@ jobs:
|
|||||||
-backend-config="secret_key=${{ secrets.S3_SECRET_KEY }}" \
|
-backend-config="secret_key=${{ secrets.S3_SECRET_KEY }}" \
|
||||||
-backend-config="skip_requesting_account_id=true"
|
-backend-config="skip_requesting_account_id=true"
|
||||||
|
|
||||||
- name: Setup SSH Keys
|
|
||||||
run: |
|
|
||||||
mkdir -p ~/.ssh
|
|
||||||
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
|
|
||||||
chmod 600 ~/.ssh/id_ed25519
|
|
||||||
echo "${{ secrets.SSH_PUBLIC_KEY }}" > ~/.ssh/id_ed25519.pub
|
|
||||||
chmod 644 ~/.ssh/id_ed25519.pub
|
|
||||||
|
|
||||||
- name: Install jq
|
|
||||||
run: |
|
|
||||||
apt-get update
|
|
||||||
apt-get install -y jq
|
|
||||||
|
|
||||||
- name: Terraform Destroy
|
- name: Terraform Destroy
|
||||||
id: destroy
|
id: destroy
|
||||||
working-directory: terraform
|
working-directory: terraform
|
||||||
@@ -152,7 +66,6 @@ jobs:
|
|||||||
for attempt in 1 2 3; do
|
for attempt in 1 2 3; do
|
||||||
echo "Terraform destroy attempt ${attempt}/3"
|
echo "Terraform destroy attempt ${attempt}/3"
|
||||||
terraform destroy \
|
terraform destroy \
|
||||||
-var="hcloud_token=${{ secrets.HCLOUD_TOKEN }}" \
|
|
||||||
-var="ssh_public_key=$HOME/.ssh/id_ed25519.pub" \
|
-var="ssh_public_key=$HOME/.ssh/id_ed25519.pub" \
|
||||||
-var="ssh_private_key=$HOME/.ssh/id_ed25519" \
|
-var="ssh_private_key=$HOME/.ssh/id_ed25519" \
|
||||||
-auto-approve
|
-auto-approve
|
||||||
@@ -164,32 +77,13 @@ jobs:
|
|||||||
echo "Terraform destroy failed with exit code ${rc}; retrying in 30s"
|
echo "Terraform destroy failed with exit code ${rc}; retrying in 30s"
|
||||||
sleep 30
|
sleep 30
|
||||||
terraform refresh \
|
terraform refresh \
|
||||||
-var="hcloud_token=${{ secrets.HCLOUD_TOKEN }}" \
|
|
||||||
-var="ssh_public_key=$HOME/.ssh/id_ed25519.pub" \
|
-var="ssh_public_key=$HOME/.ssh/id_ed25519.pub" \
|
||||||
-var="ssh_private_key=$HOME/.ssh/id_ed25519" || true
|
-var="ssh_private_key=$HOME/.ssh/id_ed25519" || true
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
exit "$rc"
|
exit "$rc"
|
||||||
|
|
||||||
- name: Hetzner destroy diagnostics
|
- name: Terraform state diagnostics
|
||||||
if: failure() && steps.destroy.outcome == 'failure'
|
if: failure() && steps.destroy.outcome == 'failure'
|
||||||
env:
|
|
||||||
HCLOUD_TOKEN: ${{ secrets.HCLOUD_TOKEN }}
|
|
||||||
run: |
|
run: |
|
||||||
set +e
|
|
||||||
echo "== Terraform state list =="
|
|
||||||
terraform -chdir=terraform state list || true
|
terraform -chdir=terraform state list || true
|
||||||
|
|
||||||
network_id=$(terraform -chdir=terraform state show hcloud_network.cluster 2>/dev/null | awk '/^id *=/ {gsub(/"/, "", $3); print $3; exit}')
|
|
||||||
if [ -z "$network_id" ]; then
|
|
||||||
network_id="11988935"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "== Hetzner network =="
|
|
||||||
curl -fsSL -H "Authorization: Bearer ${HCLOUD_TOKEN}" "https://api.hetzner.cloud/v1/networks/${network_id}" | jq . || true
|
|
||||||
|
|
||||||
echo "== Hetzner servers attached to network =="
|
|
||||||
curl -fsSL -H "Authorization: Bearer ${HCLOUD_TOKEN}" "https://api.hetzner.cloud/v1/servers" | jq --argjson id "$network_id" '.servers[] | select(any(.private_net[]?; .network == $id)) | {id, name, private_net}' || true
|
|
||||||
|
|
||||||
echo "== Hetzner load balancers attached to network =="
|
|
||||||
curl -fsSL -H "Authorization: Bearer ${HCLOUD_TOKEN}" "https://api.hetzner.cloud/v1/load_balancers" | jq --argjson id "$network_id" '.load_balancers[] | select(any(.private_net[]?; .network == $id)) | {id, name, private_net}' || true
|
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ Repository guide for OpenCode sessions in this repo.
|
|||||||
|
|
||||||
## Current Baseline
|
## Current Baseline
|
||||||
|
|
||||||
- HA private cluster: 3 control planes, 3 workers.
|
- HA private cluster: 3 control planes, 5 workers on Proxmox.
|
||||||
|
- Proxmox clones come from template `9000` on node `flex`; API VIP is `10.27.27.40` via kube-vip.
|
||||||
|
- Storage is `nfs-subdir-external-provisioner` backed by `10.27.27.239:/TheFlash/k8s-nfs` with StorageClass `flash-nfs`.
|
||||||
- Tailscale is the private access path for Rancher and shared services.
|
- Tailscale is the private access path for Rancher and shared services.
|
||||||
- Rancher, Grafana, and Prometheus are exposed through Tailscale; Flux UI / Weave GitOps is removed.
|
- Rancher, Grafana, and Prometheus are exposed through Tailscale; Flux UI / Weave GitOps is removed.
|
||||||
- `apps/` is suspended by default.
|
- `apps/` is suspended by default.
|
||||||
@@ -20,8 +22,8 @@ Repository guide for OpenCode sessions in this repo.
|
|||||||
- Terraform: `terraform -chdir=terraform fmt -recursive`, `terraform -chdir=terraform validate`, `terraform -chdir=terraform plan -var-file=../terraform.tfvars`, `terraform -chdir=terraform apply -var-file=../terraform.tfvars`
|
- Terraform: `terraform -chdir=terraform fmt -recursive`, `terraform -chdir=terraform validate`, `terraform -chdir=terraform plan -var-file=../terraform.tfvars`, `terraform -chdir=terraform apply -var-file=../terraform.tfvars`
|
||||||
- Ansible: `ansible-galaxy collection install -r ansible/requirements.yml`, `cd ansible && python3 generate_inventory.py`, `ansible-playbook -i ansible/inventory.ini ansible/site.yml --syntax-check`, `ansible-playbook ansible/site.yml`
|
- Ansible: `ansible-galaxy collection install -r ansible/requirements.yml`, `cd ansible && python3 generate_inventory.py`, `ansible-playbook -i ansible/inventory.ini ansible/site.yml --syntax-check`, `ansible-playbook ansible/site.yml`
|
||||||
- Flux/Kustomize: `kubectl kustomize infrastructure/addons/<addon>`, `kubectl kustomize clusters/prod/flux-system`
|
- Flux/Kustomize: `kubectl kustomize infrastructure/addons/<addon>`, `kubectl kustomize clusters/prod/flux-system`
|
||||||
- Kubeconfig refresh: `scripts/refresh-kubeconfig.sh <cp1-public-ip>`
|
- Kubeconfig refresh: `scripts/refresh-kubeconfig.sh <cp1-ip>`
|
||||||
- Tailnet smoke check: `ssh root@<cp1-ip> 'bash -s' < scripts/smoke-check-tailnet-services.sh`
|
- Tailnet smoke check: `ssh ubuntu@<cp1-ip> 'bash -s' < scripts/smoke-check-tailnet-services.sh`
|
||||||
|
|
||||||
## Workflow Rules
|
## Workflow Rules
|
||||||
|
|
||||||
@@ -31,12 +33,14 @@ Repository guide for OpenCode sessions in this repo.
|
|||||||
- CI deploy order is Terraform -> Ansible -> Flux bootstrap -> Rancher restore -> health checks.
|
- CI deploy order is Terraform -> Ansible -> Flux bootstrap -> Rancher restore -> health checks.
|
||||||
- One object per Kubernetes YAML file; keep filenames kebab-case.
|
- One object per Kubernetes YAML file; keep filenames kebab-case.
|
||||||
- If `kubectl` points at `localhost:8080` after a rebuild, refresh kubeconfig from the primary control-plane IP.
|
- If `kubectl` points at `localhost:8080` after a rebuild, refresh kubeconfig from the primary control-plane IP.
|
||||||
|
- Bootstrap assumptions that matter: SSH user is `ubuntu`, NIC is `ens18`, API join endpoint is the kube-vip address.
|
||||||
|
|
||||||
## Repo-Specific Gotchas
|
## Repo-Specific Gotchas
|
||||||
|
|
||||||
- `rancher-backup` uses a postRenderer to swap the broken hook image to `rancher/kubectl:v1.34.0`; do not put S3 config in HelmRelease values. Put it in the Backup CR.
|
- `rancher-backup` uses a postRenderer to swap the broken hook image to `rancher/kubectl:v1.34.0`; do not put S3 config in HelmRelease values. Put it in the Backup CR.
|
||||||
- Tailscale cleanup only runs before service proxies exist; it removes stale offline `rancher`/`grafana`/`prometheus`/`flux` devices, then must stop so live proxies are not deleted.
|
- Tailscale cleanup only runs before service proxies exist; it removes stale offline `rancher`/`grafana`/`prometheus`/`flux` devices, then must stop so live proxies are not deleted.
|
||||||
- Keep the Tailscale operator on the stable Helm repo `https://pkgs.tailscale.com/helmcharts` at `1.96.5` unless you have a reason to change it.
|
- Keep the vendored Tailscale operator chart at `infrastructure/charts/tailscale-operator` pinned to `1.96.5`; do not restore the remote HelmRepository unless cluster-side chart fetches are reliable.
|
||||||
|
- The repo no longer uses a cloud controller manager. If you see `providerID` or Hetzner-specific logic, it is stale.
|
||||||
- Current private URLs:
|
- Current private URLs:
|
||||||
- Rancher: `https://rancher.silverside-gopher.ts.net/`
|
- Rancher: `https://rancher.silverside-gopher.ts.net/`
|
||||||
- Grafana: `http://grafana.silverside-gopher.ts.net/`
|
- Grafana: `http://grafana.silverside-gopher.ts.net/`
|
||||||
|
|||||||
@@ -0,0 +1,287 @@
|
|||||||
|
# App Repo Deployment Guide
|
||||||
|
|
||||||
|
This guide explains the recommended way to deploy an application to this cluster.
|
||||||
|
|
||||||
|
## Recommended Model
|
||||||
|
|
||||||
|
Use two repos:
|
||||||
|
|
||||||
|
- `HetznerTerra` (this repo): cluster, addons, shared infrastructure, Flux wiring
|
||||||
|
- `your-app-repo`: application source, Dockerfile, CI, Kubernetes manifests or Helm chart
|
||||||
|
|
||||||
|
Why:
|
||||||
|
|
||||||
|
- cluster lifecycle stays separate from app code
|
||||||
|
- app CI can build and tag images independently
|
||||||
|
- this repo remains the source of truth for what the cluster is allowed to deploy
|
||||||
|
|
||||||
|
## Current Cluster Assumptions
|
||||||
|
|
||||||
|
- Flux is already installed and reconciles this repo from `main`
|
||||||
|
- `clusters/prod/flux-system/kustomization-apps.yaml` points at `./apps`
|
||||||
|
- `apps` is suspended by default
|
||||||
|
- private access is through Tailscale
|
||||||
|
- runtime secrets should come from Doppler via External Secrets
|
||||||
|
|
||||||
|
## Deployment Options
|
||||||
|
|
||||||
|
### Option A: Separate app repo
|
||||||
|
|
||||||
|
Recommended for most real applications.
|
||||||
|
|
||||||
|
Flow:
|
||||||
|
|
||||||
|
1. App repo builds and pushes an image.
|
||||||
|
2. This repo defines a `GitRepository` pointing at the app repo.
|
||||||
|
3. This repo defines a `Kustomization` pointing at a path in the app repo.
|
||||||
|
4. Flux pulls the app repo and applies the manifests.
|
||||||
|
|
||||||
|
### Option B: In-repo app manifests
|
||||||
|
|
||||||
|
Only use this when the application is tiny or tightly coupled to the platform.
|
||||||
|
|
||||||
|
Flow:
|
||||||
|
|
||||||
|
1. Put Kubernetes manifests directly under `apps/` in this repo.
|
||||||
|
2. Unsuspend the top-level `apps` Kustomization.
|
||||||
|
|
||||||
|
This is simpler, but mixes platform and app changes together.
|
||||||
|
|
||||||
|
## App Repo Structure
|
||||||
|
|
||||||
|
Suggested layout:
|
||||||
|
|
||||||
|
```text
|
||||||
|
your-app-repo/
|
||||||
|
├── src/
|
||||||
|
├── Dockerfile
|
||||||
|
├── .gitea/workflows/
|
||||||
|
└── deploy/
|
||||||
|
├── base/
|
||||||
|
│ ├── namespace.yaml
|
||||||
|
│ ├── deployment.yaml
|
||||||
|
│ ├── service.yaml
|
||||||
|
│ ├── externalsecret.yaml
|
||||||
|
│ └── kustomization.yaml
|
||||||
|
└── prod/
|
||||||
|
├── kustomization.yaml
|
||||||
|
└── patch-*.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
If you prefer Helm, replace `deploy/base` and `deploy/prod` with a chart path and point Flux at that instead.
|
||||||
|
|
||||||
|
## What the App Repo Should Own
|
||||||
|
|
||||||
|
- application source code
|
||||||
|
- image build pipeline
|
||||||
|
- image tag strategy
|
||||||
|
- Deployment / Service / Ingress or Tailscale-facing Service manifests
|
||||||
|
- app-specific `ExternalSecret` manifests
|
||||||
|
- app-specific namespace
|
||||||
|
|
||||||
|
## What This Repo Should Own
|
||||||
|
|
||||||
|
- cluster-level permission to deploy the app
|
||||||
|
- the `GitRepository` and top-level `Kustomization` that attach the app repo to the cluster
|
||||||
|
- whether the `apps` layer is suspended or active
|
||||||
|
|
||||||
|
## Recommended First App Integration
|
||||||
|
|
||||||
|
In this repo, add Flux objects under `apps/` that point to the app repo.
|
||||||
|
|
||||||
|
Example files to add:
|
||||||
|
|
||||||
|
- `apps/gitrepository-my-app.yaml`
|
||||||
|
- `apps/kustomization-my-app.yaml`
|
||||||
|
- update `apps/kustomization.yaml`
|
||||||
|
|
||||||
|
Example `apps/gitrepository-my-app.yaml`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: source.toolkit.fluxcd.io/v1
|
||||||
|
kind: GitRepository
|
||||||
|
metadata:
|
||||||
|
name: my-app
|
||||||
|
namespace: flux-system
|
||||||
|
spec:
|
||||||
|
interval: 1m
|
||||||
|
ref:
|
||||||
|
branch: main
|
||||||
|
secretRef:
|
||||||
|
name: flux-system
|
||||||
|
url: ssh://git@<your-git-host>:<port>/<org>/<your-app-repo>.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Example `apps/kustomization-my-app.yaml`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
||||||
|
kind: Kustomization
|
||||||
|
metadata:
|
||||||
|
name: my-app
|
||||||
|
namespace: flux-system
|
||||||
|
spec:
|
||||||
|
interval: 10m
|
||||||
|
prune: true
|
||||||
|
sourceRef:
|
||||||
|
kind: GitRepository
|
||||||
|
name: my-app
|
||||||
|
path: ./deploy/prod
|
||||||
|
wait: true
|
||||||
|
timeout: 5m
|
||||||
|
dependsOn:
|
||||||
|
- name: infrastructure
|
||||||
|
```
|
||||||
|
|
||||||
|
Then update `apps/kustomization.yaml`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- gitrepository-my-app.yaml
|
||||||
|
- kustomization-my-app.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
## App Secrets
|
||||||
|
|
||||||
|
Recommended path:
|
||||||
|
|
||||||
|
1. Put runtime values in Doppler.
|
||||||
|
2. In the app manifests, create an `ExternalSecret` that reads from `doppler-hetznerterra`.
|
||||||
|
3. Reference the resulting Kubernetes Secret from the Deployment.
|
||||||
|
|
||||||
|
Example app-side `ExternalSecret`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: external-secrets.io/v1
|
||||||
|
kind: ExternalSecret
|
||||||
|
metadata:
|
||||||
|
name: my-app-env
|
||||||
|
namespace: my-app
|
||||||
|
spec:
|
||||||
|
refreshInterval: 1h
|
||||||
|
secretStoreRef:
|
||||||
|
name: doppler-hetznerterra
|
||||||
|
kind: ClusterSecretStore
|
||||||
|
target:
|
||||||
|
name: my-app-env
|
||||||
|
creationPolicy: Owner
|
||||||
|
data:
|
||||||
|
- secretKey: DATABASE_URL
|
||||||
|
remoteRef:
|
||||||
|
key: MY_APP_DATABASE_URL
|
||||||
|
```
|
||||||
|
|
||||||
|
## Image Delivery
|
||||||
|
|
||||||
|
Recommended flow:
|
||||||
|
|
||||||
|
1. App repo CI builds a container image.
|
||||||
|
2. CI pushes it to a registry.
|
||||||
|
3. The app repo updates the Kubernetes image tag in `deploy/prod`.
|
||||||
|
4. Flux notices the Git change and deploys it.
|
||||||
|
|
||||||
|
Keep the first version simple. Do not add image automation until the basic deploy path is proven.
|
||||||
|
|
||||||
|
## Exposing the App
|
||||||
|
|
||||||
|
Pick one:
|
||||||
|
|
||||||
|
### Private app over Tailscale
|
||||||
|
|
||||||
|
Best fit for this cluster right now.
|
||||||
|
|
||||||
|
Create a Service like the existing Rancher/Grafana/Prometheus pattern:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: my-app-tailscale
|
||||||
|
namespace: my-app
|
||||||
|
annotations:
|
||||||
|
tailscale.com/hostname: my-app
|
||||||
|
tailscale.com/tags: "tag:prod"
|
||||||
|
tailscale.com/proxy-class: infra-stable
|
||||||
|
spec:
|
||||||
|
type: LoadBalancer
|
||||||
|
loadBalancerClass: tailscale
|
||||||
|
selector:
|
||||||
|
app.kubernetes.io/name: my-app
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
port: 80
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: 3000
|
||||||
|
```
|
||||||
|
|
||||||
|
Use `http://my-app.<your-tailnet>` or your chosen hostname.
|
||||||
|
|
||||||
|
### Cluster-internal only
|
||||||
|
|
||||||
|
Create only a `ClusterIP` Service.
|
||||||
|
|
||||||
|
### Public ingress
|
||||||
|
|
||||||
|
Not recommended as the first app path in this repo. Get the private path working first.
|
||||||
|
|
||||||
|
## Enabling the Apps Layer
|
||||||
|
|
||||||
|
The cluster-wide `apps` Kustomization is suspended by default.
|
||||||
|
|
||||||
|
When you are ready to let Flux deploy app attachments from `apps/`, unsuspend it:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl -n flux-system patch kustomization apps --type=merge -p '{"spec":{"suspend":false}}'
|
||||||
|
```
|
||||||
|
|
||||||
|
Or commit a change to `clusters/prod/flux-system/kustomization-apps.yaml` changing:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
suspend: true
|
||||||
|
```
|
||||||
|
|
||||||
|
to:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
suspend: false
|
||||||
|
```
|
||||||
|
|
||||||
|
## First Deploy Checklist
|
||||||
|
|
||||||
|
Before deploying the first app, make sure:
|
||||||
|
|
||||||
|
1. app image builds successfully
|
||||||
|
2. app repo contains valid `deploy/prod` manifests
|
||||||
|
3. this repo contains the `GitRepository` + `Kustomization` attachment objects
|
||||||
|
4. required Doppler secrets exist
|
||||||
|
5. `apps` is unsuspended if you are using the top-level `apps` layer
|
||||||
|
|
||||||
|
## Verification Commands
|
||||||
|
|
||||||
|
From a machine with cluster access:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl -n flux-system get gitrepositories,kustomizations
|
||||||
|
kubectl get ns
|
||||||
|
kubectl -n my-app get deploy,svc,pods,externalsecret,secret
|
||||||
|
```
|
||||||
|
|
||||||
|
If private over Tailscale:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl -n my-app get svc my-app-tailscale -o wide
|
||||||
|
```
|
||||||
|
|
||||||
|
## Minimal Recommendation
|
||||||
|
|
||||||
|
If you want the simplest, lowest-risk first deploy:
|
||||||
|
|
||||||
|
1. create a separate app repo
|
||||||
|
2. add `deploy/base` + `deploy/prod`
|
||||||
|
3. add a `GitRepository` + `Kustomization` in this repo under `apps/`
|
||||||
|
4. keep the app private with a Tailscale `LoadBalancer` Service
|
||||||
|
5. use Doppler + `ExternalSecret` for runtime config
|
||||||
|
|
||||||
|
That matches the current cluster design with the least surprise.
|
||||||
@@ -1,30 +1,28 @@
|
|||||||
# Hetzner Kubernetes Cluster
|
# Proxmox Kubernetes Cluster
|
||||||
|
|
||||||
Production-ready Kubernetes cluster on Hetzner Cloud using Terraform and Ansible.
|
Production-ready private Kubernetes cluster on Proxmox using Terraform, Ansible, and Flux.
|
||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
||||||
| Component | Details |
|
| Component | Details |
|
||||||
|-----------|---------|
|
|-----------|---------|
|
||||||
| **Control Plane** | 3x CX23 (HA) |
|
| **Control Plane** | 3x Proxmox VMs (2 vCPU / 4 GiB / 32 GiB) |
|
||||||
| **Workers** | 3x CX33 |
|
| **Workers** | 5x Proxmox VMs (4 vCPU / 8 GiB / 64 GiB) |
|
||||||
| **K8s** | k3s (latest, HA) |
|
| **K8s** | k3s (latest, HA) |
|
||||||
| **Addons** | Hetzner CCM + CSI + Prometheus + Grafana + Loki |
|
| **Addons** | NFS provisioner + Prometheus + Grafana + Loki + Rancher |
|
||||||
| **Access** | SSH/API and private services restricted to Tailnet |
|
| **Access** | SSH/API and private services restricted to Tailnet |
|
||||||
| **Bootstrap** | Terraform + Ansible + Flux |
|
| **Bootstrap** | Terraform + Ansible + Flux |
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
### 1. Hetzner Cloud API Token
|
### 1. Proxmox API Token
|
||||||
|
|
||||||
1. Go to [Hetzner Cloud Console](https://console.hetzner.com/)
|
Create an API token for the Proxmox VE user used by Terraform. The repo expects the `bpg/proxmox` provider with:
|
||||||
2. Select your project (or create a new one)
|
|
||||||
3. Navigate to **Security** → **API Tokens**
|
- endpoint: `https://100.105.0.115:8006/`
|
||||||
4. Click **Generate API Token**
|
- node: `flex`
|
||||||
5. Set description: `k8s-cluster-terraform`
|
- clone source: template `9000` (`ubuntu-2404-k8s-template`)
|
||||||
6. Select permissions: **Read & Write**
|
- auth: API token
|
||||||
7. Click **Generate API Token**
|
|
||||||
8. **Copy the token immediately** - it won't be shown again!
|
|
||||||
|
|
||||||
### 2. Backblaze B2 Bucket (for Terraform State)
|
### 2. Backblaze B2 Bucket (for Terraform State)
|
||||||
|
|
||||||
@@ -44,7 +42,7 @@ Production-ready Kubernetes cluster on Hetzner Cloud using Terraform and Ansible
|
|||||||
### 3. SSH Key Pair
|
### 3. SSH Key Pair
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ssh-keygen -t ed25519 -C "k8s@hetzner" -f ~/.ssh/hetzner_k8s
|
ssh-keygen -t ed25519 -C "k8s@proxmox" -f ~/.ssh/infra
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4. Local Tools
|
### 4. Local Tools
|
||||||
@@ -71,10 +69,12 @@ cp terraform.tfvars.example terraform.tfvars
|
|||||||
Edit `terraform.tfvars`:
|
Edit `terraform.tfvars`:
|
||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
hcloud_token = "your-hetzner-api-token"
|
proxmox_endpoint = "https://100.105.0.115:8006/"
|
||||||
|
proxmox_api_token_id = "terraform-prov@pve!k8s-cluster"
|
||||||
|
proxmox_api_token_secret = "your-proxmox-token-secret"
|
||||||
|
|
||||||
ssh_public_key = "~/.ssh/hetzner_k8s.pub"
|
ssh_public_key = "~/.ssh/infra.pub"
|
||||||
ssh_private_key = "~/.ssh/hetzner_k8s"
|
ssh_private_key = "~/.ssh/infra"
|
||||||
|
|
||||||
s3_access_key = "your-backblaze-key-id"
|
s3_access_key = "your-backblaze-key-id"
|
||||||
s3_secret_key = "your-backblaze-application-key"
|
s3_secret_key = "your-backblaze-application-key"
|
||||||
@@ -84,12 +84,7 @@ s3_bucket = "k8s-terraform-state"
|
|||||||
tailscale_auth_key = "tskey-auth-..."
|
tailscale_auth_key = "tskey-auth-..."
|
||||||
tailscale_tailnet = "yourtailnet.ts.net"
|
tailscale_tailnet = "yourtailnet.ts.net"
|
||||||
|
|
||||||
restrict_api_ssh_to_tailnet = true
|
kube_api_vip = "10.27.27.40"
|
||||||
tailnet_cidr = "100.64.0.0/10"
|
|
||||||
enable_nodeport_public = false
|
|
||||||
|
|
||||||
allowed_ssh_ips = []
|
|
||||||
allowed_api_ips = []
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. Initialize Terraform
|
### 3. Initialize Terraform
|
||||||
@@ -152,7 +147,9 @@ Set these in your Gitea repository settings (**Settings** → **Secrets** → **
|
|||||||
|
|
||||||
| Secret | Description |
|
| Secret | Description |
|
||||||
|--------|-------------|
|
|--------|-------------|
|
||||||
| `HCLOUD_TOKEN` | Hetzner Cloud API token |
|
| `PROXMOX_ENDPOINT` | Proxmox API endpoint (for example `https://100.105.0.115:8006/`) |
|
||||||
|
| `PROXMOX_API_TOKEN_ID` | Proxmox API token ID |
|
||||||
|
| `PROXMOX_API_TOKEN_SECRET` | Proxmox API token secret |
|
||||||
| `S3_ACCESS_KEY` | Backblaze B2 keyID |
|
| `S3_ACCESS_KEY` | Backblaze B2 keyID |
|
||||||
| `S3_SECRET_KEY` | Backblaze B2 applicationKey |
|
| `S3_SECRET_KEY` | Backblaze B2 applicationKey |
|
||||||
| `S3_ENDPOINT` | Backblaze S3 endpoint (e.g., `https://s3.eu-central-003.backblazeb2.com`) |
|
| `S3_ENDPOINT` | Backblaze S3 endpoint (e.g., `https://s3.eu-central-003.backblazeb2.com`) |
|
||||||
@@ -163,7 +160,6 @@ Set these in your Gitea repository settings (**Settings** → **Secrets** → **
|
|||||||
| `TAILSCALE_OAUTH_CLIENT_SECRET` | Tailscale OAuth client secret for Kubernetes Operator |
|
| `TAILSCALE_OAUTH_CLIENT_SECRET` | Tailscale OAuth client secret for Kubernetes Operator |
|
||||||
| `DOPPLER_HETZNERTERRA_SERVICE_TOKEN` | Doppler service token for `hetznerterra` runtime secrets |
|
| `DOPPLER_HETZNERTERRA_SERVICE_TOKEN` | Doppler service token for `hetznerterra` runtime secrets |
|
||||||
| `GRAFANA_ADMIN_PASSWORD` | Optional admin password for Grafana (auto-generated if unset) |
|
| `GRAFANA_ADMIN_PASSWORD` | Optional admin password for Grafana (auto-generated if unset) |
|
||||||
| `RUNNER_ALLOWED_CIDRS` | Optional CIDR list for CI runner access if you choose to pass it via tfvars/secrets |
|
|
||||||
| `SSH_PUBLIC_KEY` | SSH public key content |
|
| `SSH_PUBLIC_KEY` | SSH public key content |
|
||||||
| `SSH_PRIVATE_KEY` | SSH private key content |
|
| `SSH_PRIVATE_KEY` | SSH private key content |
|
||||||
|
|
||||||
@@ -176,8 +172,8 @@ This repo uses Flux for continuous reconciliation after Terraform + Ansible boot
|
|||||||
The current default target is the HA private baseline:
|
The current default target is the HA private baseline:
|
||||||
|
|
||||||
- `3` control plane nodes
|
- `3` control plane nodes
|
||||||
- `3` worker nodes
|
- `5` worker nodes
|
||||||
- private Hetzner network only
|
- private Proxmox network only
|
||||||
- Tailscale for operator and service access
|
- Tailscale for operator and service access
|
||||||
- Flux-managed platform addons with `apps` suspended by default
|
- Flux-managed platform addons with `apps` suspended by default
|
||||||
|
|
||||||
@@ -207,8 +203,7 @@ Terraform/bootstrap secrets remain in Gitea Actions secrets and are not managed
|
|||||||
### Reconciliation graph
|
### Reconciliation graph
|
||||||
|
|
||||||
- `infrastructure` (top-level)
|
- `infrastructure` (top-level)
|
||||||
- `addon-ccm`
|
- `addon-nfs-storage`
|
||||||
- `addon-csi` depends on `addon-ccm`
|
|
||||||
- `addon-tailscale-operator`
|
- `addon-tailscale-operator`
|
||||||
- `addon-observability`
|
- `addon-observability`
|
||||||
- `addon-observability-content` depends on `addon-observability`
|
- `addon-observability-content` depends on `addon-observability`
|
||||||
@@ -224,7 +219,7 @@ Terraform/bootstrap secrets remain in Gitea Actions secrets and are not managed
|
|||||||
### Current addon status
|
### Current addon status
|
||||||
|
|
||||||
- Core infrastructure addons are Flux-managed from `infrastructure/addons/`.
|
- Core infrastructure addons are Flux-managed from `infrastructure/addons/`.
|
||||||
- Active Flux addons for the current baseline: `addon-ccm`, `addon-csi`, `addon-cert-manager`, `addon-external-secrets`, `addon-tailscale-operator`, `addon-tailscale-proxyclass`, `addon-observability`, `addon-observability-content`, `addon-rancher`, `addon-rancher-config`, `addon-rancher-backup`, `addon-rancher-backup-config`.
|
- Active Flux addons for the current baseline: `addon-nfs-storage`, `addon-cert-manager`, `addon-external-secrets`, `addon-tailscale-operator`, `addon-tailscale-proxyclass`, `addon-observability`, `addon-observability-content`, `addon-rancher`, `addon-rancher-config`, `addon-rancher-backup`, `addon-rancher-backup-config`.
|
||||||
- `apps` remains suspended until workload rollout is explicitly enabled.
|
- `apps` remains suspended until workload rollout is explicitly enabled.
|
||||||
- Ansible is limited to cluster bootstrap, prerequisite secret creation, pre-proxy Tailscale cleanup, and kubeconfig finalization.
|
- Ansible is limited to cluster bootstrap, prerequisite secret creation, pre-proxy Tailscale cleanup, and kubeconfig finalization.
|
||||||
- Weave GitOps / Flux UI is no longer deployed; use Rancher or the `flux` CLI for Flux operations.
|
- Weave GitOps / Flux UI is no longer deployed; use Rancher or the `flux` CLI for Flux operations.
|
||||||
@@ -232,14 +227,14 @@ Terraform/bootstrap secrets remain in Gitea Actions secrets and are not managed
|
|||||||
### Rancher access
|
### Rancher access
|
||||||
|
|
||||||
- Rancher is private-only and exposed through Tailscale at `https://rancher.silverside-gopher.ts.net/`.
|
- Rancher is private-only and exposed through Tailscale at `https://rancher.silverside-gopher.ts.net/`.
|
||||||
- The public Hetzner load balancer path is not used for Rancher.
|
- Rancher and the Kubernetes API stay private; kube-vip provides the API VIP on the LAN.
|
||||||
- Rancher stores state in embedded etcd; no external database is used.
|
- Rancher stores state in embedded etcd; no external database is used.
|
||||||
|
|
||||||
### Stable baseline acceptance
|
### Stable baseline acceptance
|
||||||
|
|
||||||
A rebuild is considered successful only when all of the following pass without manual intervention:
|
A rebuild is considered successful only when all of the following pass without manual intervention:
|
||||||
|
|
||||||
- Terraform create succeeds for the default `3` control planes and `3` workers.
|
- Terraform create succeeds for the default `3` control planes and `5` workers.
|
||||||
- Ansible bootstrap succeeds end-to-end.
|
- Ansible bootstrap succeeds end-to-end.
|
||||||
- All nodes become `Ready`.
|
- All nodes become `Ready`.
|
||||||
- Flux core reconciliation is healthy.
|
- Flux core reconciliation is healthy.
|
||||||
@@ -323,9 +318,6 @@ It avoids full cluster provisioning and only applies Grafana content resources:
|
|||||||
├── terraform/
|
├── terraform/
|
||||||
│ ├── main.tf
|
│ ├── main.tf
|
||||||
│ ├── variables.tf
|
│ ├── variables.tf
|
||||||
│ ├── network.tf
|
|
||||||
│ ├── firewall.tf
|
|
||||||
│ ├── ssh.tf
|
|
||||||
│ ├── servers.tf
|
│ ├── servers.tf
|
||||||
│ ├── outputs.tf
|
│ ├── outputs.tf
|
||||||
│ └── backend.tf
|
│ └── backend.tf
|
||||||
@@ -353,17 +345,19 @@ It avoids full cluster provisioning and only applies Grafana content resources:
|
|||||||
|
|
||||||
## Firewall Rules
|
## Firewall Rules
|
||||||
|
|
||||||
|
This repo no longer manages cloud firewalls. Access control is expected to be handled on your LAN infrastructure and through Tailscale.
|
||||||
|
|
||||||
|
Important cluster-local ports still in use:
|
||||||
|
|
||||||
| Port | Source | Purpose |
|
| Port | Source | Purpose |
|
||||||
|------|--------|---------|
|
|------|--------|---------|
|
||||||
| 22 | Tailnet CIDR | SSH |
|
| 22 | Admin hosts / CI | SSH |
|
||||||
| 6443 | Tailnet CIDR + internal | Kubernetes API |
|
| 6443 | 10.27.27.0/24 + VIP | Kubernetes API |
|
||||||
| 41641/udp | Any | Tailscale WireGuard |
|
| 9345 | 10.27.27.0/24 | k3s Supervisor |
|
||||||
| 9345 | 10.0.0.0/16 | k3s Supervisor (HA join) |
|
| 2379 | 10.27.27.0/24 | etcd Client |
|
||||||
| 2379 | 10.0.0.0/16 | etcd Client |
|
| 2380 | 10.27.27.0/24 | etcd Peer |
|
||||||
| 2380 | 10.0.0.0/16 | etcd Peer |
|
| 8472/udp | 10.27.27.0/24 | Flannel VXLAN |
|
||||||
| 8472 | 10.0.0.0/16 | Flannel VXLAN |
|
| 10250 | 10.27.27.0/24 | Kubelet |
|
||||||
| 10250 | 10.0.0.0/16 | Kubelet |
|
|
||||||
| 30000-32767 | Optional | NodePorts (disabled by default) |
|
|
||||||
|
|
||||||
## Operations
|
## Operations
|
||||||
|
|
||||||
@@ -399,7 +393,7 @@ terraform destroy
|
|||||||
### Check k3s Logs
|
### Check k3s Logs
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ssh root@<control-plane-ip> journalctl -u k3s -f
|
ssh ubuntu@<control-plane-ip> sudo journalctl -u k3s -f
|
||||||
```
|
```
|
||||||
|
|
||||||
### Reset k3s
|
### Reset k3s
|
||||||
@@ -408,19 +402,10 @@ ssh root@<control-plane-ip> journalctl -u k3s -f
|
|||||||
ansible-playbook site.yml -t reset
|
ansible-playbook site.yml -t reset
|
||||||
```
|
```
|
||||||
|
|
||||||
## Costs Breakdown
|
|
||||||
|
|
||||||
| Resource | Quantity | Unit Price | Monthly |
|
|
||||||
|----------|----------|------------|---------|
|
|
||||||
| CX23 (Control Plane) | 3 | €2.99 | €8.97 |
|
|
||||||
| CX33 (Workers) | 4 | €4.99 | €19.96 |
|
|
||||||
| Backblaze B2 | ~1 GB | Free (first 10GB) | €0.00 |
|
|
||||||
| **Total** | | | **€28.93/mo** |
|
|
||||||
|
|
||||||
## Security Notes
|
## Security Notes
|
||||||
|
|
||||||
- Control plane has HA (3 nodes, can survive 1 failure)
|
- Control plane has HA (3 nodes, can survive 1 failure)
|
||||||
- Consider adding Hetzner load balancer for API server
|
- Kubernetes API HA is provided by kube-vip on `10.27.27.40`
|
||||||
- Rotate API tokens regularly
|
- Rotate API tokens regularly
|
||||||
- Use network policies in Kubernetes
|
- Use network policies in Kubernetes
|
||||||
- Enable audit logging for production
|
- Enable audit logging for production
|
||||||
|
|||||||
+14
-7
@@ -1,6 +1,6 @@
|
|||||||
# Gitea Secrets Setup
|
# Gitea Secrets Setup
|
||||||
|
|
||||||
This document describes the secrets required for the HetznerTerra deployment workflow.
|
This document describes the secrets required for the Proxmox-based deployment workflow.
|
||||||
|
|
||||||
## Required Secrets
|
## Required Secrets
|
||||||
|
|
||||||
@@ -9,10 +9,17 @@ Add these secrets in your Gitea repository settings:
|
|||||||
|
|
||||||
### Infrastructure Secrets
|
### Infrastructure Secrets
|
||||||
|
|
||||||
#### `HCLOUD_TOKEN`
|
#### `PROXMOX_ENDPOINT`
|
||||||
- Hetzner Cloud API token
|
- Proxmox VE API endpoint
|
||||||
- Get from: https://console.hetzner.com/projects/{project-id}/security/api-tokens
|
- Example: `https://100.105.0.115:8006/`
|
||||||
- Permissions: Read & Write
|
|
||||||
|
#### `PROXMOX_API_TOKEN_ID`
|
||||||
|
- Proxmox API token ID
|
||||||
|
- Example: `terraform-prov@pve!k8s-cluster`
|
||||||
|
|
||||||
|
#### `PROXMOX_API_TOKEN_SECRET`
|
||||||
|
- Proxmox API token secret
|
||||||
|
- Create with `pveum user token add terraform-prov@pve k8s-cluster`
|
||||||
|
|
||||||
#### `S3_ACCESS_KEY` & `S3_SECRET_KEY`
|
#### `S3_ACCESS_KEY` & `S3_SECRET_KEY`
|
||||||
- Backblaze B2 credentials for Terraform state storage
|
- Backblaze B2 credentials for Terraform state storage
|
||||||
@@ -31,7 +38,7 @@ Add these secrets in your Gitea repository settings:
|
|||||||
|
|
||||||
#### `SSH_PRIVATE_KEY` & `SSH_PUBLIC_KEY`
|
#### `SSH_PRIVATE_KEY` & `SSH_PUBLIC_KEY`
|
||||||
- SSH key pair for cluster access
|
- SSH key pair for cluster access
|
||||||
- Generate with: `ssh-keygen -t ed25519 -C "k8s@hetzner" -f ~/.ssh/hetzner_k8s`
|
- Generate with: `ssh-keygen -t ed25519 -C "k8s@proxmox" -f ~/.ssh/infra`
|
||||||
- Private key content (include BEGIN/END lines)
|
- Private key content (include BEGIN/END lines)
|
||||||
- Public key content (full line starting with ssh-ed25519)
|
- Public key content (full line starting with ssh-ed25519)
|
||||||
|
|
||||||
@@ -90,4 +97,4 @@ Check the workflow logs to verify all secrets are being used correctly.
|
|||||||
- Prefer Doppler for runtime app/platform secrets after cluster bootstrap
|
- Prefer Doppler for runtime app/platform secrets after cluster bootstrap
|
||||||
- Rotate Tailscale auth keys periodically
|
- Rotate Tailscale auth keys periodically
|
||||||
- Review OAuth client permissions regularly
|
- Review OAuth client permissions regularly
|
||||||
- The workflow automatically opens SSH/API access only for the runner's IP during deployment
|
- CI expects direct SSH access to the Proxmox VMs and direct Proxmox API access
|
||||||
|
|||||||
+12
-14
@@ -5,9 +5,9 @@ This document defines the current engineering target for this repository.
|
|||||||
## Topology
|
## Topology
|
||||||
|
|
||||||
- 3 control planes (HA etcd cluster)
|
- 3 control planes (HA etcd cluster)
|
||||||
- 3 workers
|
- 5 workers
|
||||||
- Hetzner Load Balancer for Kubernetes API
|
- kube-vip API VIP (`10.27.27.40`)
|
||||||
- private Hetzner network
|
- private Proxmox/LAN network (`10.27.27.0/24`)
|
||||||
- Tailscale operator access and service exposure
|
- Tailscale operator access and service exposure
|
||||||
- Rancher exposed through Tailscale (`rancher.silverside-gopher.ts.net`)
|
- Rancher exposed through Tailscale (`rancher.silverside-gopher.ts.net`)
|
||||||
- Grafana exposed through Tailscale (`grafana.silverside-gopher.ts.net`)
|
- Grafana exposed through Tailscale (`grafana.silverside-gopher.ts.net`)
|
||||||
@@ -17,11 +17,10 @@ This document defines the current engineering target for this repository.
|
|||||||
## In Scope
|
## In Scope
|
||||||
|
|
||||||
- Terraform infrastructure bootstrap
|
- Terraform infrastructure bootstrap
|
||||||
- Ansible k3s bootstrap with external cloud provider
|
- Ansible k3s bootstrap on Ubuntu cloud-init VMs
|
||||||
- **HA control plane (3 nodes with etcd quorum)**
|
- **HA control plane (3 nodes with etcd quorum)**
|
||||||
- **Hetzner Load Balancer for Kubernetes API**
|
- **kube-vip for Kubernetes API HA**
|
||||||
- **Hetzner CCM deployed via Ansible (before workers join)**
|
- **NFS-backed persistent volumes via `nfs-subdir-external-provisioner`**
|
||||||
- **Hetzner CSI for persistent volumes (via Flux)**
|
|
||||||
- Flux core reconciliation
|
- Flux core reconciliation
|
||||||
- External Secrets Operator with Doppler
|
- External Secrets Operator with Doppler
|
||||||
- Tailscale private access and smoke-check validation
|
- Tailscale private access and smoke-check validation
|
||||||
@@ -45,15 +44,14 @@ This document defines the current engineering target for this repository.
|
|||||||
|
|
||||||
## Phase Gates
|
## Phase Gates
|
||||||
|
|
||||||
1. Terraform apply completes for HA topology (3 CP, 3 workers, 1 LB).
|
1. Terraform apply completes for HA topology (3 CP, 5 workers, 1 VIP).
|
||||||
2. Load Balancer is healthy with all 3 control plane targets.
|
2. Primary control plane bootstraps with `--cluster-init`.
|
||||||
3. Primary control plane bootstraps with `--cluster-init`.
|
3. kube-vip advertises `10.27.27.40:6443` from the control-plane set.
|
||||||
4. Secondary control planes join via Load Balancer endpoint.
|
4. Secondary control planes join via the kube-vip endpoint.
|
||||||
5. **CCM deployed via Ansible before workers join** (fixes uninitialized taint issue).
|
5. Workers join successfully via the kube-vip endpoint.
|
||||||
6. Workers join successfully via Load Balancer and all nodes show proper `providerID`.
|
|
||||||
7. etcd reports 3 healthy members.
|
7. etcd reports 3 healthy members.
|
||||||
8. Flux source and infrastructure reconciliation are healthy.
|
8. Flux source and infrastructure reconciliation are healthy.
|
||||||
9. **CSI deploys and creates `hcloud-volumes` StorageClass**.
|
9. **NFS provisioner deploys and creates `flash-nfs` StorageClass**.
|
||||||
10. **PVC provisioning tested and working**.
|
10. **PVC provisioning tested and working**.
|
||||||
11. External Secrets sync required secrets.
|
11. External Secrets sync required secrets.
|
||||||
12. Tailscale private access works for Rancher, Grafana, and Prometheus.
|
12. Tailscale private access works for Rancher, Grafana, and Prometheus.
|
||||||
|
|||||||
+2
-1
@@ -3,7 +3,8 @@ inventory = inventory.ini
|
|||||||
host_key_checking = False
|
host_key_checking = False
|
||||||
retry_files_enabled = False
|
retry_files_enabled = False
|
||||||
roles_path = roles
|
roles_path = roles
|
||||||
stdout_callback = yaml
|
stdout_callback = default
|
||||||
|
result_format = yaml
|
||||||
interpreter_python = auto_silent
|
interpreter_python = auto_silent
|
||||||
|
|
||||||
[privilege_escalation]
|
[privilege_escalation]
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ control_plane
|
|||||||
workers
|
workers
|
||||||
|
|
||||||
[cluster:vars]
|
[cluster:vars]
|
||||||
ansible_user=root
|
ansible_user=ubuntu
|
||||||
ansible_python_interpreter=/usr/bin/python3
|
ansible_python_interpreter=/usr/bin/python3
|
||||||
ansible_ssh_private_key_file={{ private_key_file }}
|
ansible_ssh_private_key_file={{ private_key_file }}
|
||||||
k3s_version=latest
|
k3s_version=latest
|
||||||
|
|||||||
@@ -1,14 +1,4 @@
|
|||||||
---
|
---
|
||||||
- name: Apply Hetzner cloud secret
|
|
||||||
shell: >-
|
|
||||||
kubectl -n kube-system create secret generic hcloud
|
|
||||||
--from-literal=token='{{ hcloud_token }}'
|
|
||||||
--from-literal=network='{{ cluster_name }}-network'
|
|
||||||
--dry-run=client -o yaml | kubectl apply -f -
|
|
||||||
changed_when: true
|
|
||||||
no_log: true
|
|
||||||
when: hcloud_token | default('') | length > 0
|
|
||||||
|
|
||||||
- name: Ensure Tailscale operator namespace exists
|
- name: Ensure Tailscale operator namespace exists
|
||||||
command: >-
|
command: >-
|
||||||
kubectl create namespace {{ tailscale_operator_namespace | default('tailscale-system') }}
|
kubectl create namespace {{ tailscale_operator_namespace | default('tailscale-system') }}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
bootstrap_prepull_images:
|
||||||
|
- docker.io/rancher/mirrored-pause:3.6
|
||||||
|
- docker.io/rancher/mirrored-coredns-coredns:1.14.2
|
||||||
|
- docker.io/rancher/mirrored-metrics-server:v0.8.1
|
||||||
|
- docker.io/rancher/local-path-provisioner:v0.0.35
|
||||||
|
- docker.io/rancher/mirrored-library-traefik:3.6.10
|
||||||
|
- docker.io/rancher/klipper-helm:v0.9.14-build20260309
|
||||||
|
- ghcr.io/fluxcd/source-controller:v1.8.0
|
||||||
|
- ghcr.io/fluxcd/kustomize-controller:v1.8.1
|
||||||
|
- ghcr.io/fluxcd/helm-controller:v1.5.1
|
||||||
|
- ghcr.io/fluxcd/notification-controller:v1.8.1
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
---
|
||||||
|
- name: Pre-pull bootstrap images into containerd
|
||||||
|
shell: |
|
||||||
|
if /usr/local/bin/ctr -n k8s.io images ls -q | grep -Fx -- "{{ item }}" >/dev/null; then
|
||||||
|
echo "already present"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
for attempt in 1 2 3; do
|
||||||
|
if timeout 120s /usr/local/bin/ctr -n k8s.io images pull "{{ item }}"; then
|
||||||
|
echo "pulled image"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
args:
|
||||||
|
executable: /bin/bash
|
||||||
|
register: bootstrap_image_pull
|
||||||
|
loop: "{{ bootstrap_prepull_images }}"
|
||||||
|
changed_when: "'pulled image' in bootstrap_image_pull.stdout"
|
||||||
|
failed_when: false
|
||||||
|
|
||||||
|
- name: Report bootstrap images that did not pre-pull after retries
|
||||||
|
debug:
|
||||||
|
msg: >-
|
||||||
|
Best-effort bootstrap image pre-pull did not complete for {{ item.item }} after
|
||||||
|
3 attempt(s): {{ item.stderr | default('no stderr') }}
|
||||||
|
loop: "{{ bootstrap_image_pull.results | default([]) }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.item }}"
|
||||||
|
when: item.rc is defined and item.rc != 0
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Check if hcloud secret exists
|
|
||||||
command: kubectl -n kube-system get secret hcloud
|
|
||||||
register: hcloud_secret_check
|
|
||||||
changed_when: false
|
|
||||||
failed_when: false
|
|
||||||
|
|
||||||
- name: Fail if hcloud secret is missing
|
|
||||||
fail:
|
|
||||||
msg: "hcloud secret not found in kube-system namespace. CCM requires it."
|
|
||||||
when: hcloud_secret_check.rc != 0
|
|
||||||
|
|
||||||
- name: Check if helm is installed
|
|
||||||
command: which helm
|
|
||||||
register: helm_check
|
|
||||||
changed_when: false
|
|
||||||
failed_when: false
|
|
||||||
|
|
||||||
- name: Install helm
|
|
||||||
when: helm_check.rc != 0
|
|
||||||
block:
|
|
||||||
- name: Download helm install script
|
|
||||||
get_url:
|
|
||||||
url: https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
|
|
||||||
dest: /tmp/get-helm-3.sh
|
|
||||||
mode: "0755"
|
|
||||||
|
|
||||||
- name: Run helm install script
|
|
||||||
command: /tmp/get-helm-3.sh
|
|
||||||
args:
|
|
||||||
creates: /usr/local/bin/helm
|
|
||||||
|
|
||||||
- name: Add Hetzner Helm repository
|
|
||||||
kubernetes.core.helm_repository:
|
|
||||||
name: hcloud
|
|
||||||
repo_url: https://charts.hetzner.cloud
|
|
||||||
kubeconfig: /etc/rancher/k3s/k3s.yaml
|
|
||||||
environment:
|
|
||||||
KUBECONFIG: /etc/rancher/k3s/k3s.yaml
|
|
||||||
|
|
||||||
- name: Deploy Hetzner Cloud Controller Manager
|
|
||||||
kubernetes.core.helm:
|
|
||||||
name: hcloud-cloud-controller-manager
|
|
||||||
chart_ref: hcloud/hcloud-cloud-controller-manager
|
|
||||||
release_namespace: kube-system
|
|
||||||
create_namespace: true
|
|
||||||
values:
|
|
||||||
networking:
|
|
||||||
enabled: true
|
|
||||||
nodeSelector:
|
|
||||||
kubernetes.io/hostname: "{{ inventory_hostname }}"
|
|
||||||
additionalTolerations:
|
|
||||||
- key: node-role.kubernetes.io/control-plane
|
|
||||||
operator: Exists
|
|
||||||
effect: NoSchedule
|
|
||||||
kubeconfig: /etc/rancher/k3s/k3s.yaml
|
|
||||||
wait: true
|
|
||||||
wait_timeout: 300s
|
|
||||||
environment:
|
|
||||||
KUBECONFIG: /etc/rancher/k3s/k3s.yaml
|
|
||||||
|
|
||||||
- name: Wait for CCM to be ready
|
|
||||||
command: kubectl -n kube-system rollout status deployment/hcloud-cloud-controller-manager --timeout=120s
|
|
||||||
changed_when: false
|
|
||||||
register: ccm_rollout
|
|
||||||
until: ccm_rollout.rc == 0
|
|
||||||
retries: 3
|
|
||||||
delay: 10
|
|
||||||
|
|
||||||
- name: Pause to ensure CCM is fully ready to process new nodes
|
|
||||||
pause:
|
|
||||||
seconds: 10
|
|
||||||
|
|
||||||
- name: Verify CCM is removing uninitialized taints
|
|
||||||
command: kubectl get nodes -o jsonpath='{.items[*].spec.taints[?(@.key=="node.cloudprovider.kubernetes.io/uninitialized")].key}'
|
|
||||||
register: uninitialized_taints
|
|
||||||
changed_when: false
|
|
||||||
failed_when: false
|
|
||||||
|
|
||||||
- name: Display taint status
|
|
||||||
debug:
|
|
||||||
msg: "Nodes with uninitialized taint: {{ uninitialized_taints.stdout }}"
|
|
||||||
@@ -1,12 +1,32 @@
|
|||||||
---
|
---
|
||||||
|
- name: Check if cloud-init is installed
|
||||||
|
command: which cloud-init
|
||||||
|
register: cloud_init_binary
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
|
|
||||||
|
- name: Wait for cloud-init to finish first-boot tasks
|
||||||
|
command: cloud-init status --wait
|
||||||
|
register: cloud_init_wait
|
||||||
|
changed_when: false
|
||||||
|
failed_when: >-
|
||||||
|
cloud_init_wait.rc not in [0, 2] or
|
||||||
|
(
|
||||||
|
'status: done' not in cloud_init_wait.stdout and
|
||||||
|
'status: disabled' not in cloud_init_wait.stdout
|
||||||
|
)
|
||||||
|
when: cloud_init_binary.rc == 0
|
||||||
|
|
||||||
- name: Update apt cache
|
- name: Update apt cache
|
||||||
apt:
|
apt:
|
||||||
update_cache: true
|
update_cache: true
|
||||||
cache_valid_time: 3600
|
cache_valid_time: 3600
|
||||||
|
lock_timeout: 600
|
||||||
|
|
||||||
- name: Upgrade packages
|
- name: Upgrade packages
|
||||||
apt:
|
apt:
|
||||||
upgrade: dist
|
upgrade: dist
|
||||||
|
lock_timeout: 600
|
||||||
when: common_upgrade_packages | default(false)
|
when: common_upgrade_packages | default(false)
|
||||||
|
|
||||||
- name: Install required packages
|
- name: Install required packages
|
||||||
@@ -19,18 +39,27 @@
|
|||||||
- lsb-release
|
- lsb-release
|
||||||
- software-properties-common
|
- software-properties-common
|
||||||
- jq
|
- jq
|
||||||
|
- nfs-common
|
||||||
- htop
|
- htop
|
||||||
- vim
|
- vim
|
||||||
state: present
|
state: present
|
||||||
|
lock_timeout: 600
|
||||||
|
|
||||||
|
- name: Check active swap
|
||||||
|
command: swapon --noheadings
|
||||||
|
register: active_swap
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
|
|
||||||
- name: Disable swap
|
- name: Disable swap
|
||||||
command: swapoff -a
|
command: swapoff -a
|
||||||
changed_when: true
|
changed_when: true
|
||||||
|
when: active_swap.stdout | trim | length > 0
|
||||||
|
|
||||||
- name: Remove swap from fstab
|
- name: Remove swap from fstab
|
||||||
mount:
|
lineinfile:
|
||||||
name: swap
|
path: /etc/fstab
|
||||||
fstype: swap
|
regexp: '^\s*[^#]\S+\s+\S+\s+swap\s+.*$'
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Load br_netfilter module
|
- name: Load br_netfilter module
|
||||||
@@ -78,9 +107,17 @@
|
|||||||
failed_when: false
|
failed_when: false
|
||||||
when: tailscale_auth_key | length > 0
|
when: tailscale_auth_key | length > 0
|
||||||
|
|
||||||
|
- name: Parse tailscale connection state
|
||||||
|
set_fact:
|
||||||
|
tailscale_backend_state: "{{ (tailscale_status.stdout | from_json).BackendState | default('') }}"
|
||||||
|
when:
|
||||||
|
- tailscale_auth_key | length > 0
|
||||||
|
- tailscale_status.rc == 0
|
||||||
|
- tailscale_status.stdout | length > 0
|
||||||
|
|
||||||
- name: Connect node to tailnet
|
- name: Connect node to tailnet
|
||||||
command: tailscale up --authkey {{ tailscale_auth_key }} --hostname {{ inventory_hostname }} --ssh={{ tailscale_ssh | ternary('true', 'false') }} --accept-routes={{ tailscale_accept_routes | ternary('true', 'false') }}
|
command: tailscale up --authkey {{ tailscale_auth_key }} --hostname {{ inventory_hostname }} --ssh={{ tailscale_ssh | ternary('true', 'false') }} --accept-routes={{ tailscale_accept_routes | ternary('true', 'false') }}
|
||||||
when:
|
when:
|
||||||
- tailscale_auth_key | length > 0
|
- tailscale_auth_key | length > 0
|
||||||
- tailscale_status.rc != 0 or '"BackendState":"Running"' not in tailscale_status.stdout
|
- tailscale_status.rc != 0 or (tailscale_backend_state | default('')) != 'Running'
|
||||||
changed_when: true
|
changed_when: true
|
||||||
|
|||||||
@@ -15,36 +15,10 @@
|
|||||||
--from-literal=dopplerToken='{{ doppler_hetznerterra_service_token }}'
|
--from-literal=dopplerToken='{{ doppler_hetznerterra_service_token }}'
|
||||||
--dry-run=client -o yaml | kubectl apply -f -
|
--dry-run=client -o yaml | kubectl apply -f -
|
||||||
changed_when: true
|
changed_when: true
|
||||||
|
no_log: true
|
||||||
- name: Check for ClusterSecretStore CRD
|
|
||||||
command: kubectl get crd clustersecretstores.external-secrets.io
|
|
||||||
register: doppler_clustersecretstore_crd
|
|
||||||
changed_when: false
|
|
||||||
failed_when: false
|
|
||||||
|
|
||||||
- name: Apply Doppler ClusterSecretStore
|
|
||||||
shell: |
|
|
||||||
cat <<'EOF' | kubectl apply -f -
|
|
||||||
apiVersion: external-secrets.io/v1
|
|
||||||
kind: ClusterSecretStore
|
|
||||||
metadata:
|
|
||||||
name: doppler-hetznerterra
|
|
||||||
spec:
|
|
||||||
provider:
|
|
||||||
doppler:
|
|
||||||
auth:
|
|
||||||
secretRef:
|
|
||||||
dopplerToken:
|
|
||||||
name: doppler-hetznerterra-service-token
|
|
||||||
key: dopplerToken
|
|
||||||
namespace: external-secrets
|
|
||||||
EOF
|
|
||||||
changed_when: true
|
|
||||||
when: doppler_clustersecretstore_crd.rc == 0
|
|
||||||
|
|
||||||
- name: Note pending Doppler ClusterSecretStore bootstrap
|
- name: Note pending Doppler ClusterSecretStore bootstrap
|
||||||
debug:
|
debug:
|
||||||
msg: >-
|
msg: >-
|
||||||
Skipping Doppler ClusterSecretStore bootstrap because the External Secrets CRD
|
Doppler service token secret is bootstrapped. The deploy workflow creates the
|
||||||
is not available yet. Re-run after External Secrets is installed.
|
ClusterSecretStore after External Secrets CRDs and webhook endpoints are ready.
|
||||||
when: doppler_clustersecretstore_crd.rc != 0
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
k3s_version: latest
|
k3s_version: v1.34.6+k3s1
|
||||||
k3s_server_url: ""
|
k3s_server_url: ""
|
||||||
k3s_token: ""
|
k3s_token: ""
|
||||||
k3s_node_ip: ""
|
k3s_node_ip: ""
|
||||||
k3s_kubelet_cloud_provider_external: true
|
k3s_kubelet_cloud_provider_external: false
|
||||||
|
k3s_flannel_iface: "{{ ansible_default_ipv4.interface | default('eth0') }}"
|
||||||
|
|||||||
@@ -1,18 +1,41 @@
|
|||||||
---
|
---
|
||||||
- name: Check if k3s agent is already installed
|
- name: Check if k3s agent service exists
|
||||||
stat:
|
stat:
|
||||||
path: /usr/local/bin/k3s-agent
|
path: /etc/systemd/system/k3s-agent.service
|
||||||
register: k3s_agent_binary
|
register: k3s_agent_service
|
||||||
|
|
||||||
|
- name: Check k3s agent service state
|
||||||
|
command: systemctl is-active k3s-agent
|
||||||
|
register: k3s_agent_service_state
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
|
when: k3s_agent_service.stat.exists
|
||||||
|
|
||||||
|
- name: Check installed k3s version
|
||||||
|
command: k3s --version
|
||||||
|
register: installed_k3s_version
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
|
when: k3s_agent_service.stat.exists
|
||||||
|
|
||||||
|
- name: Determine whether k3s agent install is needed
|
||||||
|
set_fact:
|
||||||
|
k3s_agent_install_needed: >-
|
||||||
|
{{
|
||||||
|
(not k3s_agent_service.stat.exists)
|
||||||
|
or ((k3s_agent_service_state.stdout | default('')) != 'active')
|
||||||
|
or (k3s_version != 'latest' and k3s_version not in (installed_k3s_version.stdout | default('')))
|
||||||
|
}}
|
||||||
|
|
||||||
- name: Download k3s install script
|
- name: Download k3s install script
|
||||||
get_url:
|
get_url:
|
||||||
url: https://get.k3s.io
|
url: https://get.k3s.io
|
||||||
dest: /tmp/install-k3s.sh
|
dest: /tmp/install-k3s.sh
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
when: not k3s_agent_binary.stat.exists
|
when: k3s_agent_install_needed
|
||||||
|
|
||||||
- name: Install k3s agent
|
- name: Install k3s agent
|
||||||
when: not k3s_agent_binary.stat.exists
|
when: k3s_agent_install_needed
|
||||||
block:
|
block:
|
||||||
- name: Run k3s agent install
|
- name: Run k3s agent install
|
||||||
environment:
|
environment:
|
||||||
@@ -22,33 +45,11 @@
|
|||||||
command: >-
|
command: >-
|
||||||
/tmp/install-k3s.sh agent
|
/tmp/install-k3s.sh agent
|
||||||
--node-ip {{ k3s_node_ip }}
|
--node-ip {{ k3s_node_ip }}
|
||||||
--flannel-iface=enp7s0
|
--flannel-iface={{ k3s_flannel_iface }}
|
||||||
{% if k3s_kubelet_cloud_provider_external | bool %}--kubelet-arg=cloud-provider=external{% endif %}
|
{% if k3s_kubelet_cloud_provider_external | bool %}--kubelet-arg=cloud-provider=external{% endif %}
|
||||||
args:
|
register: k3s_agent_install
|
||||||
creates: /usr/local/bin/k3s-agent
|
|
||||||
rescue:
|
|
||||||
- name: Show k3s-agent service status after failed install
|
|
||||||
command: systemctl status k3s-agent --no-pager
|
|
||||||
register: k3s_agent_status_after_install
|
|
||||||
changed_when: false
|
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
|
||||||
- name: Show recent k3s-agent logs after failed install
|
|
||||||
command: journalctl -u k3s-agent -n 120 --no-pager
|
|
||||||
register: k3s_agent_journal_after_install
|
|
||||||
changed_when: false
|
|
||||||
failed_when: false
|
|
||||||
|
|
||||||
- name: Fail with k3s-agent diagnostics
|
|
||||||
fail:
|
|
||||||
msg: |
|
|
||||||
k3s agent install failed on {{ inventory_hostname }}.
|
|
||||||
Service status:
|
|
||||||
{{ k3s_agent_status_after_install.stdout | default('n/a') }}
|
|
||||||
|
|
||||||
Recent logs:
|
|
||||||
{{ k3s_agent_journal_after_install.stdout | default('n/a') }}
|
|
||||||
|
|
||||||
- name: Wait for k3s agent to be ready
|
- name: Wait for k3s agent to be ready
|
||||||
command: systemctl is-active k3s-agent
|
command: systemctl is-active k3s-agent
|
||||||
register: agent_status
|
register: agent_status
|
||||||
@@ -56,3 +57,34 @@
|
|||||||
retries: 30
|
retries: 30
|
||||||
delay: 10
|
delay: 10
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Show k3s-agent service status on failure
|
||||||
|
command: systemctl status k3s-agent --no-pager
|
||||||
|
register: k3s_agent_status
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
|
when: agent_status is failed
|
||||||
|
|
||||||
|
- name: Show recent k3s-agent logs on failure
|
||||||
|
command: journalctl -u k3s-agent -n 120 --no-pager
|
||||||
|
register: k3s_agent_journal
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
|
when: agent_status is failed
|
||||||
|
|
||||||
|
- name: Fail with k3s-agent diagnostics
|
||||||
|
fail:
|
||||||
|
msg: |
|
||||||
|
k3s agent failed to become ready on {{ inventory_hostname }}.
|
||||||
|
Install stdout:
|
||||||
|
{{ k3s_agent_install.stdout | default('n/a') }}
|
||||||
|
|
||||||
|
Install stderr:
|
||||||
|
{{ k3s_agent_install.stderr | default('n/a') }}
|
||||||
|
|
||||||
|
Service status:
|
||||||
|
{{ k3s_agent_status.stdout | default('n/a') }}
|
||||||
|
|
||||||
|
Recent logs:
|
||||||
|
{{ k3s_agent_journal.stdout | default('n/a') }}
|
||||||
|
when: agent_status is failed
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
---
|
---
|
||||||
k3s_version: latest
|
k3s_version: v1.34.6+k3s1
|
||||||
k3s_token: ""
|
k3s_token: ""
|
||||||
k3s_node_ip: ""
|
k3s_node_ip: ""
|
||||||
k3s_primary_public_ip: ""
|
k3s_primary_public_ip: ""
|
||||||
k3s_disable_embedded_ccm: true
|
k3s_disable_embedded_ccm: false
|
||||||
k3s_disable_servicelb: true
|
k3s_disable_servicelb: true
|
||||||
k3s_kubelet_cloud_provider_external: true
|
k3s_kubelet_cloud_provider_external: false
|
||||||
|
k3s_flannel_iface: "{{ ansible_default_ipv4.interface | default('eth0') }}"
|
||||||
# Load Balancer endpoint for HA cluster joins (set in inventory)
|
# Load Balancer endpoint for HA cluster joins (set in inventory)
|
||||||
kube_api_endpoint: ""
|
kube_api_endpoint: ""
|
||||||
# Tailscale DNS names for control planes (to enable tailnet access)
|
# Tailscale DNS names for control planes (to enable tailnet access)
|
||||||
|
|||||||
@@ -11,9 +11,21 @@
|
|||||||
failed_when: false
|
failed_when: false
|
||||||
when: k3s_service.stat.exists
|
when: k3s_service.stat.exists
|
||||||
|
|
||||||
|
- name: Check installed k3s version
|
||||||
|
command: k3s --version
|
||||||
|
register: installed_k3s_version
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
|
when: k3s_service.stat.exists
|
||||||
|
|
||||||
- name: Determine whether k3s install is needed
|
- name: Determine whether k3s install is needed
|
||||||
set_fact:
|
set_fact:
|
||||||
k3s_install_needed: "{{ (not k3s_service.stat.exists) or ((k3s_service_state.stdout | default('')) != 'active') }}"
|
k3s_install_needed: >-
|
||||||
|
{{
|
||||||
|
(not k3s_service.stat.exists)
|
||||||
|
or ((k3s_service_state.stdout | default('')) != 'active')
|
||||||
|
or (k3s_version != 'latest' and k3s_version not in (installed_k3s_version.stdout | default('')))
|
||||||
|
}}
|
||||||
|
|
||||||
- name: Wait for API endpoint on 6443 (secondary only)
|
- name: Wait for API endpoint on 6443 (secondary only)
|
||||||
wait_for:
|
wait_for:
|
||||||
@@ -61,7 +73,7 @@
|
|||||||
--cluster-init
|
--cluster-init
|
||||||
--advertise-address={{ k3s_primary_ip }}
|
--advertise-address={{ k3s_primary_ip }}
|
||||||
--node-ip={{ k3s_node_ip }}
|
--node-ip={{ k3s_node_ip }}
|
||||||
--flannel-iface=enp7s0
|
--flannel-iface={{ k3s_flannel_iface }}
|
||||||
--tls-san={{ k3s_primary_ip }}
|
--tls-san={{ k3s_primary_ip }}
|
||||||
--tls-san={{ k3s_primary_public_ip }}
|
--tls-san={{ k3s_primary_public_ip }}
|
||||||
--tls-san={{ kube_api_endpoint }}
|
--tls-san={{ kube_api_endpoint }}
|
||||||
@@ -69,6 +81,8 @@
|
|||||||
{% if k3s_disable_embedded_ccm | bool %}--disable-cloud-controller{% endif %}
|
{% if k3s_disable_embedded_ccm | bool %}--disable-cloud-controller{% endif %}
|
||||||
{% if k3s_disable_servicelb | bool %}--disable=servicelb{% endif %}
|
{% if k3s_disable_servicelb | bool %}--disable=servicelb{% endif %}
|
||||||
{% if k3s_kubelet_cloud_provider_external | bool %}--kubelet-arg=cloud-provider=external{% endif %}
|
{% if k3s_kubelet_cloud_provider_external | bool %}--kubelet-arg=cloud-provider=external{% endif %}
|
||||||
|
register: primary_install
|
||||||
|
failed_when: false
|
||||||
when:
|
when:
|
||||||
- k3s_install_needed
|
- k3s_install_needed
|
||||||
- k3s_primary | default(false)
|
- k3s_primary | default(false)
|
||||||
@@ -87,41 +101,13 @@
|
|||||||
--server https://{{ k3s_join_endpoint | default(k3s_primary_ip) }}:6443
|
--server https://{{ k3s_join_endpoint | default(k3s_primary_ip) }}:6443
|
||||||
--advertise-address={{ k3s_node_ip }}
|
--advertise-address={{ k3s_node_ip }}
|
||||||
--node-ip={{ k3s_node_ip }}
|
--node-ip={{ k3s_node_ip }}
|
||||||
--flannel-iface=enp7s0
|
--flannel-iface={{ k3s_flannel_iface }}
|
||||||
{% if k3s_disable_embedded_ccm | bool %}--disable-cloud-controller{% endif %}
|
{% if k3s_disable_embedded_ccm | bool %}--disable-cloud-controller{% endif %}
|
||||||
{% if k3s_disable_servicelb | bool %}--disable=servicelb{% endif %}
|
{% if k3s_disable_servicelb | bool %}--disable=servicelb{% endif %}
|
||||||
{% if k3s_kubelet_cloud_provider_external | bool %}--kubelet-arg=cloud-provider=external{% endif %}
|
{% if k3s_kubelet_cloud_provider_external | bool %}--kubelet-arg=cloud-provider=external{% endif %}
|
||||||
register: secondary_install
|
register: secondary_install
|
||||||
|
|
||||||
rescue:
|
|
||||||
- name: Show k3s service status after failed secondary install
|
|
||||||
command: systemctl status k3s --no-pager
|
|
||||||
register: k3s_status_after_install
|
|
||||||
changed_when: false
|
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
|
||||||
- name: Show recent k3s logs after failed secondary install
|
|
||||||
command: journalctl -u k3s -n 120 --no-pager
|
|
||||||
register: k3s_journal_after_install
|
|
||||||
changed_when: false
|
|
||||||
failed_when: false
|
|
||||||
|
|
||||||
- name: Fail with secondary install diagnostics
|
|
||||||
fail:
|
|
||||||
msg: |
|
|
||||||
Secondary k3s install failed on {{ inventory_hostname }}.
|
|
||||||
Install stdout:
|
|
||||||
{{ secondary_install.stdout | default('n/a') }}
|
|
||||||
|
|
||||||
Install stderr:
|
|
||||||
{{ secondary_install.stderr | default('n/a') }}
|
|
||||||
|
|
||||||
Service status:
|
|
||||||
{{ k3s_status_after_install.stdout | default('n/a') }}
|
|
||||||
|
|
||||||
Recent logs:
|
|
||||||
{{ k3s_journal_after_install.stdout | default('n/a') }}
|
|
||||||
|
|
||||||
- name: Wait for k3s to be ready
|
- name: Wait for k3s to be ready
|
||||||
command: "{{ (k3s_primary | default(false)) | ternary('kubectl get nodes', 'systemctl is-active k3s') }}"
|
command: "{{ (k3s_primary | default(false)) | ternary('kubectl get nodes', 'systemctl is-active k3s') }}"
|
||||||
register: k3s_ready
|
register: k3s_ready
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
kube_vip_version: v1.1.2
|
||||||
|
kube_vip_interface: "{{ ansible_default_ipv4.interface | default('eth0') }}"
|
||||||
|
kube_vip_address: "{{ kube_api_endpoint }}"
|
||||||
|
kube_vip_prepull_images:
|
||||||
|
- docker.io/rancher/mirrored-pause:3.6
|
||||||
|
- ghcr.io/kube-vip/kube-vip:{{ kube_vip_version }}
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
---
|
||||||
|
- name: Check for runner-provided kube-vip image archive
|
||||||
|
stat:
|
||||||
|
path: "{{ playbook_dir }}/../outputs/kube-vip-bootstrap.tar"
|
||||||
|
delegate_to: localhost
|
||||||
|
become: false
|
||||||
|
register: kube_vip_bootstrap_archive
|
||||||
|
|
||||||
|
- name: Copy runner-provided kube-vip image archive
|
||||||
|
copy:
|
||||||
|
src: "{{ playbook_dir }}/../outputs/kube-vip-bootstrap.tar"
|
||||||
|
dest: /tmp/kube-vip-bootstrap.tar
|
||||||
|
mode: "0644"
|
||||||
|
when: kube_vip_bootstrap_archive.stat.exists
|
||||||
|
|
||||||
|
- name: Import runner-provided kube-vip image archive
|
||||||
|
command: /usr/local/bin/ctr -n k8s.io images import /tmp/kube-vip-bootstrap.tar
|
||||||
|
changed_when: false
|
||||||
|
when: kube_vip_bootstrap_archive.stat.exists
|
||||||
|
|
||||||
|
- name: Pre-pull kube-vip bootstrap images into containerd
|
||||||
|
shell: |
|
||||||
|
if /usr/local/bin/ctr -n k8s.io images ls -q | grep -Fx -- "{{ item }}" >/dev/null; then
|
||||||
|
echo "already present"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
for attempt in 1 2 3; do
|
||||||
|
if timeout 120s /usr/local/bin/ctr -n k8s.io images pull "{{ item }}"; then
|
||||||
|
echo "pulled image"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
args:
|
||||||
|
executable: /bin/bash
|
||||||
|
register: kube_vip_image_pull
|
||||||
|
loop: "{{ kube_vip_prepull_images }}"
|
||||||
|
changed_when: "'pulled image' in kube_vip_image_pull.stdout"
|
||||||
|
failed_when: false
|
||||||
|
|
||||||
|
- name: Report kube-vip images that did not pre-pull after retries
|
||||||
|
debug:
|
||||||
|
msg: >-
|
||||||
|
Best-effort kube-vip image pre-pull did not complete for {{ item.item }} after
|
||||||
|
3 attempt(s): {{ item.stderr | default('no stderr') }}
|
||||||
|
loop: "{{ kube_vip_image_pull.results | default([]) }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.item }}"
|
||||||
|
when: item.rc is defined and item.rc != 0
|
||||||
|
|
||||||
|
- name: Render kube-vip control plane manifest
|
||||||
|
template:
|
||||||
|
src: kube-vip-control-plane.yaml.j2
|
||||||
|
dest: /tmp/kube-vip-control-plane.yaml
|
||||||
|
mode: "0644"
|
||||||
|
|
||||||
|
- name: Apply kube-vip control plane manifest
|
||||||
|
command: kubectl apply -f /tmp/kube-vip-control-plane.yaml
|
||||||
|
changed_when: true
|
||||||
|
|
||||||
|
- name: Wait for local kube-vip pod to be ready
|
||||||
|
shell: >-
|
||||||
|
kubectl -n kube-system get pods
|
||||||
|
-l app.kubernetes.io/name=kube-vip
|
||||||
|
--field-selector spec.nodeName={{ inventory_hostname }}
|
||||||
|
-o jsonpath='{.items[0].status.conditions[?(@.type=="Ready")].status}'
|
||||||
|
register: kube_vip_pod_ready
|
||||||
|
changed_when: false
|
||||||
|
until: kube_vip_pod_ready.stdout == "True"
|
||||||
|
retries: 30
|
||||||
|
delay: 10
|
||||||
|
|
||||||
|
- name: Show kube-vip pod status on failure
|
||||||
|
command: kubectl -n kube-system get pods -l app.kubernetes.io/name=kube-vip -o wide
|
||||||
|
register: kube_vip_pods
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
|
when: kube_vip_pod_ready is failed
|
||||||
|
|
||||||
|
- name: Describe kube-vip pod on failure
|
||||||
|
shell: >-
|
||||||
|
kubectl -n kube-system describe pod
|
||||||
|
$(kubectl -n kube-system get pods -l app.kubernetes.io/name=kube-vip --field-selector spec.nodeName={{ inventory_hostname }} -o jsonpath='{.items[0].metadata.name}')
|
||||||
|
register: kube_vip_pod_describe
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
|
when: kube_vip_pod_ready is failed
|
||||||
|
|
||||||
|
- name: Fail with kube-vip diagnostics
|
||||||
|
fail:
|
||||||
|
msg: |
|
||||||
|
kube-vip failed to become ready on {{ inventory_hostname }}.
|
||||||
|
Pods:
|
||||||
|
{{ kube_vip_pods.stdout | default('n/a') }}
|
||||||
|
|
||||||
|
Describe:
|
||||||
|
{{ kube_vip_pod_describe.stdout | default('n/a') }}
|
||||||
|
when: kube_vip_pod_ready is failed
|
||||||
|
|
||||||
|
- name: Wait for API VIP on 6443
|
||||||
|
wait_for:
|
||||||
|
host: "{{ kube_vip_address }}"
|
||||||
|
port: 6443
|
||||||
|
state: started
|
||||||
|
timeout: 180
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: kube-vip
|
||||||
|
namespace: kube-system
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRole
|
||||||
|
metadata:
|
||||||
|
name: system:kube-vip-role
|
||||||
|
rules:
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources: ["services/status"]
|
||||||
|
verbs: ["update"]
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources: ["services", "endpoints"]
|
||||||
|
verbs: ["list", "get", "watch", "update"]
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources: ["nodes"]
|
||||||
|
verbs: ["list", "get", "watch", "update", "patch"]
|
||||||
|
- apiGroups: ["coordination.k8s.io"]
|
||||||
|
resources: ["leases"]
|
||||||
|
verbs: ["list", "get", "watch", "update", "create"]
|
||||||
|
- apiGroups: ["discovery.k8s.io"]
|
||||||
|
resources: ["endpointslices"]
|
||||||
|
verbs: ["list", "get", "watch", "update"]
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources: ["pods"]
|
||||||
|
verbs: ["list"]
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
metadata:
|
||||||
|
name: system:kube-vip-binding
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: system:kube-vip-role
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: kube-vip
|
||||||
|
namespace: kube-system
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: DaemonSet
|
||||||
|
metadata:
|
||||||
|
name: kube-vip
|
||||||
|
namespace: kube-system
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: kube-vip
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: kube-vip
|
||||||
|
spec:
|
||||||
|
serviceAccountName: kube-vip
|
||||||
|
hostNetwork: true
|
||||||
|
affinity:
|
||||||
|
nodeAffinity:
|
||||||
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
nodeSelectorTerms:
|
||||||
|
- matchExpressions:
|
||||||
|
- key: node-role.kubernetes.io/control-plane
|
||||||
|
operator: Exists
|
||||||
|
tolerations:
|
||||||
|
- key: node-role.kubernetes.io/control-plane
|
||||||
|
operator: Exists
|
||||||
|
effect: NoSchedule
|
||||||
|
- key: node-role.kubernetes.io/master
|
||||||
|
operator: Exists
|
||||||
|
effect: NoSchedule
|
||||||
|
containers:
|
||||||
|
- name: kube-vip
|
||||||
|
image: ghcr.io/kube-vip/kube-vip:{{ kube_vip_version }}
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
args:
|
||||||
|
- manager
|
||||||
|
env:
|
||||||
|
- name: vip_arp
|
||||||
|
value: "true"
|
||||||
|
- name: port
|
||||||
|
value: "6443"
|
||||||
|
- name: vip_interface
|
||||||
|
value: {{ kube_vip_interface | quote }}
|
||||||
|
- name: vip_subnet
|
||||||
|
value: "32"
|
||||||
|
- name: cp_enable
|
||||||
|
value: "true"
|
||||||
|
- name: cp_namespace
|
||||||
|
value: kube-system
|
||||||
|
- name: vip_ddns
|
||||||
|
value: "false"
|
||||||
|
- name: vip_leaderelection
|
||||||
|
value: "true"
|
||||||
|
- name: vip_leaseduration
|
||||||
|
value: "5"
|
||||||
|
- name: vip_renewdeadline
|
||||||
|
value: "3"
|
||||||
|
- name: vip_retryperiod
|
||||||
|
value: "1"
|
||||||
|
- name: address
|
||||||
|
value: {{ kube_vip_address | quote }}
|
||||||
|
securityContext:
|
||||||
|
capabilities:
|
||||||
|
add:
|
||||||
|
- NET_ADMIN
|
||||||
|
- NET_RAW
|
||||||
|
- SYS_TIME
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
rancher_images_to_prepull:
|
||||||
|
- docker.io/rancher/rancher:v2.13.3
|
||||||
|
- docker.io/rancher/rancher-webhook:v0.9.3
|
||||||
|
- docker.io/rancher/system-upgrade-controller:v0.17.0
|
||||||
|
- docker.io/rancher/shell:v0.6.2
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
---
|
||||||
|
- name: Pre-pull Rancher images into containerd
|
||||||
|
shell: |
|
||||||
|
if /usr/local/bin/ctr -n k8s.io images ls -q | grep -Fx -- "{{ item }}" >/dev/null; then
|
||||||
|
echo "already present"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
for attempt in 1 2 3; do
|
||||||
|
if timeout 120s /usr/local/bin/ctr -n k8s.io images pull "{{ item }}"; then
|
||||||
|
echo "pulled image"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
args:
|
||||||
|
executable: /bin/bash
|
||||||
|
register: rancher_image_pull
|
||||||
|
loop: "{{ rancher_images_to_prepull }}"
|
||||||
|
changed_when: "'pulled image' in rancher_image_pull.stdout"
|
||||||
|
failed_when: false
|
||||||
|
|
||||||
|
- name: Report Rancher images that did not pre-pull after retries
|
||||||
|
debug:
|
||||||
|
msg: >-
|
||||||
|
Best-effort Rancher image pre-pull did not complete for {{ item.item }} after
|
||||||
|
3 attempt(s): {{ item.stderr | default('no stderr') }}
|
||||||
|
loop: "{{ rancher_image_pull.results | default([]) }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.item }}"
|
||||||
|
when: item.rc is defined and item.rc != 0
|
||||||
@@ -13,18 +13,19 @@
|
|||||||
- name: Find stale devices matching reserved hostnames
|
- name: Find stale devices matching reserved hostnames
|
||||||
set_fact:
|
set_fact:
|
||||||
stale_devices: >-
|
stale_devices: >-
|
||||||
{{ ts_devices.json.devices | default([])
|
{{ (ts_devices.json.devices | default([])
|
||||||
| selectattr('hostname', 'defined')
|
| selectattr('hostname', 'defined')
|
||||||
| selectattr('hostname', 'in', tailscale_reserved_hostnames)
|
| selectattr('hostname', 'in', tailscale_reserved_hostnames)
|
||||||
| rejectattr('online', 'defined')
|
| selectattr('connectedToControl', 'defined')
|
||||||
| list
|
| rejectattr('connectedToControl', 'equalto', true)
|
||||||
+
|
| list
|
||||||
ts_devices.json.devices | default([])
|
+
|
||||||
| selectattr('hostname', 'defined')
|
ts_devices.json.devices | default([])
|
||||||
| selectattr('hostname', 'in', tailscale_reserved_hostnames)
|
| selectattr('hostname', 'defined')
|
||||||
| selectattr('online', 'defined')
|
| selectattr('hostname', 'in', tailscale_reserved_hostnames)
|
||||||
| rejectattr('online', 'equalto', true)
|
| selectattr('online', 'defined')
|
||||||
| list }}
|
| rejectattr('online', 'equalto', true)
|
||||||
|
| list) | unique(attribute='id') | list }}
|
||||||
|
|
||||||
- name: Delete stale devices
|
- name: Delete stale devices
|
||||||
uri:
|
uri:
|
||||||
|
|||||||
+70
-4
@@ -1,14 +1,26 @@
|
|||||||
---
|
---
|
||||||
|
- name: Clean up stale Tailscale cluster node devices
|
||||||
|
hosts: localhost
|
||||||
|
connection: local
|
||||||
|
vars:
|
||||||
|
tailscale_reserved_hostnames: "{{ groups['cluster'] | default([]) | list }}"
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- tailscale-cleanup
|
||||||
|
|
||||||
- name: Bootstrap Kubernetes cluster
|
- name: Bootstrap Kubernetes cluster
|
||||||
hosts: cluster
|
hosts: cluster
|
||||||
become: true
|
become: true
|
||||||
gather_facts: true
|
gather_facts: false
|
||||||
|
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
- name: Wait for SSH
|
- name: Wait for SSH
|
||||||
wait_for_connection:
|
wait_for_connection:
|
||||||
delay: 10
|
delay: 10
|
||||||
timeout: 300
|
timeout: 600
|
||||||
|
|
||||||
|
- name: Gather facts after SSH is reachable
|
||||||
|
setup:
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- common
|
- common
|
||||||
@@ -57,12 +69,12 @@
|
|||||||
roles:
|
roles:
|
||||||
- addon-secrets-bootstrap
|
- addon-secrets-bootstrap
|
||||||
|
|
||||||
- name: Deploy Hetzner CCM (required for workers with external cloud provider)
|
- name: Deploy kube-vip for API HA
|
||||||
hosts: control_plane[0]
|
hosts: control_plane[0]
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- ccm-deploy
|
- kube-vip-deploy
|
||||||
|
|
||||||
- name: Setup secondary control planes
|
- name: Setup secondary control planes
|
||||||
hosts: control_plane[1:]
|
hosts: control_plane[1:]
|
||||||
@@ -80,6 +92,39 @@
|
|||||||
roles:
|
roles:
|
||||||
- k3s-server
|
- k3s-server
|
||||||
|
|
||||||
|
- name: Export kube-vip image from primary control plane
|
||||||
|
hosts: control_plane[0]
|
||||||
|
become: true
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Export kube-vip image for secondary control planes
|
||||||
|
command: >-
|
||||||
|
/usr/local/bin/ctr -n k8s.io images export
|
||||||
|
/tmp/kube-vip-bootstrap.tar
|
||||||
|
ghcr.io/kube-vip/kube-vip:v1.1.2
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Fetch kube-vip image archive
|
||||||
|
fetch:
|
||||||
|
src: /tmp/kube-vip-bootstrap.tar
|
||||||
|
dest: ../outputs/kube-vip-bootstrap.tar
|
||||||
|
flat: true
|
||||||
|
|
||||||
|
- name: Seed kube-vip image on secondary control planes
|
||||||
|
hosts: control_plane[1:]
|
||||||
|
become: true
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Copy kube-vip image archive
|
||||||
|
copy:
|
||||||
|
src: ../outputs/kube-vip-bootstrap.tar
|
||||||
|
dest: /tmp/kube-vip-bootstrap.tar
|
||||||
|
mode: "0644"
|
||||||
|
|
||||||
|
- name: Import kube-vip image into containerd
|
||||||
|
command: /usr/local/bin/ctr -n k8s.io images import /tmp/kube-vip-bootstrap.tar
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
- name: Setup workers
|
- name: Setup workers
|
||||||
hosts: workers
|
hosts: workers
|
||||||
become: true
|
become: true
|
||||||
@@ -93,6 +138,21 @@
|
|||||||
roles:
|
roles:
|
||||||
- k3s-agent
|
- k3s-agent
|
||||||
|
|
||||||
|
- name: Pre-pull bootstrap control-plane images
|
||||||
|
hosts: control_plane[0]
|
||||||
|
become: true
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- bootstrap-image-prepull
|
||||||
|
|
||||||
|
- name: Pre-pull Rancher bootstrap images
|
||||||
|
hosts: workers
|
||||||
|
become: true
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- role: rancher-image-prepull
|
||||||
|
when: rancher_image_prepull_enabled | default(false) | bool
|
||||||
|
|
||||||
- name: Deploy observability stack
|
- name: Deploy observability stack
|
||||||
hosts: control_plane[0]
|
hosts: control_plane[0]
|
||||||
become: true
|
become: true
|
||||||
@@ -148,10 +208,16 @@
|
|||||||
hosts: localhost
|
hosts: localhost
|
||||||
connection: local
|
connection: local
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: Check whether kubeconfig was fetched
|
||||||
|
stat:
|
||||||
|
path: ../outputs/kubeconfig
|
||||||
|
register: kubeconfig_file
|
||||||
|
|
||||||
- name: Update kubeconfig server address
|
- name: Update kubeconfig server address
|
||||||
command: |
|
command: |
|
||||||
sed -i 's/127.0.0.1/{{ hostvars[groups["control_plane"][0]]["ansible_host"] }}/g' ../outputs/kubeconfig
|
sed -i 's/127.0.0.1/{{ hostvars[groups["control_plane"][0]]["ansible_host"] }}/g' ../outputs/kubeconfig
|
||||||
changed_when: true
|
changed_when: true
|
||||||
|
when: kubeconfig_file.stat.exists
|
||||||
|
|
||||||
- name: Display success message
|
- name: Display success message
|
||||||
debug:
|
debug:
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
kubernetes.io/hostname: k8s-cluster-cp-1
|
kubernetes.io/hostname: k8s-cluster-cp-1
|
||||||
|
tolerations:
|
||||||
|
- key: node-role.kubernetes.io/control-plane
|
||||||
|
operator: Exists
|
||||||
|
effect: NoSchedule
|
||||||
---
|
---
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
@@ -19,6 +23,10 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
kubernetes.io/hostname: k8s-cluster-cp-1
|
kubernetes.io/hostname: k8s-cluster-cp-1
|
||||||
|
tolerations:
|
||||||
|
- key: node-role.kubernetes.io/control-plane
|
||||||
|
operator: Exists
|
||||||
|
effect: NoSchedule
|
||||||
---
|
---
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
@@ -30,6 +38,10 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
kubernetes.io/hostname: k8s-cluster-cp-1
|
kubernetes.io/hostname: k8s-cluster-cp-1
|
||||||
|
tolerations:
|
||||||
|
- key: node-role.kubernetes.io/control-plane
|
||||||
|
operator: Exists
|
||||||
|
effect: NoSchedule
|
||||||
---
|
---
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
@@ -41,3 +53,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
kubernetes.io/hostname: k8s-cluster-cp-1
|
kubernetes.io/hostname: k8s-cluster-cp-1
|
||||||
|
tolerations:
|
||||||
|
- key: node-role.kubernetes.io/control-plane
|
||||||
|
operator: Exists
|
||||||
|
effect: NoSchedule
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: hcloud-cloud-controller-manager
|
|
||||||
namespace: flux-system
|
|
||||||
spec:
|
|
||||||
interval: 10m
|
|
||||||
targetNamespace: kube-system
|
|
||||||
chart:
|
|
||||||
spec:
|
|
||||||
chart: hcloud-cloud-controller-manager
|
|
||||||
version: 1.30.1
|
|
||||||
sourceRef:
|
|
||||||
kind: HelmRepository
|
|
||||||
name: hcloud
|
|
||||||
namespace: flux-system
|
|
||||||
install:
|
|
||||||
createNamespace: true
|
|
||||||
remediation:
|
|
||||||
retries: 3
|
|
||||||
upgrade:
|
|
||||||
remediation:
|
|
||||||
retries: 3
|
|
||||||
values:
|
|
||||||
selectorLabels:
|
|
||||||
app: hcloud-cloud-controller-manager
|
|
||||||
args:
|
|
||||||
secure-port: "0"
|
|
||||||
networking:
|
|
||||||
enabled: true
|
|
||||||
nodeSelector:
|
|
||||||
kubernetes.io/hostname: k8s-cluster-cp-1
|
|
||||||
additionalTolerations:
|
|
||||||
- key: node-role.kubernetes.io/control-plane
|
|
||||||
operator: Exists
|
|
||||||
effect: NoSchedule
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
apiVersion: source.toolkit.fluxcd.io/v1
|
|
||||||
kind: HelmRepository
|
|
||||||
metadata:
|
|
||||||
name: hcloud
|
|
||||||
namespace: flux-system
|
|
||||||
spec:
|
|
||||||
interval: 1h
|
|
||||||
url: https://charts.hetzner.cloud
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
|
||||||
kind: Kustomization
|
|
||||||
resources:
|
|
||||||
- helmrepository-hcloud.yaml
|
|
||||||
- helmrelease-hcloud-ccm.yaml
|
|
||||||
@@ -5,14 +5,14 @@ metadata:
|
|||||||
namespace: flux-system
|
namespace: flux-system
|
||||||
spec:
|
spec:
|
||||||
interval: 10m
|
interval: 10m
|
||||||
|
timeout: 15m
|
||||||
targetNamespace: cert-manager
|
targetNamespace: cert-manager
|
||||||
chart:
|
chart:
|
||||||
spec:
|
spec:
|
||||||
chart: cert-manager
|
chart: ./infrastructure/charts/cert-manager
|
||||||
version: "v1.17.2"
|
|
||||||
sourceRef:
|
sourceRef:
|
||||||
kind: HelmRepository
|
kind: GitRepository
|
||||||
name: jetstack
|
name: platform
|
||||||
namespace: flux-system
|
namespace: flux-system
|
||||||
install:
|
install:
|
||||||
createNamespace: true
|
createNamespace: true
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
apiVersion: source.toolkit.fluxcd.io/v1
|
|
||||||
kind: HelmRepository
|
|
||||||
metadata:
|
|
||||||
name: jetstack
|
|
||||||
namespace: flux-system
|
|
||||||
spec:
|
|
||||||
interval: 1h
|
|
||||||
url: https://charts.jetstack.io
|
|
||||||
@@ -2,5 +2,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1
|
|||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- namespace.yaml
|
- namespace.yaml
|
||||||
- helmrepository-cert-manager.yaml
|
|
||||||
- helmrelease-cert-manager.yaml
|
- helmrelease-cert-manager.yaml
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: hcloud-csi
|
|
||||||
namespace: flux-system
|
|
||||||
spec:
|
|
||||||
interval: 10m
|
|
||||||
targetNamespace: kube-system
|
|
||||||
chart:
|
|
||||||
spec:
|
|
||||||
chart: hcloud-csi
|
|
||||||
version: 2.20.0
|
|
||||||
sourceRef:
|
|
||||||
kind: HelmRepository
|
|
||||||
name: hcloud
|
|
||||||
namespace: flux-system
|
|
||||||
install:
|
|
||||||
createNamespace: true
|
|
||||||
remediation:
|
|
||||||
retries: 3
|
|
||||||
upgrade:
|
|
||||||
remediation:
|
|
||||||
retries: 3
|
|
||||||
values:
|
|
||||||
controller:
|
|
||||||
nodeSelector:
|
|
||||||
kubernetes.io/hostname: k8s-cluster-cp-1
|
|
||||||
tolerations:
|
|
||||||
- key: node-role.kubernetes.io/control-plane
|
|
||||||
operator: Exists
|
|
||||||
effect: NoSchedule
|
|
||||||
hcloudVolumeDefaultLocation: nbg1
|
|
||||||
storageClasses:
|
|
||||||
- name: hcloud-volumes
|
|
||||||
defaultStorageClass: true
|
|
||||||
reclaimPolicy: Delete
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
apiVersion: source.toolkit.fluxcd.io/v1
|
|
||||||
kind: HelmRepository
|
|
||||||
metadata:
|
|
||||||
name: hcloud
|
|
||||||
namespace: flux-system
|
|
||||||
spec:
|
|
||||||
interval: 1h
|
|
||||||
url: https://charts.hetzner.cloud
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
|
||||||
kind: Kustomization
|
|
||||||
resources:
|
|
||||||
- helmrepository-hcloud.yaml
|
|
||||||
- helmrelease-hcloud-csi.yaml
|
|
||||||
@@ -6,14 +6,10 @@ metadata:
|
|||||||
spec:
|
spec:
|
||||||
interval: 10m
|
interval: 10m
|
||||||
targetNamespace: external-secrets
|
targetNamespace: external-secrets
|
||||||
chart:
|
chartRef:
|
||||||
spec:
|
kind: OCIRepository
|
||||||
chart: external-secrets
|
name: external-secrets
|
||||||
version: 2.1.0
|
namespace: flux-system
|
||||||
sourceRef:
|
|
||||||
kind: HelmRepository
|
|
||||||
name: external-secrets
|
|
||||||
namespace: flux-system
|
|
||||||
install:
|
install:
|
||||||
createNamespace: true
|
createNamespace: true
|
||||||
remediation:
|
remediation:
|
||||||
@@ -23,13 +19,25 @@ spec:
|
|||||||
retries: 3
|
retries: 3
|
||||||
values:
|
values:
|
||||||
installCRDs: true
|
installCRDs: true
|
||||||
|
image:
|
||||||
|
repository: oci.external-secrets.io/external-secrets/external-secrets
|
||||||
|
tag: v2.1.0
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
kubernetes.io/hostname: k8s-cluster-cp-1
|
kubernetes.io/hostname: k8s-cluster-cp-1
|
||||||
webhook:
|
webhook:
|
||||||
failurePolicy: Ignore
|
failurePolicy: Ignore
|
||||||
|
image:
|
||||||
|
repository: oci.external-secrets.io/external-secrets/external-secrets
|
||||||
|
tag: v2.1.0
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
kubernetes.io/hostname: k8s-cluster-cp-1
|
kubernetes.io/hostname: k8s-cluster-cp-1
|
||||||
certController:
|
certController:
|
||||||
|
image:
|
||||||
|
repository: oci.external-secrets.io/external-secrets/external-secrets
|
||||||
|
tag: v2.1.0
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
kubernetes.io/hostname: k8s-cluster-cp-1
|
kubernetes.io/hostname: k8s-cluster-cp-1
|
||||||
serviceMonitor:
|
serviceMonitor:
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
apiVersion: source.toolkit.fluxcd.io/v1
|
|
||||||
kind: HelmRepository
|
|
||||||
metadata:
|
|
||||||
name: external-secrets
|
|
||||||
namespace: flux-system
|
|
||||||
spec:
|
|
||||||
interval: 1h
|
|
||||||
url: https://charts.external-secrets.io
|
|
||||||
@@ -2,5 +2,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
|
|||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- namespace.yaml
|
- namespace.yaml
|
||||||
- helmrepository-external-secrets.yaml
|
- ocirepository-external-secrets.yaml
|
||||||
- helmrelease-external-secrets.yaml
|
- helmrelease-external-secrets.yaml
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
apiVersion: source.toolkit.fluxcd.io/v1
|
||||||
|
kind: OCIRepository
|
||||||
|
metadata:
|
||||||
|
name: external-secrets
|
||||||
|
namespace: flux-system
|
||||||
|
spec:
|
||||||
|
interval: 10m
|
||||||
|
url: oci://ghcr.io/external-secrets/charts/external-secrets
|
||||||
|
ref:
|
||||||
|
tag: 2.1.0
|
||||||
|
layerSelector:
|
||||||
|
mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip
|
||||||
|
operation: copy
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
|
||||||
kind: Kustomization
|
|
||||||
metadata:
|
|
||||||
name: addon-ccm
|
|
||||||
namespace: flux-system
|
|
||||||
spec:
|
|
||||||
interval: 10m
|
|
||||||
prune: true
|
|
||||||
sourceRef:
|
|
||||||
kind: GitRepository
|
|
||||||
name: platform
|
|
||||||
path: ./infrastructure/addons/ccm
|
|
||||||
wait: true
|
|
||||||
timeout: 10m
|
|
||||||
suspend: false
|
|
||||||
@@ -11,5 +11,5 @@ spec:
|
|||||||
name: platform
|
name: platform
|
||||||
path: ./infrastructure/addons/cert-manager
|
path: ./infrastructure/addons/cert-manager
|
||||||
wait: true
|
wait: true
|
||||||
timeout: 10m
|
timeout: 20m
|
||||||
suspend: false
|
suspend: false
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
|
||||||
kind: Kustomization
|
|
||||||
metadata:
|
|
||||||
name: addon-csi
|
|
||||||
namespace: flux-system
|
|
||||||
spec:
|
|
||||||
interval: 10m
|
|
||||||
prune: true
|
|
||||||
sourceRef:
|
|
||||||
kind: GitRepository
|
|
||||||
name: platform
|
|
||||||
path: ./infrastructure/addons/csi
|
|
||||||
dependsOn:
|
|
||||||
- name: addon-ccm
|
|
||||||
wait: true
|
|
||||||
timeout: 10m
|
|
||||||
suspend: false
|
|
||||||
@@ -10,6 +10,11 @@ spec:
|
|||||||
kind: GitRepository
|
kind: GitRepository
|
||||||
name: platform
|
name: platform
|
||||||
path: ./infrastructure/addons/external-secrets
|
path: ./infrastructure/addons/external-secrets
|
||||||
wait: true
|
wait: false
|
||||||
|
healthChecks:
|
||||||
|
- apiVersion: helm.toolkit.fluxcd.io/v2
|
||||||
|
kind: HelmRelease
|
||||||
|
name: external-secrets
|
||||||
|
namespace: flux-system
|
||||||
timeout: 5m
|
timeout: 5m
|
||||||
suspend: false
|
suspend: false
|
||||||
|
|||||||
+7
-5
@@ -1,7 +1,7 @@
|
|||||||
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
metadata:
|
metadata:
|
||||||
name: addon-rancher-backup
|
name: addon-nfs-storage
|
||||||
namespace: flux-system
|
namespace: flux-system
|
||||||
spec:
|
spec:
|
||||||
interval: 10m
|
interval: 10m
|
||||||
@@ -9,10 +9,12 @@ spec:
|
|||||||
sourceRef:
|
sourceRef:
|
||||||
kind: GitRepository
|
kind: GitRepository
|
||||||
name: platform
|
name: platform
|
||||||
path: ./infrastructure/addons/rancher-backup
|
path: ./infrastructure/addons/nfs-storage
|
||||||
wait: true
|
wait: true
|
||||||
|
healthChecks:
|
||||||
|
- apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
name: nfs-subdir-external-provisioner
|
||||||
|
namespace: kube-system
|
||||||
timeout: 10m
|
timeout: 10m
|
||||||
suspend: false
|
suspend: false
|
||||||
dependsOn:
|
|
||||||
- name: addon-external-secrets
|
|
||||||
- name: addon-rancher
|
|
||||||
@@ -14,6 +14,19 @@ spec:
|
|||||||
- name: addon-external-secrets
|
- name: addon-external-secrets
|
||||||
- name: addon-tailscale-operator
|
- name: addon-tailscale-operator
|
||||||
- name: addon-tailscale-proxyclass
|
- name: addon-tailscale-proxyclass
|
||||||
wait: true
|
wait: false
|
||||||
|
healthChecks:
|
||||||
|
- apiVersion: helm.toolkit.fluxcd.io/v2
|
||||||
|
kind: HelmRelease
|
||||||
|
name: kube-prometheus-stack
|
||||||
|
namespace: flux-system
|
||||||
|
- apiVersion: helm.toolkit.fluxcd.io/v2
|
||||||
|
kind: HelmRelease
|
||||||
|
name: loki
|
||||||
|
namespace: flux-system
|
||||||
|
- apiVersion: helm.toolkit.fluxcd.io/v2
|
||||||
|
kind: HelmRelease
|
||||||
|
name: promtail
|
||||||
|
namespace: flux-system
|
||||||
timeout: 5m
|
timeout: 5m
|
||||||
suspend: false
|
suspend: false
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
|
||||||
kind: Kustomization
|
|
||||||
metadata:
|
|
||||||
name: addon-rancher-backup-config
|
|
||||||
namespace: flux-system
|
|
||||||
spec:
|
|
||||||
interval: 10m
|
|
||||||
prune: true
|
|
||||||
sourceRef:
|
|
||||||
kind: GitRepository
|
|
||||||
name: platform
|
|
||||||
path: ./infrastructure/addons/rancher-backup-config
|
|
||||||
timeout: 5m
|
|
||||||
suspend: false
|
|
||||||
dependsOn:
|
|
||||||
- name: addon-rancher-backup
|
|
||||||
@@ -10,7 +10,6 @@ spec:
|
|||||||
kind: GitRepository
|
kind: GitRepository
|
||||||
name: platform
|
name: platform
|
||||||
path: ./infrastructure/addons/rancher
|
path: ./infrastructure/addons/rancher
|
||||||
wait: true
|
|
||||||
timeout: 15m
|
timeout: 15m
|
||||||
suspend: false
|
suspend: false
|
||||||
dependsOn:
|
dependsOn:
|
||||||
@@ -18,3 +17,9 @@ spec:
|
|||||||
- name: addon-tailscale-proxyclass
|
- name: addon-tailscale-proxyclass
|
||||||
- name: addon-external-secrets
|
- name: addon-external-secrets
|
||||||
- name: addon-cert-manager
|
- name: addon-cert-manager
|
||||||
|
wait: false
|
||||||
|
healthChecks:
|
||||||
|
- apiVersion: helm.toolkit.fluxcd.io/v2
|
||||||
|
kind: HelmRelease
|
||||||
|
name: rancher
|
||||||
|
namespace: flux-system
|
||||||
|
|||||||
@@ -10,6 +10,11 @@ spec:
|
|||||||
kind: GitRepository
|
kind: GitRepository
|
||||||
name: platform
|
name: platform
|
||||||
path: ./infrastructure/addons/tailscale-operator
|
path: ./infrastructure/addons/tailscale-operator
|
||||||
wait: true
|
wait: false
|
||||||
|
healthChecks:
|
||||||
|
- apiVersion: helm.toolkit.fluxcd.io/v2
|
||||||
|
kind: HelmRelease
|
||||||
|
name: tailscale-operator
|
||||||
|
namespace: flux-system
|
||||||
timeout: 5m
|
timeout: 5m
|
||||||
suspend: false
|
suspend: false
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- kustomization-ccm.yaml
|
- kustomization-nfs-storage.yaml
|
||||||
- kustomization-csi.yaml
|
|
||||||
- kustomization-external-secrets.yaml
|
- kustomization-external-secrets.yaml
|
||||||
- kustomization-cert-manager.yaml
|
- kustomization-cert-manager.yaml
|
||||||
- kustomization-tailscale-operator.yaml
|
- kustomization-tailscale-operator.yaml
|
||||||
@@ -12,5 +11,3 @@ resources:
|
|||||||
- kustomization-observability-content.yaml
|
- kustomization-observability-content.yaml
|
||||||
- kustomization-rancher.yaml
|
- kustomization-rancher.yaml
|
||||||
- kustomization-rancher-config.yaml
|
- kustomization-rancher-config.yaml
|
||||||
- kustomization-rancher-backup.yaml
|
|
||||||
- kustomization-rancher-backup-config.yaml
|
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRole
|
||||||
|
metadata:
|
||||||
|
name: nfs-subdir-external-provisioner-runner
|
||||||
|
rules:
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources: ["nodes"]
|
||||||
|
verbs: ["get", "list", "watch"]
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources: ["persistentvolumes"]
|
||||||
|
verbs: ["get", "list", "watch", "create", "delete"]
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources: ["persistentvolumeclaims"]
|
||||||
|
verbs: ["get", "list", "watch", "update"]
|
||||||
|
- apiGroups: ["storage.k8s.io"]
|
||||||
|
resources: ["storageclasses"]
|
||||||
|
verbs: ["get", "list", "watch"]
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources: ["events"]
|
||||||
|
verbs: ["create", "update", "patch"]
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
metadata:
|
||||||
|
name: run-nfs-subdir-external-provisioner
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: nfs-subdir-external-provisioner-runner
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: nfs-subdir-external-provisioner
|
||||||
|
namespace: kube-system
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: nfs-subdir-external-provisioner
|
||||||
|
namespace: kube-system
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: nfs-subdir-external-provisioner
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: nfs-subdir-external-provisioner
|
||||||
|
spec:
|
||||||
|
serviceAccountName: nfs-subdir-external-provisioner
|
||||||
|
nodeSelector:
|
||||||
|
kubernetes.io/hostname: k8s-cluster-cp-1
|
||||||
|
tolerations:
|
||||||
|
- key: node-role.kubernetes.io/control-plane
|
||||||
|
operator: Exists
|
||||||
|
effect: NoSchedule
|
||||||
|
containers:
|
||||||
|
- name: nfs-subdir-external-provisioner
|
||||||
|
image: registry.k8s.io/sig-storage/nfs-subdir-external-provisioner:v4.0.2
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
env:
|
||||||
|
- name: PROVISIONER_NAME
|
||||||
|
value: flash-nfs
|
||||||
|
- name: NFS_SERVER
|
||||||
|
value: 10.27.27.239
|
||||||
|
- name: NFS_PATH
|
||||||
|
value: /TheFlash/k8s-nfs
|
||||||
|
volumeMounts:
|
||||||
|
- name: nfs-subdir-external-provisioner-root
|
||||||
|
mountPath: /persistentvolumes
|
||||||
|
volumes:
|
||||||
|
- name: nfs-subdir-external-provisioner-root
|
||||||
|
nfs:
|
||||||
|
server: 10.27.27.239
|
||||||
|
path: /TheFlash/k8s-nfs
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- serviceaccount-nfs-subdir-external-provisioner.yaml
|
||||||
|
- clusterrole-nfs-subdir-external-provisioner.yaml
|
||||||
|
- clusterrolebinding-nfs-subdir-external-provisioner.yaml
|
||||||
|
- role-nfs-subdir-external-provisioner.yaml
|
||||||
|
- rolebinding-nfs-subdir-external-provisioner.yaml
|
||||||
|
- storageclass-flash-nfs.yaml
|
||||||
|
- deployment-nfs-subdir-external-provisioner.yaml
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: Role
|
||||||
|
metadata:
|
||||||
|
name: leader-locking-nfs-subdir-external-provisioner
|
||||||
|
namespace: kube-system
|
||||||
|
rules:
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources: ["endpoints"]
|
||||||
|
verbs: ["get", "list", "watch", "create", "update", "patch"]
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: RoleBinding
|
||||||
|
metadata:
|
||||||
|
name: leader-locking-nfs-subdir-external-provisioner
|
||||||
|
namespace: kube-system
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: Role
|
||||||
|
name: leader-locking-nfs-subdir-external-provisioner
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: nfs-subdir-external-provisioner
|
||||||
|
namespace: kube-system
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: nfs-subdir-external-provisioner
|
||||||
|
namespace: kube-system
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
apiVersion: storage.k8s.io/v1
|
||||||
|
kind: StorageClass
|
||||||
|
metadata:
|
||||||
|
name: flash-nfs
|
||||||
|
annotations:
|
||||||
|
storageclass.kubernetes.io/is-default-class: "true"
|
||||||
|
provisioner: flash-nfs
|
||||||
|
parameters:
|
||||||
|
archiveOnDelete: "true"
|
||||||
|
reclaimPolicy: Delete
|
||||||
|
allowVolumeExpansion: true
|
||||||
|
volumeBindingMode: Immediate
|
||||||
@@ -5,14 +5,14 @@ metadata:
|
|||||||
namespace: flux-system
|
namespace: flux-system
|
||||||
spec:
|
spec:
|
||||||
interval: 10m
|
interval: 10m
|
||||||
|
timeout: 15m
|
||||||
targetNamespace: observability
|
targetNamespace: observability
|
||||||
chart:
|
chart:
|
||||||
spec:
|
spec:
|
||||||
chart: kube-prometheus-stack
|
chart: ./infrastructure/charts/kube-prometheus-stack
|
||||||
version: 68.4.4
|
|
||||||
sourceRef:
|
sourceRef:
|
||||||
kind: HelmRepository
|
kind: GitRepository
|
||||||
name: prometheus-community
|
name: platform
|
||||||
namespace: flux-system
|
namespace: flux-system
|
||||||
install:
|
install:
|
||||||
createNamespace: true
|
createNamespace: true
|
||||||
@@ -21,6 +21,7 @@ spec:
|
|||||||
upgrade:
|
upgrade:
|
||||||
remediation:
|
remediation:
|
||||||
retries: 3
|
retries: 3
|
||||||
|
strategy: uninstall
|
||||||
values:
|
values:
|
||||||
grafana:
|
grafana:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|||||||
@@ -6,14 +6,10 @@ metadata:
|
|||||||
spec:
|
spec:
|
||||||
interval: 10m
|
interval: 10m
|
||||||
targetNamespace: observability
|
targetNamespace: observability
|
||||||
chart:
|
chartRef:
|
||||||
spec:
|
kind: OCIRepository
|
||||||
chart: loki
|
name: loki
|
||||||
version: 6.10.0
|
namespace: flux-system
|
||||||
sourceRef:
|
|
||||||
kind: HelmRepository
|
|
||||||
name: grafana
|
|
||||||
namespace: flux-system
|
|
||||||
install:
|
install:
|
||||||
createNamespace: true
|
createNamespace: true
|
||||||
remediation:
|
remediation:
|
||||||
@@ -50,7 +46,7 @@ spec:
|
|||||||
replicas: 1
|
replicas: 1
|
||||||
persistence:
|
persistence:
|
||||||
size: 10Gi
|
size: 10Gi
|
||||||
storageClass: local-path
|
storageClass: flash-nfs
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
cpu: 100m
|
cpu: 100m
|
||||||
@@ -87,11 +83,11 @@ spec:
|
|||||||
test:
|
test:
|
||||||
enabled: false
|
enabled: false
|
||||||
chunksCache:
|
chunksCache:
|
||||||
enabled: true
|
enabled: false
|
||||||
allocatedMemory: 128
|
|
||||||
resultsCache:
|
resultsCache:
|
||||||
enabled: true
|
enabled: false
|
||||||
allocatedMemory: 128
|
lokiCanary:
|
||||||
|
enabled: false
|
||||||
monitoring:
|
monitoring:
|
||||||
selfMonitoring:
|
selfMonitoring:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|||||||
@@ -5,15 +5,12 @@ metadata:
|
|||||||
namespace: flux-system
|
namespace: flux-system
|
||||||
spec:
|
spec:
|
||||||
interval: 10m
|
interval: 10m
|
||||||
|
timeout: 20m
|
||||||
targetNamespace: observability
|
targetNamespace: observability
|
||||||
chart:
|
chartRef:
|
||||||
spec:
|
kind: OCIRepository
|
||||||
chart: promtail
|
name: promtail
|
||||||
version: 6.16.6
|
namespace: flux-system
|
||||||
sourceRef:
|
|
||||||
kind: HelmRepository
|
|
||||||
name: grafana
|
|
||||||
namespace: flux-system
|
|
||||||
install:
|
install:
|
||||||
createNamespace: true
|
createNamespace: true
|
||||||
remediation:
|
remediation:
|
||||||
@@ -22,6 +19,8 @@ spec:
|
|||||||
remediation:
|
remediation:
|
||||||
retries: 3
|
retries: 3
|
||||||
values:
|
values:
|
||||||
|
image:
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
config:
|
config:
|
||||||
clients:
|
clients:
|
||||||
- url: http://loki.observability.svc.cluster.local:3100/loki/api/v1/push
|
- url: http://observability-loki.observability.svc.cluster.local:3100/loki/api/v1/push
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
apiVersion: source.toolkit.fluxcd.io/v1
|
|
||||||
kind: HelmRepository
|
|
||||||
metadata:
|
|
||||||
name: grafana
|
|
||||||
namespace: flux-system
|
|
||||||
spec:
|
|
||||||
interval: 1h
|
|
||||||
url: https://grafana.github.io/helm-charts
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
apiVersion: source.toolkit.fluxcd.io/v1
|
|
||||||
kind: HelmRepository
|
|
||||||
metadata:
|
|
||||||
name: prometheus-community
|
|
||||||
namespace: flux-system
|
|
||||||
spec:
|
|
||||||
interval: 1h
|
|
||||||
url: https://prometheus-community.github.io/helm-charts
|
|
||||||
@@ -3,8 +3,8 @@ kind: Kustomization
|
|||||||
resources:
|
resources:
|
||||||
- namespace.yaml
|
- namespace.yaml
|
||||||
- grafana-admin-externalsecret.yaml
|
- grafana-admin-externalsecret.yaml
|
||||||
- helmrepository-prometheus-community.yaml
|
- ocirepository-loki.yaml
|
||||||
- helmrepository-grafana.yaml
|
- ocirepository-promtail.yaml
|
||||||
- helmrelease-kube-prometheus-stack.yaml
|
- helmrelease-kube-prometheus-stack.yaml
|
||||||
- helmrelease-loki.yaml
|
- helmrelease-loki.yaml
|
||||||
- helmrelease-promtail.yaml
|
- helmrelease-promtail.yaml
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
apiVersion: source.toolkit.fluxcd.io/v1
|
||||||
|
kind: OCIRepository
|
||||||
|
metadata:
|
||||||
|
name: loki
|
||||||
|
namespace: flux-system
|
||||||
|
spec:
|
||||||
|
interval: 10m
|
||||||
|
url: oci://ghcr.io/grafana/helm-charts/loki
|
||||||
|
ref:
|
||||||
|
tag: 6.46.0
|
||||||
|
layerSelector:
|
||||||
|
mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip
|
||||||
|
operation: copy
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
apiVersion: source.toolkit.fluxcd.io/v1
|
||||||
|
kind: OCIRepository
|
||||||
|
metadata:
|
||||||
|
name: promtail
|
||||||
|
namespace: flux-system
|
||||||
|
spec:
|
||||||
|
interval: 10m
|
||||||
|
url: oci://ghcr.io/grafana/helm-charts/promtail
|
||||||
|
ref:
|
||||||
|
tag: 6.16.6
|
||||||
|
layerSelector:
|
||||||
|
mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip
|
||||||
|
operation: copy
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
apiVersion: resources.cattle.io/v1
|
|
||||||
kind: Backup
|
|
||||||
metadata:
|
|
||||||
name: rancher-b2-recurring
|
|
||||||
namespace: cattle-resources-system
|
|
||||||
spec:
|
|
||||||
resourceSetName: rancher-resource-set-full
|
|
||||||
storageLocation:
|
|
||||||
s3:
|
|
||||||
credentialSecretName: rancher-b2-creds
|
|
||||||
credentialSecretNamespace: cattle-resources-system
|
|
||||||
bucketName: HetznerTerra
|
|
||||||
folder: rancher-backups
|
|
||||||
endpoint: s3.us-east-005.backblazeb2.com
|
|
||||||
region: us-east-005
|
|
||||||
schedule: "0 3 * * *"
|
|
||||||
retentionCount: 7
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
|
||||||
kind: Kustomization
|
|
||||||
resources:
|
|
||||||
- backup-recurring.yaml
|
|
||||||
- restore-from-b2.yaml
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
# Uncomment and set backupFilename to restore from a specific backup on rebuild.
|
|
||||||
# Find the latest backup filename in B2: rancher-backups/ folder.
|
|
||||||
# After restore succeeds, Rancher will have all users/settings from the backup.
|
|
||||||
#
|
|
||||||
# apiVersion: resources.cattle.io/v1
|
|
||||||
# kind: Restore
|
|
||||||
# metadata:
|
|
||||||
# name: restore-from-b2
|
|
||||||
# namespace: cattle-resources-system
|
|
||||||
# spec:
|
|
||||||
# backupFilename: rancher-b2-manual-test-0a416444-2c8a-4d34-8a07-d9e406750374-2026-03-30T00-08-02Z.tar.gz
|
|
||||||
# storageLocation:
|
|
||||||
# s3:
|
|
||||||
# credentialSecretName: rancher-b2-creds
|
|
||||||
# credentialSecretNamespace: cattle-resources-system
|
|
||||||
# bucketName: HetznerTerra
|
|
||||||
# folder: rancher-backups
|
|
||||||
# endpoint: s3.us-east-005.backblazeb2.com
|
|
||||||
# region: us-east-005
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
apiVersion: external-secrets.io/v1
|
|
||||||
kind: ExternalSecret
|
|
||||||
metadata:
|
|
||||||
name: rancher-b2-creds
|
|
||||||
namespace: cattle-resources-system
|
|
||||||
spec:
|
|
||||||
refreshInterval: 1h
|
|
||||||
secretStoreRef:
|
|
||||||
name: doppler-hetznerterra
|
|
||||||
kind: ClusterSecretStore
|
|
||||||
target:
|
|
||||||
name: rancher-b2-creds
|
|
||||||
creationPolicy: Owner
|
|
||||||
template:
|
|
||||||
type: Opaque
|
|
||||||
data:
|
|
||||||
accessKey: "{{ .B2_ACCOUNT_ID }}"
|
|
||||||
secretKey: "{{ .B2_APPLICATION_KEY }}"
|
|
||||||
data:
|
|
||||||
- secretKey: B2_ACCOUNT_ID
|
|
||||||
remoteRef:
|
|
||||||
key: B2_ACCOUNT_ID
|
|
||||||
- secretKey: B2_APPLICATION_KEY
|
|
||||||
remoteRef:
|
|
||||||
key: B2_APPLICATION_KEY
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: rancher-backup-crd
|
|
||||||
namespace: flux-system
|
|
||||||
spec:
|
|
||||||
interval: 10m
|
|
||||||
targetNamespace: cattle-resources-system
|
|
||||||
chart:
|
|
||||||
spec:
|
|
||||||
chart: rancher-backup-crd
|
|
||||||
version: "106.0.2+up8.1.0"
|
|
||||||
sourceRef:
|
|
||||||
kind: HelmRepository
|
|
||||||
name: rancher-charts
|
|
||||||
namespace: flux-system
|
|
||||||
install:
|
|
||||||
createNamespace: true
|
|
||||||
remediation:
|
|
||||||
retries: 3
|
|
||||||
upgrade:
|
|
||||||
remediation:
|
|
||||||
retries: 3
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: rancher-backup
|
|
||||||
namespace: flux-system
|
|
||||||
spec:
|
|
||||||
interval: 10m
|
|
||||||
targetNamespace: cattle-resources-system
|
|
||||||
dependsOn:
|
|
||||||
- name: rancher-backup-crd
|
|
||||||
chart:
|
|
||||||
spec:
|
|
||||||
chart: rancher-backup
|
|
||||||
version: "106.0.2+up8.1.0"
|
|
||||||
sourceRef:
|
|
||||||
kind: HelmRepository
|
|
||||||
name: rancher-charts
|
|
||||||
namespace: flux-system
|
|
||||||
install:
|
|
||||||
createNamespace: true
|
|
||||||
remediation:
|
|
||||||
retries: 3
|
|
||||||
upgrade:
|
|
||||||
remediation:
|
|
||||||
retries: 3
|
|
||||||
values:
|
|
||||||
image:
|
|
||||||
repository: rancher/backup-restore-operator
|
|
||||||
kubectl:
|
|
||||||
image:
|
|
||||||
repository: rancher/kubectl
|
|
||||||
tag: "v1.34.0"
|
|
||||||
postRenderers:
|
|
||||||
- kustomize:
|
|
||||||
patches:
|
|
||||||
- target:
|
|
||||||
kind: Job
|
|
||||||
name: rancher-backup-patch-sa
|
|
||||||
patch: |
|
|
||||||
- op: replace
|
|
||||||
path: /spec/template/spec/containers/0/image
|
|
||||||
value: rancher/kubectl:v1.34.0
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
apiVersion: source.toolkit.fluxcd.io/v1
|
|
||||||
kind: HelmRepository
|
|
||||||
metadata:
|
|
||||||
name: rancher-charts
|
|
||||||
namespace: flux-system
|
|
||||||
spec:
|
|
||||||
interval: 1h
|
|
||||||
url: https://charts.rancher.io
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
|
||||||
kind: Kustomization
|
|
||||||
resources:
|
|
||||||
- namespace.yaml
|
|
||||||
- helmrepository-rancher-backup.yaml
|
|
||||||
- helmrelease-rancher-backup-crd.yaml
|
|
||||||
- helmrelease-rancher-backup.yaml
|
|
||||||
- b2-credentials-externalsecret.yaml
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Namespace
|
|
||||||
metadata:
|
|
||||||
name: cattle-resources-system
|
|
||||||
@@ -5,14 +5,14 @@ metadata:
|
|||||||
namespace: flux-system
|
namespace: flux-system
|
||||||
spec:
|
spec:
|
||||||
interval: 10m
|
interval: 10m
|
||||||
|
timeout: 15m
|
||||||
targetNamespace: cattle-system
|
targetNamespace: cattle-system
|
||||||
chart:
|
chart:
|
||||||
spec:
|
spec:
|
||||||
chart: rancher
|
chart: ./infrastructure/charts/rancher
|
||||||
version: "2.13.3"
|
|
||||||
sourceRef:
|
sourceRef:
|
||||||
kind: HelmRepository
|
kind: GitRepository
|
||||||
name: rancher-stable
|
name: platform
|
||||||
namespace: flux-system
|
namespace: flux-system
|
||||||
install:
|
install:
|
||||||
createNamespace: true
|
createNamespace: true
|
||||||
@@ -23,10 +23,18 @@ spec:
|
|||||||
retries: 3
|
retries: 3
|
||||||
values:
|
values:
|
||||||
hostname: rancher.silverside-gopher.ts.net
|
hostname: rancher.silverside-gopher.ts.net
|
||||||
|
systemDefaultRegistry: registry.rancher.com
|
||||||
replicas: 1
|
replicas: 1
|
||||||
extraEnv:
|
extraEnv:
|
||||||
- name: CATTLE_PROMETHEUS_METRICS
|
- name: CATTLE_PROMETHEUS_METRICS
|
||||||
value: "true"
|
value: "true"
|
||||||
|
- name: CATTLE_FEATURES
|
||||||
|
value: "managed-system-upgrade-controller=false"
|
||||||
|
webhook:
|
||||||
|
image:
|
||||||
|
repository: rancher/rancher-webhook
|
||||||
|
tag: v0.9.3
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
cpu: 500m
|
cpu: 500m
|
||||||
@@ -34,6 +42,10 @@ spec:
|
|||||||
limits:
|
limits:
|
||||||
cpu: 1000m
|
cpu: 1000m
|
||||||
memory: 1Gi
|
memory: 1Gi
|
||||||
|
startupProbe:
|
||||||
|
timeoutSeconds: 5
|
||||||
|
periodSeconds: 10
|
||||||
|
failureThreshold: 60
|
||||||
affinity:
|
affinity:
|
||||||
nodeAffinity:
|
nodeAffinity:
|
||||||
requiredDuringSchedulingIgnoredDuringExecution:
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
apiVersion: source.toolkit.fluxcd.io/v1
|
|
||||||
kind: HelmRepository
|
|
||||||
metadata:
|
|
||||||
name: rancher-stable
|
|
||||||
namespace: flux-system
|
|
||||||
spec:
|
|
||||||
interval: 1h
|
|
||||||
url: https://releases.rancher.com/server-charts/stable
|
|
||||||
@@ -2,7 +2,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1
|
|||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- namespace.yaml
|
- namespace.yaml
|
||||||
- helmrepository-rancher.yaml
|
|
||||||
- helmrelease-rancher.yaml
|
- helmrelease-rancher.yaml
|
||||||
- rancher-bootstrap-password-flux-externalsecret.yaml
|
- rancher-bootstrap-password-flux-externalsecret.yaml
|
||||||
- rancher-bootstrap-password-externalsecret.yaml
|
- rancher-bootstrap-password-externalsecret.yaml
|
||||||
|
|||||||
@@ -8,11 +8,10 @@ spec:
|
|||||||
targetNamespace: tailscale-system
|
targetNamespace: tailscale-system
|
||||||
chart:
|
chart:
|
||||||
spec:
|
spec:
|
||||||
chart: tailscale-operator
|
chart: ./infrastructure/charts/tailscale-operator
|
||||||
version: 1.96.5
|
|
||||||
sourceRef:
|
sourceRef:
|
||||||
kind: HelmRepository
|
kind: GitRepository
|
||||||
name: tailscale
|
name: platform
|
||||||
namespace: flux-system
|
namespace: flux-system
|
||||||
install:
|
install:
|
||||||
createNamespace: true
|
createNamespace: true
|
||||||
@@ -28,6 +27,10 @@ spec:
|
|||||||
operatorConfig:
|
operatorConfig:
|
||||||
defaultTags:
|
defaultTags:
|
||||||
- tag:k8s
|
- tag:k8s
|
||||||
|
image:
|
||||||
|
repository: ghcr.io/tailscale/k8s-operator
|
||||||
|
tag: v1.96.5
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
kubernetes.io/hostname: k8s-cluster-cp-1
|
kubernetes.io/hostname: k8s-cluster-cp-1
|
||||||
tolerations:
|
tolerations:
|
||||||
@@ -37,3 +40,6 @@ spec:
|
|||||||
proxyConfig:
|
proxyConfig:
|
||||||
defaultTags: tag:k8s
|
defaultTags: tag:k8s
|
||||||
defaultProxyClass: infra-stable
|
defaultProxyClass: infra-stable
|
||||||
|
image:
|
||||||
|
repository: ghcr.io/tailscale/tailscale
|
||||||
|
tag: v1.96.5
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
apiVersion: source.toolkit.fluxcd.io/v1
|
|
||||||
kind: HelmRepository
|
|
||||||
metadata:
|
|
||||||
name: tailscale
|
|
||||||
namespace: flux-system
|
|
||||||
spec:
|
|
||||||
interval: 1h
|
|
||||||
url: https://pkgs.tailscale.com/helmcharts
|
|
||||||
@@ -2,5 +2,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1
|
|||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- namespace.yaml
|
- namespace.yaml
|
||||||
- helmrepository-tailscale.yaml
|
|
||||||
- helmrelease-tailscale-operator.yaml
|
- helmrelease-tailscale-operator.yaml
|
||||||
|
|||||||
@@ -8,11 +8,10 @@ spec:
|
|||||||
targetNamespace: kube-system
|
targetNamespace: kube-system
|
||||||
chart:
|
chart:
|
||||||
spec:
|
spec:
|
||||||
chart: traefik
|
chart: ./infrastructure/charts/traefik
|
||||||
version: "39.0.0"
|
|
||||||
sourceRef:
|
sourceRef:
|
||||||
kind: HelmRepository
|
kind: GitRepository
|
||||||
name: traefik
|
name: platform
|
||||||
namespace: flux-system
|
namespace: flux-system
|
||||||
install:
|
install:
|
||||||
createNamespace: true
|
createNamespace: true
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
apiVersion: source.toolkit.fluxcd.io/v1
|
|
||||||
kind: HelmRepository
|
|
||||||
metadata:
|
|
||||||
name: traefik
|
|
||||||
namespace: flux-system
|
|
||||||
spec:
|
|
||||||
interval: 10m
|
|
||||||
url: https://traefik.github.io/charts
|
|
||||||
provider: generic
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- helmrepository-traefik.yaml
|
|
||||||
- helmrelease-traefik.yaml
|
- helmrelease-traefik.yaml
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
annotations:
|
||||||
|
artifacthub.io/category: security
|
||||||
|
artifacthub.io/license: Apache-2.0
|
||||||
|
artifacthub.io/prerelease: "false"
|
||||||
|
artifacthub.io/signKey: |
|
||||||
|
fingerprint: 1020CF3C033D4F35BAE1C19E1226061C665DF13E
|
||||||
|
url: https://cert-manager.io/public-keys/cert-manager-keyring-2021-09-20-1020CF3C033D4F35BAE1C19E1226061C665DF13E.gpg
|
||||||
|
apiVersion: v2
|
||||||
|
appVersion: v1.17.2
|
||||||
|
description: A Helm chart for cert-manager
|
||||||
|
home: https://cert-manager.io
|
||||||
|
icon: https://raw.githubusercontent.com/cert-manager/community/4d35a69437d21b76322157e6284be4cd64e6d2b7/logo/logo-small.png
|
||||||
|
keywords:
|
||||||
|
- cert-manager
|
||||||
|
- kube-lego
|
||||||
|
- letsencrypt
|
||||||
|
- tls
|
||||||
|
kubeVersion: '>= 1.22.0-0'
|
||||||
|
maintainers:
|
||||||
|
- email: [email protected]
|
||||||
|
name: cert-manager-maintainers
|
||||||
|
url: https://cert-manager.io
|
||||||
|
name: cert-manager
|
||||||
|
sources:
|
||||||
|
- https://github.com/cert-manager/cert-manager
|
||||||
|
version: v1.17.2
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,18 @@
|
|||||||
|
{{- if .Values.installCRDs }}
|
||||||
|
⚠️ WARNING: `installCRDs` is deprecated, use `crds.enabled` instead.
|
||||||
|
{{- end }}
|
||||||
|
cert-manager {{ .Chart.AppVersion }} has been deployed successfully!
|
||||||
|
|
||||||
|
In order to begin issuing certificates, you will need to set up a ClusterIssuer
|
||||||
|
or Issuer resource (for example, by creating a 'letsencrypt-staging' issuer).
|
||||||
|
|
||||||
|
More information on the different types of issuers and how to configure them
|
||||||
|
can be found in our documentation:
|
||||||
|
|
||||||
|
https://cert-manager.io/docs/configuration/
|
||||||
|
|
||||||
|
For information on how to configure cert-manager to automatically provision
|
||||||
|
Certificates for Ingress resources, take a look at the `ingress-shim`
|
||||||
|
documentation:
|
||||||
|
|
||||||
|
https://cert-manager.io/docs/usage/ingress/
|
||||||
@@ -0,0 +1,202 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Expand the name of the chart.
|
||||||
|
*/}}
|
||||||
|
{{- define "cert-manager.name" -}}
|
||||||
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create a default fully qualified app name.
|
||||||
|
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||||
|
*/}}
|
||||||
|
{{- define "cert-manager.fullname" -}}
|
||||||
|
{{- if .Values.fullnameOverride -}}
|
||||||
|
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||||
|
{{- if contains $name .Release.Name -}}
|
||||||
|
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create the name of the service account to use
|
||||||
|
*/}}
|
||||||
|
{{- define "cert-manager.serviceAccountName" -}}
|
||||||
|
{{- if .Values.serviceAccount.create -}}
|
||||||
|
{{ default (include "cert-manager.fullname" .) .Values.serviceAccount.name }}
|
||||||
|
{{- else -}}
|
||||||
|
{{ default "default" .Values.serviceAccount.name }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Webhook templates
|
||||||
|
*/}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Expand the name of the chart.
|
||||||
|
Manually fix the 'app' and 'name' labels to 'webhook' to maintain
|
||||||
|
compatibility with the v0.9 deployment selector.
|
||||||
|
*/}}
|
||||||
|
{{- define "webhook.name" -}}
|
||||||
|
{{- printf "webhook" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create a default fully qualified app name.
|
||||||
|
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||||
|
If release name contains chart name it will be used as a full name.
|
||||||
|
*/}}
|
||||||
|
{{- define "webhook.fullname" -}}
|
||||||
|
{{- $trimmedName := printf "%s" (include "cert-manager.fullname" .) | trunc 55 | trimSuffix "-" -}}
|
||||||
|
{{- printf "%s-webhook" $trimmedName | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "webhook.caRef" -}}
|
||||||
|
{{- template "cert-manager.namespace" }}/{{ template "webhook.fullname" . }}-ca
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create the name of the service account to use
|
||||||
|
*/}}
|
||||||
|
{{- define "webhook.serviceAccountName" -}}
|
||||||
|
{{- if .Values.webhook.serviceAccount.create -}}
|
||||||
|
{{ default (include "webhook.fullname" .) .Values.webhook.serviceAccount.name }}
|
||||||
|
{{- else -}}
|
||||||
|
{{ default "default" .Values.webhook.serviceAccount.name }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
cainjector templates
|
||||||
|
*/}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Expand the name of the chart.
|
||||||
|
Manually fix the 'app' and 'name' labels to 'cainjector' to maintain
|
||||||
|
compatibility with the v0.9 deployment selector.
|
||||||
|
*/}}
|
||||||
|
{{- define "cainjector.name" -}}
|
||||||
|
{{- printf "cainjector" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create a default fully qualified app name.
|
||||||
|
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||||
|
If release name contains chart name it will be used as a full name.
|
||||||
|
*/}}
|
||||||
|
{{- define "cainjector.fullname" -}}
|
||||||
|
{{- $trimmedName := printf "%s" (include "cert-manager.fullname" .) | trunc 52 | trimSuffix "-" -}}
|
||||||
|
{{- printf "%s-cainjector" $trimmedName | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create the name of the service account to use
|
||||||
|
*/}}
|
||||||
|
{{- define "cainjector.serviceAccountName" -}}
|
||||||
|
{{- if .Values.cainjector.serviceAccount.create -}}
|
||||||
|
{{ default (include "cainjector.fullname" .) .Values.cainjector.serviceAccount.name }}
|
||||||
|
{{- else -}}
|
||||||
|
{{ default "default" .Values.cainjector.serviceAccount.name }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
startupapicheck templates
|
||||||
|
*/}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Expand the name of the chart.
|
||||||
|
Manually fix the 'app' and 'name' labels to 'startupapicheck' to maintain
|
||||||
|
compatibility with the v0.9 deployment selector.
|
||||||
|
*/}}
|
||||||
|
{{- define "startupapicheck.name" -}}
|
||||||
|
{{- printf "startupapicheck" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create a default fully qualified app name.
|
||||||
|
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||||
|
If release name contains chart name it will be used as a full name.
|
||||||
|
*/}}
|
||||||
|
{{- define "startupapicheck.fullname" -}}
|
||||||
|
{{- $trimmedName := printf "%s" (include "cert-manager.fullname" .) | trunc 52 | trimSuffix "-" -}}
|
||||||
|
{{- printf "%s-startupapicheck" $trimmedName | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create the name of the service account to use
|
||||||
|
*/}}
|
||||||
|
{{- define "startupapicheck.serviceAccountName" -}}
|
||||||
|
{{- if .Values.startupapicheck.serviceAccount.create -}}
|
||||||
|
{{ default (include "startupapicheck.fullname" .) .Values.startupapicheck.serviceAccount.name }}
|
||||||
|
{{- else -}}
|
||||||
|
{{ default "default" .Values.startupapicheck.serviceAccount.name }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create chart name and version as used by the chart label.
|
||||||
|
*/}}
|
||||||
|
{{- define "chartName" -}}
|
||||||
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Labels that should be added on each resource
|
||||||
|
*/}}
|
||||||
|
{{- define "labels" -}}
|
||||||
|
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||||
|
{{- if eq .Values.creator "helm" }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
helm.sh/chart: {{ include "chartName" . }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- if .Values.global.commonLabels}}
|
||||||
|
{{ toYaml .Values.global.commonLabels }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Namespace for all resources to be installed into
|
||||||
|
If not defined in values file then the helm release namespace is used
|
||||||
|
By default this is not set so the helm release namespace will be used
|
||||||
|
|
||||||
|
This gets around an problem within helm discussed here
|
||||||
|
https://github.com/helm/helm/issues/5358
|
||||||
|
*/}}
|
||||||
|
{{- define "cert-manager.namespace" -}}
|
||||||
|
{{ .Values.namespace | default .Release.Namespace }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Util function for generating the image URL based on the provided options.
|
||||||
|
IMPORTANT: This function is standardized across all charts in the cert-manager GH organization.
|
||||||
|
Any changes to this function should also be made in cert-manager, trust-manager, approver-policy, ...
|
||||||
|
See https://github.com/cert-manager/cert-manager/issues/6329 for a list of linked PRs.
|
||||||
|
*/}}
|
||||||
|
{{- define "image" -}}
|
||||||
|
{{- $defaultTag := index . 1 -}}
|
||||||
|
{{- with index . 0 -}}
|
||||||
|
{{- if .registry -}}{{ printf "%s/%s" .registry .repository }}{{- else -}}{{- .repository -}}{{- end -}}
|
||||||
|
{{- if .digest -}}{{ printf "@%s" .digest }}{{- else -}}{{ printf ":%s" (default $defaultTag .tag) }}{{- end -}}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Check that the user has not set both .installCRDs and .crds.enabled or
|
||||||
|
set .installCRDs and disabled .crds.keep.
|
||||||
|
.installCRDs is deprecated and users should use .crds.enabled and .crds.keep instead.
|
||||||
|
*/}}
|
||||||
|
{{- define "cert-manager.crd-check" -}}
|
||||||
|
{{- if and (.Values.installCRDs) (.Values.crds.enabled) }}
|
||||||
|
{{- fail "ERROR: the deprecated .installCRDs option cannot be enabled at the same time as its replacement .crds.enabled" }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if and (.Values.installCRDs) (not .Values.crds.keep) }}
|
||||||
|
{{- fail "ERROR: .crds.keep is not compatible with .installCRDs, please use .crds.enabled and .crds.keep instead" }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{{- if .Values.cainjector.config -}}
|
||||||
|
{{- $config := .Values.cainjector.config -}}
|
||||||
|
{{- $_ := set $config "apiVersion" (default "cainjector.config.cert-manager.io/v1alpha1" $config.apiVersion) -}}
|
||||||
|
{{- $_ := set $config "kind" (default "CAInjectorConfiguration" $config.kind) -}}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ include "cainjector.fullname" . }}
|
||||||
|
namespace: {{ include "cert-manager.namespace" . }}
|
||||||
|
labels:
|
||||||
|
app: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/name: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/component: "cainjector"
|
||||||
|
{{- include "labels" . | nindent 4 }}
|
||||||
|
data:
|
||||||
|
config.yaml: |
|
||||||
|
{{- $config | toYaml | nindent 4 }}
|
||||||
|
{{- end -}}
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
{{- if .Values.cainjector.enabled }}
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ include "cainjector.fullname" . }}
|
||||||
|
namespace: {{ include "cert-manager.namespace" . }}
|
||||||
|
labels:
|
||||||
|
app: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/name: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/component: "cainjector"
|
||||||
|
{{- include "labels" . | nindent 4 }}
|
||||||
|
{{- with .Values.cainjector.deploymentAnnotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
replicas: {{ .Values.cainjector.replicaCount }}
|
||||||
|
{{- /* The if statement below is equivalent to {{- if $value }} but will also return true for 0. */ -}}
|
||||||
|
{{- if not (has (quote .Values.global.revisionHistoryLimit) (list "" (quote ""))) }}
|
||||||
|
revisionHistoryLimit: {{ .Values.global.revisionHistoryLimit }}
|
||||||
|
{{- end }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/component: "cainjector"
|
||||||
|
{{- with .Values.cainjector.strategy }}
|
||||||
|
strategy:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/name: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/component: "cainjector"
|
||||||
|
{{- include "labels" . | nindent 8 }}
|
||||||
|
{{- with .Values.cainjector.podLabels }}
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.cainjector.podAnnotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if and .Values.prometheus.enabled (not (or .Values.prometheus.servicemonitor.enabled .Values.prometheus.podmonitor.enabled)) }}
|
||||||
|
{{- if not .Values.cainjector.podAnnotations }}
|
||||||
|
annotations:
|
||||||
|
{{- end }}
|
||||||
|
prometheus.io/path: "/metrics"
|
||||||
|
prometheus.io/scrape: 'true'
|
||||||
|
prometheus.io/port: '9402'
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- if not .Values.cainjector.serviceAccount.create }}
|
||||||
|
{{- with .Values.global.imagePullSecrets }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
serviceAccountName: {{ template "cainjector.serviceAccountName" . }}
|
||||||
|
{{- if hasKey .Values.cainjector "automountServiceAccountToken" }}
|
||||||
|
automountServiceAccountToken: {{ .Values.cainjector.automountServiceAccountToken }}
|
||||||
|
{{- end }}
|
||||||
|
enableServiceLinks: {{ .Values.cainjector.enableServiceLinks }}
|
||||||
|
{{- with .Values.global.priorityClassName }}
|
||||||
|
priorityClassName: {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.cainjector.securityContext }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
containers:
|
||||||
|
- name: {{ .Chart.Name }}-cainjector
|
||||||
|
image: "{{ template "image" (tuple .Values.cainjector.image $.Chart.AppVersion) }}"
|
||||||
|
imagePullPolicy: {{ .Values.cainjector.image.pullPolicy }}
|
||||||
|
args:
|
||||||
|
{{- /* The if statement below is equivalent to {{- if $value }} but will also return true for 0. */ -}}
|
||||||
|
{{- if not (has (quote .Values.global.logLevel) (list "" (quote ""))) }}
|
||||||
|
- --v={{ .Values.global.logLevel }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.cainjector.config }}
|
||||||
|
- --config=/var/cert-manager/config/config.yaml
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.global.leaderElection }}
|
||||||
|
- --leader-election-namespace={{ .namespace }}
|
||||||
|
{{- if .leaseDuration }}
|
||||||
|
- --leader-election-lease-duration={{ .leaseDuration }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .renewDeadline }}
|
||||||
|
- --leader-election-renew-deadline={{ .renewDeadline }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .retryPeriod }}
|
||||||
|
- --leader-election-retry-period={{ .retryPeriod }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.cainjector.featureGates}}
|
||||||
|
- --feature-gates={{ . }}
|
||||||
|
{{- end}}
|
||||||
|
{{- with .Values.cainjector.extraArgs }}
|
||||||
|
{{- toYaml . | nindent 10 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if not .Values.prometheus.enabled }}
|
||||||
|
- --metrics-listen-address=0
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.prometheus.enabled }}
|
||||||
|
ports:
|
||||||
|
- containerPort: 9402
|
||||||
|
name: http-metrics
|
||||||
|
protocol: TCP
|
||||||
|
{{- end }}
|
||||||
|
env:
|
||||||
|
- name: POD_NAMESPACE
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: metadata.namespace
|
||||||
|
{{- with .Values.cainjector.extraEnv }}
|
||||||
|
{{- toYaml . | nindent 10 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.cainjector.containerSecurityContext }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.cainjector.resources }}
|
||||||
|
resources:
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if or .Values.cainjector.config .Values.cainjector.volumeMounts }}
|
||||||
|
volumeMounts:
|
||||||
|
{{- if .Values.cainjector.config }}
|
||||||
|
- name: config
|
||||||
|
mountPath: /var/cert-manager/config
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.cainjector.volumeMounts }}
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.cainjector.nodeSelector }}
|
||||||
|
nodeSelector:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.cainjector.affinity }}
|
||||||
|
affinity:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.cainjector.tolerations }}
|
||||||
|
tolerations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.cainjector.topologySpreadConstraints }}
|
||||||
|
topologySpreadConstraints:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if or .Values.cainjector.volumes .Values.cainjector.config }}
|
||||||
|
volumes:
|
||||||
|
{{- if .Values.cainjector.config }}
|
||||||
|
- name: config
|
||||||
|
configMap:
|
||||||
|
name: {{ include "cainjector.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{ with .Values.cainjector.volumes }}
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
{{- if .Values.cainjector.podDisruptionBudget.enabled }}
|
||||||
|
apiVersion: policy/v1
|
||||||
|
kind: PodDisruptionBudget
|
||||||
|
metadata:
|
||||||
|
name: {{ include "cainjector.fullname" . }}
|
||||||
|
namespace: {{ include "cert-manager.namespace" . }}
|
||||||
|
labels:
|
||||||
|
app: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/name: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/component: "cainjector"
|
||||||
|
{{- include "labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/component: "cainjector"
|
||||||
|
|
||||||
|
{{- if not (or (hasKey .Values.cainjector.podDisruptionBudget "minAvailable") (hasKey .Values.cainjector.podDisruptionBudget "maxUnavailable")) }}
|
||||||
|
minAvailable: 1 # Default value because minAvailable and maxUnavailable are not set
|
||||||
|
{{- end }}
|
||||||
|
{{- if hasKey .Values.cainjector.podDisruptionBudget "minAvailable" }}
|
||||||
|
minAvailable: {{ .Values.cainjector.podDisruptionBudget.minAvailable }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if hasKey .Values.cainjector.podDisruptionBudget "maxUnavailable" }}
|
||||||
|
maxUnavailable: {{ .Values.cainjector.podDisruptionBudget.maxUnavailable }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{{- if .Values.cainjector.enabled }}
|
||||||
|
{{- if .Values.global.podSecurityPolicy.enabled }}
|
||||||
|
kind: ClusterRole
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
metadata:
|
||||||
|
name: {{ template "cainjector.fullname" . }}-psp
|
||||||
|
labels:
|
||||||
|
app: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/name: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/component: "cainjector"
|
||||||
|
{{- include "labels" . | nindent 4 }}
|
||||||
|
rules:
|
||||||
|
- apiGroups: ['policy']
|
||||||
|
resources: ['podsecuritypolicies']
|
||||||
|
verbs: ['use']
|
||||||
|
resourceNames:
|
||||||
|
- {{ template "cainjector.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
{{- if .Values.cainjector.enabled }}
|
||||||
|
{{- if .Values.global.podSecurityPolicy.enabled }}
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
metadata:
|
||||||
|
name: {{ template "cainjector.fullname" . }}-psp
|
||||||
|
labels:
|
||||||
|
app: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/name: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/component: "cainjector"
|
||||||
|
{{- include "labels" . | nindent 4 }}
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: {{ template "cainjector.fullname" . }}-psp
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: {{ template "cainjector.serviceAccountName" . }}
|
||||||
|
namespace: {{ include "cert-manager.namespace" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
{{- if .Values.cainjector.enabled }}
|
||||||
|
{{- if .Values.global.podSecurityPolicy.enabled }}
|
||||||
|
apiVersion: policy/v1beta1
|
||||||
|
kind: PodSecurityPolicy
|
||||||
|
metadata:
|
||||||
|
name: {{ template "cainjector.fullname" . }}
|
||||||
|
labels:
|
||||||
|
app: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/name: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/component: "cainjector"
|
||||||
|
{{- include "labels" . | nindent 4 }}
|
||||||
|
annotations:
|
||||||
|
seccomp.security.alpha.kubernetes.io/allowedProfileNames: 'docker/default'
|
||||||
|
seccomp.security.alpha.kubernetes.io/defaultProfileName: 'docker/default'
|
||||||
|
{{- if .Values.global.podSecurityPolicy.useAppArmor }}
|
||||||
|
apparmor.security.beta.kubernetes.io/allowedProfileNames: 'runtime/default'
|
||||||
|
apparmor.security.beta.kubernetes.io/defaultProfileName: 'runtime/default'
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
privileged: false
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
allowedCapabilities: [] # default set of capabilities are implicitly allowed
|
||||||
|
volumes:
|
||||||
|
- 'configMap'
|
||||||
|
- 'emptyDir'
|
||||||
|
- 'projected'
|
||||||
|
- 'secret'
|
||||||
|
- 'downwardAPI'
|
||||||
|
hostNetwork: false
|
||||||
|
hostIPC: false
|
||||||
|
hostPID: false
|
||||||
|
runAsUser:
|
||||||
|
rule: 'MustRunAs'
|
||||||
|
ranges:
|
||||||
|
- min: 1000
|
||||||
|
max: 1000
|
||||||
|
seLinux:
|
||||||
|
rule: 'RunAsAny'
|
||||||
|
supplementalGroups:
|
||||||
|
rule: 'MustRunAs'
|
||||||
|
ranges:
|
||||||
|
- min: 1000
|
||||||
|
max: 1000
|
||||||
|
fsGroup:
|
||||||
|
rule: 'MustRunAs'
|
||||||
|
ranges:
|
||||||
|
- min: 1000
|
||||||
|
max: 1000
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
{{- if .Values.cainjector.enabled }}
|
||||||
|
{{- if .Values.global.rbac.create }}
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRole
|
||||||
|
metadata:
|
||||||
|
name: {{ template "cainjector.fullname" . }}
|
||||||
|
labels:
|
||||||
|
app: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/name: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/component: "cainjector"
|
||||||
|
{{- include "labels" . | nindent 4 }}
|
||||||
|
rules:
|
||||||
|
- apiGroups: ["cert-manager.io"]
|
||||||
|
resources: ["certificates"]
|
||||||
|
verbs: ["get", "list", "watch"]
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources: ["secrets"]
|
||||||
|
verbs: ["get", "list", "watch"]
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources: ["events"]
|
||||||
|
verbs: ["get", "create", "update", "patch"]
|
||||||
|
- apiGroups: ["admissionregistration.k8s.io"]
|
||||||
|
resources: ["validatingwebhookconfigurations", "mutatingwebhookconfigurations"]
|
||||||
|
verbs: ["get", "list", "watch", "update", "patch"]
|
||||||
|
- apiGroups: ["apiregistration.k8s.io"]
|
||||||
|
resources: ["apiservices"]
|
||||||
|
verbs: ["get", "list", "watch", "update", "patch"]
|
||||||
|
- apiGroups: ["apiextensions.k8s.io"]
|
||||||
|
resources: ["customresourcedefinitions"]
|
||||||
|
verbs: ["get", "list", "watch", "update", "patch"]
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
metadata:
|
||||||
|
name: {{ template "cainjector.fullname" . }}
|
||||||
|
labels:
|
||||||
|
app: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/name: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/component: "cainjector"
|
||||||
|
{{- include "labels" . | nindent 4 }}
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: {{ template "cainjector.fullname" . }}
|
||||||
|
subjects:
|
||||||
|
- name: {{ template "cainjector.serviceAccountName" . }}
|
||||||
|
namespace: {{ include "cert-manager.namespace" . }}
|
||||||
|
kind: ServiceAccount
|
||||||
|
|
||||||
|
---
|
||||||
|
# leader election rules
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: Role
|
||||||
|
metadata:
|
||||||
|
name: {{ template "cainjector.fullname" . }}:leaderelection
|
||||||
|
namespace: {{ .Values.global.leaderElection.namespace }}
|
||||||
|
labels:
|
||||||
|
app: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/name: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/component: "cainjector"
|
||||||
|
{{- include "labels" . | nindent 4 }}
|
||||||
|
rules:
|
||||||
|
# Used for leader election by the controller
|
||||||
|
# cert-manager-cainjector-leader-election is used by the CertificateBased injector controller
|
||||||
|
# see cmd/cainjector/start.go#L113
|
||||||
|
# cert-manager-cainjector-leader-election-core is used by the SecretBased injector controller
|
||||||
|
# see cmd/cainjector/start.go#L137
|
||||||
|
- apiGroups: ["coordination.k8s.io"]
|
||||||
|
resources: ["leases"]
|
||||||
|
resourceNames: ["cert-manager-cainjector-leader-election", "cert-manager-cainjector-leader-election-core"]
|
||||||
|
verbs: ["get", "update", "patch"]
|
||||||
|
- apiGroups: ["coordination.k8s.io"]
|
||||||
|
resources: ["leases"]
|
||||||
|
verbs: ["create"]
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# grant cert-manager permission to manage the leaderelection configmap in the
|
||||||
|
# leader election namespace
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: RoleBinding
|
||||||
|
metadata:
|
||||||
|
name: {{ include "cainjector.fullname" . }}:leaderelection
|
||||||
|
namespace: {{ .Values.global.leaderElection.namespace }}
|
||||||
|
labels:
|
||||||
|
app: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/name: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/component: "cainjector"
|
||||||
|
{{- include "labels" . | nindent 4 }}
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: Role
|
||||||
|
name: {{ template "cainjector.fullname" . }}:leaderelection
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: {{ template "cainjector.serviceAccountName" . }}
|
||||||
|
namespace: {{ include "cert-manager.namespace" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- $certmanagerNamespace := include "cert-manager.namespace" . }}
|
||||||
|
{{- if (.Values.cainjector.config.metricsTLSConfig).dynamic }}
|
||||||
|
{{- if $certmanagerNamespace | eq .Values.cainjector.config.metricsTLSConfig.dynamic.secretNamespace }}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Metrics server dynamic TLS serving certificate rules
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: Role
|
||||||
|
metadata:
|
||||||
|
name: {{ template "cainjector.fullname" . }}:dynamic-serving
|
||||||
|
namespace: {{ include "cert-manager.namespace" . }}
|
||||||
|
labels:
|
||||||
|
app: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/name: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/component: "cainjector"
|
||||||
|
{{- include "labels" . | nindent 4 }}
|
||||||
|
rules:
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources: ["secrets"]
|
||||||
|
resourceNames:
|
||||||
|
# Allow cainjector to read and update the metrics CA Secret when dynamic TLS is
|
||||||
|
# enabled for the metrics server and if the Secret is configured to be in the
|
||||||
|
# same namespace as cert-manager.
|
||||||
|
- {{ .Values.cainjector.config.metricsTLSConfig.dynamic.secretName | quote }}
|
||||||
|
verbs: ["get", "list", "watch", "update"]
|
||||||
|
# It's not possible to grant CREATE permission on a single resourceName.
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources: ["secrets"]
|
||||||
|
verbs: ["create"]
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: RoleBinding
|
||||||
|
metadata:
|
||||||
|
name: {{ include "cainjector.fullname" . }}:dynamic-serving
|
||||||
|
namespace: {{ include "cert-manager.namespace" . }}
|
||||||
|
labels:
|
||||||
|
app: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/name: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/component: "cainjector"
|
||||||
|
{{- include "labels" . | nindent 4 }}
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: Role
|
||||||
|
name: {{ template "cainjector.fullname" . }}:dynamic-serving
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: {{ template "cainjector.serviceAccountName" . }}
|
||||||
|
namespace: {{ include "cert-manager.namespace" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
{{- if .Values.cainjector.enabled }}
|
||||||
|
{{- if and .Values.prometheus.enabled (not .Values.prometheus.podmonitor.enabled) }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ template "cainjector.fullname" . }}
|
||||||
|
namespace: {{ include "cert-manager.namespace" . }}
|
||||||
|
{{- with .Values.cainjector.serviceAnnotations }}
|
||||||
|
annotations:
|
||||||
|
{{ toYaml . | indent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
app: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/name: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/component: "cainjector"
|
||||||
|
{{- include "labels" . | nindent 4 }}
|
||||||
|
{{- with .Values.cainjector.serviceLabels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 9402
|
||||||
|
name: http-metrics
|
||||||
|
selector:
|
||||||
|
app.kubernetes.io/name: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/component: "cainjector"
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
{{- if .Values.cainjector.enabled }}
|
||||||
|
{{- if .Values.cainjector.serviceAccount.create }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
automountServiceAccountToken: {{ .Values.cainjector.serviceAccount.automountServiceAccountToken }}
|
||||||
|
metadata:
|
||||||
|
name: {{ template "cainjector.serviceAccountName" . }}
|
||||||
|
namespace: {{ include "cert-manager.namespace" . }}
|
||||||
|
{{- with .Values.cainjector.serviceAccount.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
app: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/name: {{ include "cainjector.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/component: "cainjector"
|
||||||
|
{{- include "labels" . | nindent 4 }}
|
||||||
|
{{- with .Values.cainjector.serviceAccount.labels }}
|
||||||
|
{{ toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.global.imagePullSecrets }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- toYaml . | nindent 2 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{{- if .Values.config -}}
|
||||||
|
{{- $config := .Values.config -}}
|
||||||
|
{{- $_ := set $config "apiVersion" (default "controller.config.cert-manager.io/v1alpha1" $config.apiVersion) -}}
|
||||||
|
{{- $_ := set $config "kind" (default "ControllerConfiguration" $config.kind) -}}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ include "cert-manager.fullname" . }}
|
||||||
|
namespace: {{ include "cert-manager.namespace" . }}
|
||||||
|
labels:
|
||||||
|
app: {{ include "cert-manager.name" . }}
|
||||||
|
app.kubernetes.io/name: {{ include "cert-manager.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/component: "controller"
|
||||||
|
{{- include "labels" . | nindent 4 }}
|
||||||
|
data:
|
||||||
|
config.yaml: |
|
||||||
|
{{- $config | toYaml | nindent 4 }}
|
||||||
|
{{- end -}}
|
||||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user