feat/30-kubectl-bootstrap-script #32

Merged
tepichord merged 7 commits from feat/30-kubectl-bootstrap-script into main 2026-09-08 16:49:51 -07:00
Owner
No description provided.
Mirrors use-talos.sh to wire kubectl to the Milner Talos cluster.
Extracts kubeconfig from terraform output, handles fresh and existing
~/.kube/config with idempotent stale-entry cleanup, and uses the
KUBECONFIG=a:b kubectl config view --flatten workaround for merging
(kubectl has no built-in merge command, see kubectl#1868).

- chmod +x, shellcheck-clean
- Includes the script in the test_shellcheck test list

Refs: #30
Replace the manual kubeconfig extraction and --kubeconfig flag with
the new use-kubectl.sh script and plain 'kubectl get nodes'.

Refs: #30
Refs: #30
When the target kubeconfig contains only our cluster's contexts, the
delete-then-merge path can fail because kubectl refuses to delete
entities referenced by the active context. Fall back to wholesale
replacement — matching the established pattern in use-talos.sh.
use-kubectl.sh extracted context/cluster/user names by matching
map-style YAML keys ('  name:'), but every real kubeconfig here is
list-style ('- name: ...'): kubectl config set-*, Talos/terraform
output, and kubectl config view --flatten (the script's own output).
The parser therefore found nothing — routing configs down the
wholesale-replace path and silently deleting unrelated clusters — or
matched phantom keys such as the users section's 'user:' line and
skipped the stale-entry cleanup entirely.

- Extract section names via kubectl config view jsonpath, which parses
  both styles.
- Delete stale clusters/users by the freshly generated file's names:
  Talos names the cluster '<cluster>' (milner) but its context and
  user '<user>@<cluster>' (admin@milner), so name-equality with the
  context never matched the cluster entry and old CA/certs/server won
  the first-file-wins merge after a rebuild.
- Correct README wording: the kubectl context is admin@milner, not
  milner.
Replace the manual kubeconfig extraction (terraform output -raw
kubeconfig + --kubeconfig flag or process substitution) with the
use-kubectl.sh bootstrap script in the root, control-plane, and worker
READMEs, and note that the kubectl context it makes current is
admin@milner (user@cluster), not milner.
tepichord deleted branch feat/30-kubectl-bootstrap-script 2026-09-08 16:49:51 -07:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
tepichord/milner!32
No description provided.