operator: CrashLoopBackOff on startup from an SSA conflict on the platform PackageSource .spec.variants
Les mainteneurs répondent en général sous 3 jours
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 67/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- go, kubernetes
- Domaine
- backend, infrastructure
Piste de recherche
Start at the platform PackageSource apply in cmd/cozystack-operator/main.go near line 311, then trace how its server-side apply options are built. Reproduce the conflict using an object whose .spec.variants is owned by kubectl-client-side-apply. Done means the operator starts successfully with that stale field owner and reaches controller-manager startup.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
What happens
After upgrading to v1.7.x, cozystack-operator enters CrashLoopBackOff. It exits during setup, before the controller manager starts:
INFO setup Creating platform PackageSource {"platformSourceName": "cozystack-platform"}
INFO Applying platform PackageSource {"name": "cozystack.cozystack-platform"}
ERROR setup failed to create platform PackageSource {"error": "failed to apply PackageSource cozystack.cozystack-platform: Apply failed with 1 conflict: conflict with \"kubectl-client-side-apply\" using cozystack.io/v1alpha1: .spec.variants"}
main.main
/src/cmd/cozystack-operator/main.go:311
runtime.main
Root cause
The operator applies the platform PackageSource with a server-side apply (field manager cozystack-operator, operation Apply). On clusters where that object's .spec.variants is also owned by a kubectl-client-side-apply manager (operation Update), left over from a kubectl apply done client-side at install time or during an older release, the SSA conflicts. The operator does not set Force: true, so the apply fails and the process exits at cmd/cozystack-operator/main.go:311.
Because the operator never reaches its reconcile loop, no PackageSource is reconciled and no ArtifactGenerator is (re)generated. Already-running workloads keep serving from existing artifacts, but nothing new converges. In our case this surfaced downstream as bucket-*-system HelmReleases failing to render (no template "cozy-lib.ns-host-required", because the bucket-system ArtifactGenerator was never regenerated with the cozy-lib copy rule) and a stalled platform re-reconcile, which made it look like a bundling bug until the operator's own crash was found.
Impact
Any cluster upgrading to v1.7.x whose platform PackageSource.spec.variants was ever touched by a client-side kubectl apply gets a crashlooping operator and a frozen platform reconcile. Running workloads stay up, but nothing reconciles.
Workaround
Drop the stale kubectl-client-side-apply manager from the object, then restart the operator:
# find the index of the kubectl-client-side-apply manager
kubectl -n cozy-system get packagesources.cozystack.io cozystack.cozystack-platform --show-managed-fields -o json \
| jq '.metadata.managedFields | to_entries[] | select(.value.manager=="kubectl-client-side-apply") | .key'
# remove that managedFields entry, then restart the operator
kubectl -n cozy-system patch packagesources.cozystack.io cozystack.cozystack-platform \
--type=json -p='[{"op":"remove","path":"/metadata/managedFields/<index>"}]'
kubectl -n cozy-system rollout restart deploy/cozystack-operator
Suggested fix
Set Force: true on the operator's server-side apply of the platform PackageSource (it is the sole intended owner of that spec), or claim/migrate the kubectl-client-side-apply field manager on upgrade, so the apply cannot be blocked by a stale client-side-apply field owner.
Environment
Upgrade path to v1.7.1, Kube-OVN variant (isp-full), single management cluster.
- Langage dominant
- Go
- Étoiles
- 2.2k
- Forks
- 209
- Merge moyen
- 4 j 14 h
- PR mergées (30 j)
- 140
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de cozystack/cozystack
-
triage/needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
cozystack/cozystack#5464 · 1 réaction ·
Les mainteneurs répondent en général sous 3 jours
-
test(kubernetes-nodes): stop hand-typing the default Talos version in tests that are not about itOuvertearea/testing kind/cleanup triage/needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
cozystack/cozystack#5456 · 1 réaction ·
Les mainteneurs répondent en général sous 3 jours
-
area/testing kind/cleanup triage/needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
cozystack/cozystack#5447 · 1 réaction ·
Les mainteneurs répondent en général sous 3 jours
-
area/kubernetes kind/bug triage/needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
cozystack/cozystack#5445 · 1 réaction ·
Les mainteneurs répondent en général sous 3 jours
-
kind/bug triage/needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
cozystack/cozystack#5438 · 1 réaction ·
Les mainteneurs répondent en général sous 3 jours
Toutes les issues de cozystack/cozystack
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
-
Correct local module testing instructions for Go sample contributorsPeut-être pris @slievrly l’a pris aujourd’hui. Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
-
internal/core: cleanAttachmentName splits a rune at the 255-byte cap and stores invalid UTF-8Peut-être pris @pacwestnobody l’a pris aujourd’hui. Ouvertego good first issue help wanted
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
Podiom/Podiom#427 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
TestLaunchGolden spends about 98 seconds on fake-agent exit delays under -racePeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 1 jour
-
factory:subtask
Difficulté 1/5 Moins d'une heure Accessibilité débutants 95/100
Les mainteneurs répondent en général sous 1 jour