Use data instead of stringData for capmox-variables Secret
stringData is never stored, so kubectl apply reported "configured" on every run and the capi play was never changed=0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,7 +12,11 @@
|
||||
"Bash(export KUBECONFIG=.claude/cluster-inspector/kubeconfigs/lab-mgmt.kubeconfig)",
|
||||
"Bash(kubectl -n capmox-system logs deploy/capmox-controller-manager --tail=200)",
|
||||
"Bash(kubectl -n capmox-system logs deploy/capmox-controller-manager --tail=5)",
|
||||
"Bash(kubectl -n capi-operator-system logs deploy/cluster-api-operator --tail=300)"
|
||||
"Bash(kubectl -n capi-operator-system logs deploy/cluster-api-operator --tail=300)",
|
||||
"Bash(clusterctl version *)",
|
||||
"Bash(KUBECONFIG=/Users/jan.novak/srv/go/cluster-autoscaler-with-capi/.claude/cluster-inspector/kubeconfigs/lab-mgmt.kubeconfig kubectl get nodes)",
|
||||
"Bash(clusterctl generate *)",
|
||||
"Bash(ansible mgmt *)"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,10 +13,12 @@ metadata:
|
||||
name: capmox-variables
|
||||
namespace: capmox-system
|
||||
type: Opaque
|
||||
stringData:
|
||||
PROXMOX_URL: "{{ proxmox_url }}"
|
||||
PROXMOX_TOKEN: "{{ proxmox_token_id }}"
|
||||
PROXMOX_SECRET: "{{ proxmox_token_secret }}"
|
||||
# `data`, not `stringData`: stringData is never stored, so `kubectl apply` would report
|
||||
# "configured" on every run and break the playbook's changed=0.
|
||||
data:
|
||||
PROXMOX_URL: {{ proxmox_url | b64encode }}
|
||||
PROXMOX_TOKEN: {{ proxmox_token_id | b64encode }}
|
||||
PROXMOX_SECRET: {{ proxmox_token_secret | b64encode }}
|
||||
{% for p in capi_providers %}
|
||||
---
|
||||
apiVersion: operator.cluster.x-k8s.io/v1alpha2
|
||||
|
||||
@@ -110,3 +110,28 @@ full playbook run re-applies it via the `inspector` task (`--apply-rbac`).
|
||||
|
||||
**Worth noting:** the `.claude/settings.json` allowlist picked up four one-off entries approved
|
||||
during this check (`export KUBECONFIG=…`, three exact `kubectl … logs` commands).
|
||||
|
||||
## Step 3 — Idempotency check (in progress)
|
||||
|
||||
### Full run: `Apply provider manifests` always `changed` (2026-09-27 10:35 CEST)
|
||||
|
||||
Owner's full `ansible-playbook mgmt.yml` runs kept reporting `changed` on this one task. Found
|
||||
with two read-only commands on the VM:
|
||||
|
||||
```bash
|
||||
ansible mgmt -b -m command -a "k3s kubectl diff -f /opt/lab-mgmt/capi-providers.yaml"
|
||||
# rc 0, empty — nothing actually differs
|
||||
ansible mgmt -b -m command -a "k3s kubectl apply --dry-run=server -f /opt/lab-mgmt/capi-providers.yaml"
|
||||
# secret/capmox-variables configured (server dry run) <- everything else "unchanged"
|
||||
```
|
||||
|
||||
Root cause: the Secret used `stringData`, which the API server folds into `data` and never
|
||||
stores, so client-side apply's three-way merge sees it missing every time, sends a patch and
|
||||
prints `configured` even though the stored `data` is identical. Fix: template writes `data` with
|
||||
`| b64encode` values. Expect one more `changed` (template file + last-applied annotation
|
||||
rewrite), then `changed=0`.
|
||||
|
||||
Also from this check: the widened inspector RBAC was not applied yet (`get nodes` still
|
||||
Forbidden), so no clean full run had completed before this fix. `clusterctl` v1.12.11
|
||||
darwin/arm64 is installed in `~/bin`; `clusterctl generate cluster lab1 --infrastructure proxmox:v0.9.1 --target-namespace default --list-variables`
|
||||
lists no `PROXMOX_*` credentials, confirming `clusterctl.yaml` only needs workload values now.
|
||||
|
||||
Reference in New Issue
Block a user