Skip to content

Commit

Permalink
chore: keep role label when doing image in-place update (#8406) (#8408)
Browse files Browse the repository at this point in the history
  • Loading branch information
free6om authored Nov 6, 2024
1 parent cf8eb64 commit 060b495
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions pkg/controller/instanceset/in_place_update_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,10 @@ func mergeInPlaceFields(src, dst *corev1.Pod) {
}
}
ignorePodVerticalScaling := viper.GetBool(FeatureGateIgnorePodVerticalScaling)
isImageUpdated := false
for _, container := range src.Spec.Containers {
for i, c := range dst.Spec.Containers {
if container.Name == c.Name {
if dst.Spec.Containers[i].Image != container.Image {
dst.Spec.Containers[i].Image = container.Image
isImageUpdated = true
}
dst.Spec.Containers[i].Image = container.Image
if !ignorePodVerticalScaling {
requests, limits := copyRequestsNLimitsFields(&container)
mergeResources(&requests, &dst.Spec.Containers[i].Resources.Requests)
Expand All @@ -161,10 +157,6 @@ func mergeInPlaceFields(src, dst *corev1.Pod) {
}
}
}
// remove role label if images are updated
if isImageUpdated {
delete(dst.Labels, constant.RoleLabelKey)
}
}

func equalField(old, new any) bool {
Expand Down

0 comments on commit 060b495

Please sign in to comment.