fix: propagate template.metadata.labels to pods#125
Merged
Conversation
Matches K8s Deployment semantics where spec.template.metadata.labels land on pods. Prior behavior left them on the SeiNode CR only. Precedence: template.metadata.labels < template.spec.podLabels < system labels. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Closes #103.
Summary
Match stock K8s `Deployment` semantics: labels declared on `spec.template.metadata.labels` now land on pods. Prior behavior left them on the child SeiNode CR only, a footgun for anyone reaching for the Deployment mental model.
Change
In `generateSeiNode`, seed `SeiNode.Spec.PodLabels` with `template.metadata.labels`, then overlay `template.spec.podLabels`, then apply system labels. Explicit `podLabels` win on key collision with metadata labels; system labels always win over both.
Tests
Three new cases in `nodes_test.go`:
Existing `PreservesExistingPodLabels` still passes (strict-superset change).
Rollout considerations
Motivation
Surfaced while wiring chaos-mesh selectors for release-6-5 on dev. Intuitive selectors like `sei.io/chain-id: release-6-5` silently matched zero seid pods because the label was on SNDs but not pods. See platform repo chaos-selector workaround PRs for the current hack.
🤖 Generated with Claude Code