Skip to content

fix(component): recreate DaemonSet/Deployment when selector mismatches template labels#1493

Merged
zexi merged 1 commit intoyunionio:release/4.0.2from
zexi:selector-mismatch-recreate-ds-deploy
Apr 7, 2026
Merged

fix(component): recreate DaemonSet/Deployment when selector mismatches template labels#1493
zexi merged 1 commit intoyunionio:release/4.0.2from
zexi:selector-mismatch-recreate-ds-deploy

Conversation

@zexi
Copy link
Copy Markdown
Member

@zexi zexi commented Apr 7, 2026

When a DaemonSet or Deployment's immutable selector no longer matches the desired template labels (e.g. stale labels like onecloud.yunion.io/host-deployer in selector but not in template), Kubernetes rejects the update. Detect this mismatch before updating and automatically delete+recreate the resource.

Also fix instance label generation to use deterministic cluster name instead of random string to prevent future mismatches across restarts.

…s template labels

When a DaemonSet or Deployment's immutable selector no longer matches
the desired template labels (e.g. stale labels like
onecloud.yunion.io/host-deployer in selector but not in template),
Kubernetes rejects the update. Detect this mismatch before updating
and automatically delete+recreate the resource.

Also fix instance label generation to use deterministic cluster name
instead of random string to prevent future mismatches across restarts.
@zexi zexi merged commit 69fc1ee into yunionio:release/4.0.2 Apr 7, 2026
1 of 2 checks passed
zexi added a commit that referenced this pull request Apr 7, 2026
…tream-master

Automated cherry pick of #1493: fix(component): recreate DaemonSet/Deployment when selector mismatches template labels
zexi added a commit that referenced this pull request Apr 7, 2026
…tream-release-4.0

Automated cherry pick of #1493: fix(component): recreate DaemonSet/Deployment when selector mismatches template labels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants