...
1 package webhook
2
3 import (
4 "fmt"
5
6 labels "github.com/linkerd/linkerd2/pkg/k8s"
7 corev1 "k8s.io/api/core/v1"
8 )
9
10
11
12 func GetProxyContainerPath(spec corev1.PodSpec) string {
13 for i, c := range spec.Containers {
14 if c.Name == labels.ProxyContainerName {
15 return fmt.Sprintf("containers/%d", i)
16 }
17 }
18 for i, c := range spec.InitContainers {
19 if c.Name == labels.ProxyContainerName {
20 return fmt.Sprintf("initContainers/%d", i)
21 }
22 }
23 return ""
24 }
25
View as plain text