Repository navigation
fix(cli): hand the operator mode's API key Secret to the kates chart - #688
Merged
Merged
Conversation
bmscomp
added a commit
that referenced
this pull request
Nov 17, 2026
kates deploy hands the operator mode's kates-api-key to the kates chart (#688), so the switch-back step no longer deletes it. A note keeps the manual step for a CLI of v1.41.2 or older.
An operator-mode deploy writes kates-api-key with kubectl apply. After the
Kates resource is deleted, a standalone kates deploy then failed:
helm refuses to install the chart's Secret over one without its ownership
metadata ("invalid ownership metadata").
Before the standalone helm install, deploy now labels and annotates a
kates-api-key that Helm doesn't manage as release kates's, so Helm adopts
it and the chart's lookup keeps the key clients already hold. A Secret Helm
already manages is left alone.
kates deploy hands the operator mode's kates-api-key to the kates chart (#688), so the switch-back step no longer deletes it. A note keeps the manual step for a CLI of v1.41.2 or older.
bmscomp
force-pushed
the
fix/kates-api-key-switch
branch
from
November 17, 2026 01:25
5d99851 to
ca15aa1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
kates deploy --kates-mode operatorwrites the Secretkates-api-keywithkubectl apply(applySecretincli/cmd/deploy_kates_operator.go). Once theKatesresource is deleted, a standalonekates deployfails athelm upgrade --install kates. The chart renders a Secret of the same name (charts/kates/templates/api-key-secret.yaml), and Helm refuses to install over an object that lacks its ownership metadata:I reproduced this on Kind (Helm 4.3.2) in a scratch namespace, with a Secret written as
applySecretwrites it.Fix
Before the standalone Helm install,
adoptAPIKeySecretcheckskates-api-keyin the Kates namespace. If Helm doesn't manage it, the CLI addsapp.kubernetes.io/managed-by=Helmand themeta.helm.sh/release-name=kates/meta.helm.sh/release-namespace=<ns>annotations. Helm then adopts the Secret, and the chart'slookupreuses its value, so clients keep their key. When the Secret is absent, or Helm already manages it, nothing changes.The fix sits in the install path, not in
applySecret, so operator-mode installs already made with v1.41.x also switch cleanly.Tests
TestTheOperatorModesAPIKeySecretIsHandedToTheChartcovers three cases: no Secret, an operator-mode Secret (adopted), and a Helm-managed Secret (left alone).kubectl getjsonpath,labelandannotatecommands, then a Helm install of a chart rendering the same Secret: it reportedSTATUS: deployedand kept the keykeep-me.go vet ./...andgo test -p 1 -race -count=1 ./...incli/both pass.golangci-lintreports only two pre-existing errcheck findings, both incmd/mcp_test.go, a file this PR doesn't touch.kates deployon a cluster.Docs, second commit: #686 merged with a manual
kubectl delete secret kates-api-keyin Tutorial 16's switch-back step. This PR removes that step and keeps it only as a note for a CLI of v1.41.2 or older. It also updates Switching Modes indocs/book/kates-operator.md.