mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 18:53:35 +00:00
rebase: update K8s packages to v0.32.1
Update K8s packages in go.mod to v0.32.1 Signed-off-by: Praveen M <m.praveen@ibm.com>
This commit is contained in:
21
vendor/k8s.io/kubernetes/pkg/api/v1/pod/util.go
generated
vendored
21
vendor/k8s.io/kubernetes/pkg/api/v1/pod/util.go
generated
vendored
@ -41,6 +41,17 @@ func FindPort(pod *v1.Pod, svcPort *v1.ServicePort) (int, error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
// also support sidecar container (initContainer with restartPolicy=Always)
|
||||
for _, container := range pod.Spec.InitContainers {
|
||||
if container.RestartPolicy == nil || *container.RestartPolicy != v1.ContainerRestartPolicyAlways {
|
||||
continue
|
||||
}
|
||||
for _, port := range container.Ports {
|
||||
if port.Name == name && port.Protocol == svcPort.Protocol {
|
||||
return int(port.ContainerPort), nil
|
||||
}
|
||||
}
|
||||
}
|
||||
case intstr.Int:
|
||||
return portName.IntValue(), nil
|
||||
}
|
||||
@ -395,3 +406,13 @@ func UpdatePodCondition(status *v1.PodStatus, condition *v1.PodCondition) bool {
|
||||
// Return true if one of the fields have changed.
|
||||
return !isEqual
|
||||
}
|
||||
|
||||
// IsRestartableInitContainer returns true if the container has ContainerRestartPolicyAlways.
|
||||
// This function is not checking if the container passed to it is indeed an init container.
|
||||
// It is just checking if the container restart policy has been set to always.
|
||||
func IsRestartableInitContainer(initContainer *v1.Container) bool {
|
||||
if initContainer == nil || initContainer.RestartPolicy == nil {
|
||||
return false
|
||||
}
|
||||
return *initContainer.RestartPolicy == v1.ContainerRestartPolicyAlways
|
||||
}
|
||||
|
Reference in New Issue
Block a user