Skip to content
This repository was archived by the owner on Jul 13, 2026. It is now read-only.

fix: replace deprecated commonLabels with labels in kustomizations - #3

Open
triuzzi wants to merge 1 commit into
spinnaker:mainfrom
triuzzi:fix/kustomize-commonlabels-deprecation
Open

fix: replace deprecated commonLabels with labels in kustomizations#3
triuzzi wants to merge 1 commit into
spinnaker:mainfrom
triuzzi:fix/kustomize-commonlabels-deprecation

Conversation

@triuzzi

@triuzzi triuzzi commented Jul 12, 2026

Copy link
Copy Markdown

What

Migrates every kustomization.yml in this repo from the deprecated commonLabels field to the modern labels field.

Addresses spinnaker/spinnaker#7716. (Cross-repo, so it won't auto-close — please close manually on merge.)

Why

Recent kustomize versions (bundled with modern kubectl) deprecate commonLabels. Running kubectl kustomize today prints a warning for every occurrence:

# Warning: 'commonLabels' is deprecated. Please use 'labels' instead. Run 'kustomize edit fix' to update your Kustomization automatically.

13 occurrences → 13 warnings.

The one subtlety (why not a plain rename)

commonLabels injects its labels into selectors as well as metadata — Deployment spec.selector.matchLabels, Service spec.selector, and StatefulSet selectors. The modern labels field does not touch selectors unless you opt in. Since matchLabels is immutable on a live Deployment, dropping the label from selectors would be a breaking change on upgrade.

Each entry therefore sets includeSelectors: true:

labels:
- includeSelectors: true
  pairs:
    app.kubernetes.io/name: <service>

Verification — output is unchanged

I compared kubectl kustomize . (kustomize v5.8.1) before and after:

Check Before After
Deprecation warnings 13 0
Generated manifest 64 resources / 1903 lines byte-for-byte identical
commonLabels in repo 13 0

diff of the generated manifests is empty — this change is behavior-neutral and only removes the deprecation warnings.

🤖 Generated with Claude Code

Recent kustomize versions (bundled with modern kubectl) deprecate
`commonLabels` in favor of `labels`, emitting a warning for every
occurrence during `kubectl kustomize`.

Migrate all base and component kustomization.yml files to `labels`.
`commonLabels` injects its labels into resource selectors (Deployment
`spec.selector.matchLabels`, Service `spec.selector`, StatefulSet
selectors), whereas `labels` does not do so by default, so each entry
sets `includeSelectors: true` to preserve the exact prior behavior.
The generated manifest is byte-for-byte identical before and after;
only the deprecation warnings are removed.

Addresses spinnaker/spinnaker#7716

Co-Authored-By: Claude <noreply@anthropic.com>
@triuzzi

triuzzi commented Jul 12, 2026

Copy link
Copy Markdown
Author

@karlskewes 🙏

@karlskewes

Copy link
Copy Markdown
Contributor

Hi @triuzzi, thank you and I'm sorry but this repository should be archived because the code was moved and since modified in the monorepo here: https://github.com/spinnaker/spinnaker/tree/main/spinnaker-kustomize

It would be ideal if you could close this PR and port/refactor the changes in a PR against the monorepo. Would you mind?

I'll ask in the community slack about archiving this repo.

@jasonmcintosh

Copy link
Copy Markdown
Member

Yeah I'll get those closed/archived shortly & README updated to point to the new location. Thanks and hope you can move this into the core repo!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants