mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Merge pull request #16258 from mqliang/deployment-redundant
Auto commit by PR queue bot
This commit is contained in:
commit
9ace86fd25
@ -43,13 +43,13 @@ func GetOldRCs(deployment extensions.Deployment, c client.Interface) ([]*api.Rep
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error listing replication controllers: %v", err)
|
return nil, fmt.Errorf("error listing replication controllers: %v", err)
|
||||||
}
|
}
|
||||||
|
newRCTemplate := GetNewRCTemplate(deployment)
|
||||||
for _, pod := range podList.Items {
|
for _, pod := range podList.Items {
|
||||||
podLabelsSelector := labels.Set(pod.ObjectMeta.Labels)
|
podLabelsSelector := labels.Set(pod.ObjectMeta.Labels)
|
||||||
for _, rc := range rcList.Items {
|
for _, rc := range rcList.Items {
|
||||||
rcLabelsSelector := labels.SelectorFromSet(rc.Spec.Selector)
|
rcLabelsSelector := labels.SelectorFromSet(rc.Spec.Selector)
|
||||||
if rcLabelsSelector.Matches(podLabelsSelector) {
|
if rcLabelsSelector.Matches(podLabelsSelector) {
|
||||||
// Filter out RC that has the same pod template spec as the deployment - that is the new RC.
|
// Filter out RC that has the same pod template spec as the deployment - that is the new RC.
|
||||||
newRCTemplate := GetNewRCTemplate(deployment)
|
|
||||||
if api.Semantic.DeepEqual(rc.Spec.Template, &newRCTemplate) {
|
if api.Semantic.DeepEqual(rc.Spec.Template, &newRCTemplate) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user