Skip to content

experiment: adjusts to migrate from application to app.kubernetes.io/managed-by label#3126

Draft
tcondeixa wants to merge 5 commits into
masterfrom
replace-spilo-application-by-owner
Draft

experiment: adjusts to migrate from application to app.kubernetes.io/managed-by label#3126
tcondeixa wants to merge 5 commits into
masterfrom
replace-spilo-application-by-owner

Conversation

@tcondeixa

@tcondeixa tcondeixa commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

This is an experiment to allow to migrate from the application to app.kubernetes.io/managed-by label.

Phase 1: cluster_labels: application:spilo,app.kubernetes.io/managed-by:spilo

  • needs pod relabeling before replace ( current PR)
  • if relabeling partially fails → we abort before deleting the old StatefulSet → pods still match the old application:spilo selector → still fully managed → no split-brain risk
  • worst case: nothing changes, operator logs a warning, you retry

Phase 2: cluster_labels: app.kubernetes.io/managed-by:spilo

  • Existing selector: {application:spilo, app.kubernetes.io/managed-by:spilo, cluster-name:x}
  • Desired selector: {app.kubernetes.io/managed-by:spilo, cluster-name:x}
  • MapContains(existing, desired) → true → already works with existing code, no fix needed
  • Pods already carry owner:spilo from Phase 1 → new StatefulSet adopts them immediately
  • No relabeling step, no risk window

So two-phase concentrates the risk only in Phase 1, and Phase 1's risk is bounded because the old selector still exists on pods if anything goes wrong. Phase 2 is completely safe with zero code changes.

The code change needed is only in Phase 1: relabel pods with the new labels before doing the cascade=orphan replace, and abort if any pod fails to relabel.

@tcondeixa tcondeixa changed the title Experiment: adjust to try to migrate from application to owner label Experiment: adjust to try to migrate from application to app.kubernetes.io/managed-by label Jul 1, 2026
@tcondeixa tcondeixa changed the title Experiment: adjust to try to migrate from application to app.kubernetes.io/managed-by label experiment: adjusts to migrate from application to app.kubernetes.io/managed-by label Jul 1, 2026
@FxKu FxKu added the major Major feature changes or updates, e.g. feature rollout to a new country, new API calls. label Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

major Major feature changes or updates, e.g. feature rollout to a new country, new API calls.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants