mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 15:58:37 +00:00
Added similar functionality for init containers as standard containers in PodPreset admission controller
This commit is contained in:
parent
22ff267324
commit
1ec6672580
@ -184,6 +184,12 @@ func safeToApplyPodPresetsOnPod(pod *api.Pod, podPresets []*settingsv1alpha1.Pod
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
for _, iCtr := range pod.Spec.InitContainers {
|
||||
if err := safeToApplyPodPresetsOnContainer(&iCtr, podPresets); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
|
||||
return utilerrors.NewAggregate(errs)
|
||||
}
|
||||
|
||||
@ -381,6 +387,10 @@ func applyPodPresetsOnPod(pod *api.Pod, podPresets []*settingsv1alpha1.PodPreset
|
||||
applyPodPresetsOnContainer(&ctr, podPresets)
|
||||
pod.Spec.Containers[i] = ctr
|
||||
}
|
||||
for i, iCtr := range pod.Spec.InitContainers {
|
||||
applyPodPresetsOnContainer(&iCtr, podPresets)
|
||||
pod.Spec.InitContainers[i] = iCtr
|
||||
}
|
||||
|
||||
// add annotation
|
||||
if pod.ObjectMeta.Annotations == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user