Skip to content

Commit

Permalink
Merge pull request #3425 from neteric/fix-retainPodFielsIncludeInitCo…
Browse files Browse the repository at this point in the history
…ntainer

Fix func retainPodFields not include initContainer'volumesMounts bug
  • Loading branch information
karmada-bot authored Apr 19, 2023
2 parents 4011f07 + a95b576 commit 2be4b33
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/resourceinterpreter/default/native/retain.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ func retainPodFields(desired, observed *unstructured.Unstructured) (*unstructure
}
}

// retain volumeMounts in each init container
for _, clusterInitContainer := range clusterPod.Spec.InitContainers {
for desiredIndex, desiredInitContainer := range desiredPod.Spec.InitContainers {
if desiredInitContainer.Name == clusterInitContainer.Name {
desiredPod.Spec.InitContainers[desiredIndex].VolumeMounts = clusterInitContainer.VolumeMounts
break
}
}
}
unstructuredObj, err := helper.ToUnstructured(desiredPod)
if err != nil {
return nil, fmt.Errorf("failed to transform Pod: %v", err)
Expand Down

0 comments on commit 2be4b33

Please sign in to comment.