You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit fa94120
Browse filesBrowse the repository at this point in the historyBrowse files
`--image` rewrites the top-level `image:` field in the preset's `values.yaml` before write. The flag is honored on initial `init` only — for an existing project, edit `values.yaml` directly. The `cozystack` preset declares `image:`; the `generic` preset does not, so `--image --preset generic` is rejected up front.
63
63
64
-
Edit `values.yaml` to set your cluster's control-plane endpoint. This is the URL every node's kubelet and kube-proxy will dial. The chart leaves it empty on purpose so a missed override fails loudly instead of silently embedding a placeholder.
64
+
To set the Kubernetes control-plane URL at init time, pass `--cluster-endpoint`:
`--cluster-endpoint` writes the URL into `values.yaml::endpoint`, which the chart renders into `cluster.controlPlane.endpoint` of every node's MachineConfig (the URL kubelet and kube-proxy dial). The flag is honored on initial `init` only — for an existing project, edit `values.yaml` directly.
71
+
72
+
`--endpoints` and `--cluster-endpoint` address different concepts: `--endpoints` (plural, list) populates the `talosconfig` context for the talosctl client; `--cluster-endpoint` (singular, full URL) populates the Kubernetes control-plane address inside the chart. When `--endpoints` is given a single value, init auto-derives `values.yaml::endpoint` as `https://<that>:6443` — the single-target case is unambiguous. Multi-endpoint inputs never auto-derive (picking one node would silently couple cluster availability to it); the operator must pass `--cluster-endpoint` explicitly or fill `values.yaml::endpoint` later. The init flow prints a hint at the end when the field is left empty.
73
+
74
+
Edit `values.yaml` to set your cluster's control-plane endpoint if neither flag set it. This is the URL every node's kubelet and kube-proxy will dial. The chart leaves it empty by default so a missed override fails loudly instead of silently embedding a placeholder.
/tmp/talm-safety init --preset cozystack --name test --endpoints 192.0.2.1
106
+
mv talm.key /tmp/talm.key.backup
107
+
/tmp/talm-safety init --decrypt
108
+
mv /tmp/talm.key.backup talm.key # restore for next run
109
+
rm -rf /tmp/talm-decrypt-test
110
+
```
111
+
112
+
Expected: error `failed to decrypt secrets: load key: read key file: open <path>/talm.key: no such file or directory` followed by hint `talm.key is required to decrypt secrets.encrypted.yaml. Restore your backed-up key, or re-run \`talm init\` to regenerate (this writes new secrets — the old secrets.encrypted.yaml will not be decryptable without the original key).`
113
+
114
+
Regression anchor: the hint must name BOTH recovery paths (restore from backup, re-run init to regenerate) AND include the warning that regeneration writes new secrets making the old encrypted secrets undecryptable. A regression that drops either path or the warning silently invites operators to "just run init again" without understanding the data-loss tradeoff.
Expected: `values.yaml` has `endpoint: "https://vip.example.test:6443"` (operator's VIP, explicit), `talosconfig` has all three `10.0.0.1`/`10.0.0.2`/`10.0.0.3` under the context's endpoints array. The two flags address different concepts — `--cluster-endpoint` is the kube-apiserver URL, `--endpoints` is the talosctl-client list — and both round-trip independently.
129
+
130
+
Regression anchor: removing `--cluster-endpoint` and passing only `--endpoints 10.0.0.1,10.0.0.2,10.0.0.3` MUST leave `values.yaml::endpoint` empty (the multi-endpoint case never auto-derives — picking one node would silently couple cluster availability to it). The init flow MUST then print a hint at the end pointing the operator at `values.yaml::endpoint` with examples for VIP / LB shapes.
131
+
132
+
### A10. `init --endpoints` with single entry auto-derives values.yaml::endpoint
/tmp/talm-safety init --preset cozystack --name test --endpoints 192.0.2.10
137
+
grep "^endpoint:" values.yaml
138
+
rm -rf /tmp/talm-single-ep-test
139
+
```
140
+
141
+
Expected: `endpoint: "https://192.0.2.10:6443"` — the single-endpoint case is unambiguously "this is also the cluster URL", so init derives the canonical `https://<host>:6443` form. No hint printed at end of init for this case.
142
+
143
+
Regression anchor: this auto-derive ONLY fires when `len(--endpoints) == 1`. Multi-endpoint inputs MUST leave the field empty (see A9).
144
+
145
+
### A11. `init --cluster-endpoint` rejects malformed URL before any files land on disk
/tmp/talm-safety init --preset cozystack --name test \
150
+
--endpoints 192.0.2.10 \
151
+
--cluster-endpoint "not-a-url"
152
+
ls -la # should be empty
153
+
rm -rf /tmp/talm-bad-ep-test
154
+
```
155
+
156
+
Expected: error `cluster-endpoint "not-a-url" is missing scheme, host, or port` with hint pointing at the canonical form. Directory remains empty — NO `talosconfig`, NO `.gitignore`, NO `secrets.yaml` written. Validation happens in PreRunE before any file writes so a malformed flag never produces a half-initialised project tree.
157
+
158
+
Regression anchor: a regression that defers validation to RunE (i.e. after the secret-bundle generation) would leave `talosconfig` and `.gitignore` behind — verify by checking `ls -la` after the failing command finds an empty directory.
159
+
101
160
### A8. `init --update` without `--preset` and without preset dep in Chart.yaml
// Talm.key absence is a real operational scenario
109
+
// (laptop swap, lost backup, fresh checkout) and the
110
+
// raw "open ...: no such file" surfaces as if it's an
111
+
// internal bug. Attach the recovery hint naming both
112
+
// paths the operator can take so the error reads as
113
+
// "what to do next", not "talm is broken".
114
+
//nolint:wrapcheck // cockroachdb/errors.WithHint is the project's wrapping/hinting idiom at boundaries.
115
+
returnnil, errors.WithHint(
116
+
errors.Wrap(err, "read key file"),
117
+
"talm.key is required to decrypt secrets.encrypted.yaml. Restore your backed-up key, or re-run `talm init` to regenerate (this writes new secrets — the old secrets.encrypted.yaml will not be decryptable without the original key).",
0 commit comments