Skip to content

Chart: say the upgrade order where helm users will see it - #24

Merged
zhanghaohit merged 2 commits into
mainfrom
fix/upgrade-notes
Nov 27, 2026
Merged

zhanghaohit merged 2 commits into
mainfrom
fix/upgrade-notes

Conversation

@zhanghaohit

Copy link
Copy Markdown
Collaborator

From zoboth's review of the chart copy in helm-charts#124.

The CRDs-before-restart step only lived in a PR description. Someone installing from a chart repo never sees that, and getting it wrong is not a degraded feature — nothing writes key-auth's defaultConfig.consumers, and with the gateway chart that no longer renders that field, every route on that gateway refuses every caller. It is in NOTES.txt now, next to the uninstall-order warning that exists for the same reason, with the commands and with what the watchdog does and does not save you from. The quieter half is there too: an un-upgraded ModelFleet CRD prunes spec.gateway.streamGuard, so disabled: true is accepted and ignored.

status.members[].phase listed three of its four values. The enum has carried Disabled since members[].disabled landed; the description had not, so kubectl explain was a value short — and Disabled is the one a console must not render like Degraded, since it is a member the fleet turned off rather than one that is failing.

The third note needs no change. The possible confused deputy through gateway.upstreamAuthSecretRef, given the controller's cluster-wide secrets: get: readSecretKey refuses a ref whose namespace is not the fleet's own, and TestFleetUpstreamSecretRefCannotCrossNamespaces covers it with kube-system/stolen:token. Not visible from the chart copy, which is why it came up.

From zoboth's review of the chart copy in helm-charts#124. Two notes, both
about autoconfig rather than the copy.

**The CRDs-before-restart step only existed in a PR description.** Anyone
installing the chart from a repo never sees that, and getting it wrong is
not a degraded feature: nothing writes key-auth's defaultConfig.consumers,
and with the gateway chart that no longer renders that field, every route on
that gateway refuses every caller. It is in NOTES.txt now, beside the
uninstall-order warning that exists for the same reason, with the commands
and with what the watchdog does and does not save you from. The quieter half
is there too: an un-upgraded ModelFleet CRD prunes spec.gateway.streamGuard,
so disabled: true is accepted and ignored.

**status.members[].phase listed three of its four values.** The enum has
carried Disabled since members[].disabled landed; the description had not,
so `kubectl explain` was a value short, and Disabled is the one a console
must not show like Degraded - it is a member the fleet turned off, not one
that is failing.

The third note in that review - a possible confused deputy through
gateway.upstreamAuthSecretRef, given the controller's cluster-wide
`secrets: get` - needs no change: readSecretKey refuses a ref whose
namespace is not the fleet's own, and TestFleetUpstreamSecretRefCannotCrossNamespaces
covers it with "kube-system/stolen:token". It is not visible from the chart
copy, which is why it came up.

Claude-Session: https://claude.ai/code/session_01GVorddJkUMjYffPHXSDxop
@zhanghaohit
zhanghaohit requested a review from zoboth November 27, 2026 04:38

@zoboth zoboth left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the whole diff (Go type comment, both CRD copies, NOTES.txt). No blockers.

Checked

  • The MemberStatus.Phase comment and the two CRD YAMLs (config/crd/bases and deploy/helm/autoconfig/crds) say the same thing. The new description finally matches the enum, which already includes Disabled.
  • NOTES.txt still renders: the only template actions are {{ .Release.Name }} / {{ .Release.Namespace }}, and the new block comes after the uninstall warning, outside any conditional.
  • The order is right: helm pull --untar creates ./autoconfig/crds/, then the CRDs get applied, then helm upgrade restarts the controller, so it starts up already seeing APIConsumer being served.

Non-blocking notes

  1. kubectl apply --server-side -f autoconfig/crds/ will probably hit field-manager conflicts on a release whose CRDs were first installed by Helm. Helm creates them under its own manager, and this upgrade changes fields that manager owns (the phase description, for one). That is why other charts' upgrade docs use kubectl apply --server-side --force-conflicts -f .... If someone sees a conflict error and goes on to step 3 anyway, they end up in exactly the window this note is meant to prevent. I'd add --force-conflicts, or at least say that a conflict error means step 2 did not happen.
  2. The watchdog paragraph (exits when the CRD shows up later, then self-heals after a restart) describes controller behaviour that this diff doesn't touch, so I couldn't check it here. If it ever stops being true, this note becomes misleading, so it might be worth naming the code or test that guarantees it, the way the PR description does for readSecretKey.
  3. You could mention kubectl explain modelfleet.status.members.phase (or the kubectl get crd fields to check) so operators can confirm the CRD actually upgraded before step 3. That would also catch the quieter streamGuard-pruning case.

…rked

Helm installs the CRDs from crds/ under its own field manager, which owns
.spec.versions. A plain `kubectl apply --server-side` on them therefore fails
with `conflict with "helm"` - measured on a test cluster with a throwaway CRD
installed the same way, where it is a hard error and the CRD stays at the old
version. An operator who then moves on to `helm upgrade` lands in exactly the
window this note exists to prevent, so the flag is not optional.

Also add a step that confirms the CRD really upgraded (`kubectl explain` on a
field only the new CRD has, which exits 1 with `field ... does not exist`
otherwise), and say where the watchdog lives and which log line to look for,
so the self-healing claim is checkable rather than taken on faith.
@zhanghaohit

Copy link
Copy Markdown
Collaborator Author

Note 1 was right, and it is worse than a warning: I reproduced it on a test cluster.

A throwaway CRD installed the same way the chart installs its own (a chart's crds/ directory,
helm install) comes out owned by manager helm, and then:

$ kubectl apply --server-side -f crd-v2.yaml
error: Apply failed with 1 conflict: conflict with "helm": .spec.versions

It is a hard error, the CRD keeps the old schema, and --force-conflicts applies it (verified by
reading .spec.versions[0]...description back afterwards). So the command I wrote sends the reader
into a failing step 2 and then on to helm upgrade — the exact window the note exists to prevent.

Why none of the release validation caught it: the autoconfig CRD on the test cluster is owned by
kubectl Apply, with no helm manager entry at all, so every rc run exercised the
already-taken-over path. The probe is committed separately as
tools/apiconsumer/ssa_crd_conflict_cpu16.sh.

Fixed in the latest commit:

  • --force-conflicts on the apply, plus a sentence saying the flag is not optional and that a
    conflict error means step 2 did not happen.
  • Note 3 taken too: a step kubectl explain modelfleet.spec.gateway.streamGuard between the apply
    and the upgrade. Checked both directions on a cluster — it exits 0 on the field that exists, and
    exits 1 with error: field "doesNotExist" does not exist otherwise, so it is a real gate.
  • Note 2: the watchdog paragraph now names cmd/main.go and the log line it prints
    (APIConsumer CRD has appeared) and the pod RESTARTS to look at, instead of asserting
    self-healing with nothing to check it against. There is no test for the watchdog — it is a
    manager.RunnableFunc closure polling discovery — so I am not going to claim one; the honest
    pointer is the code and the log line.

@zhanghaohit
zhanghaohit merged commit 1636fd5 into main Nov 27, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants