Repository navigation
Commit b89b159
committed
fix(platform): make etcd v1alpha2 adoption (migration 50) robust in-cluster
Migration 50 (etcd.aenix.io -> etcd-operator.cozystack.io/v1alpha2 adoption)
had two defects that blocked every in-cluster 1.5 -> 1.6 upgrade on a cluster
with an existing etcd:
1. Cert-SAN wait treated transient kubectl failures as "SAN absent".
ensure_wildcard_sans checked/awaited the wildcard SAN with
`kubectl get ... 2>/dev/null | grep`, so any transient GET failure (API
discovery refresh, apiserver blip, throttling) produced an empty string
indistinguishable from a genuine absence -> false miss, and the 120s wait
never recovered. Replace the two ad-hoc checks with a _san_present helper
that retries on an empty read (a real Certificate/Secret never has empty
dnsNames/alt-names) and accepts the native wildcard from EITHER the issued
Secret's cert-manager.io/alt-names annotation OR the Certificate
spec.dnsNames (the source of truth for what cert-manager will issue).
2. etcd-migrate had no kubeconfig in-cluster.
etcd-migrate only reads a kubeconfig file (-k/--kubeconfig, default
/root/.kube/config) and, unlike kubectl, does not fall back to the mounted
in-cluster ServiceAccount. The hook Job set no KUBECONFIG and passed no
--kubeconfig, so both the dry-run and --apply aborted with
"error building kubeconfig: stat /root/.kube/config: no such file".
Synthesize an in-cluster kubeconfig from the mounted ServiceAccount and pass
--kubeconfig to both etcd-migrate invocations.
Verified end-to-end on a 1.5.2 -> 1.6.0-rc.1 upgrade: the adoption now
completes in-place (pods never restarted, data intact) and the cluster reaches
readyMembers=3 / Available=True.
Refs: #3243, #3255
Signed-off-by: Andrey Kolkov <[email protected]>1 parent f91841f commit b89b159
1 file changed
Lines changed: 60 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
117 | 144 | | |
118 | 145 | | |
119 | 146 | | |
| |||
129 | 156 | | |
130 | 157 | | |
131 | 158 | | |
132 | | - | |
133 | | - | |
134 | | - | |
| 159 | + | |
135 | 160 | | |
136 | 161 | | |
137 | 162 | | |
| |||
148 | 173 | | |
149 | 174 | | |
150 | 175 | | |
151 | | - | |
152 | | - | |
153 | | - | |
| 176 | + | |
154 | 177 | | |
155 | 178 | | |
156 | 179 | | |
| |||
331 | 354 | | |
332 | 355 | | |
333 | 356 | | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
334 | 386 | | |
335 | 387 | | |
336 | 388 | | |
| 389 | + | |
337 | 390 | | |
338 | 391 | | |
339 | 392 | | |
| |||
379 | 432 | | |
380 | 433 | | |
381 | 434 | | |
| 435 | + | |
382 | 436 | | |
383 | 437 | | |
384 | 438 | | |
| |||
0 commit comments