...
1 package healthcheck
2
3 import (
4 "strings"
5
6 "github.com/linkerd/linkerd2/pkg/k8s"
7 corev1 "k8s.io/api/core/v1"
8 )
9
10
11
12 func HasExistingSidecars(podSpec *corev1.PodSpec) bool {
13 containers := append(podSpec.InitContainers, podSpec.Containers...)
14 for _, container := range containers {
15 if strings.HasPrefix(container.Image, "cr.l5d.io/linkerd/proxy:") ||
16 strings.HasPrefix(container.Image, "gcr.io/istio-release/proxyv2:") ||
17 container.Name == k8s.ProxyContainerName ||
18 container.Name == "istio-proxy" {
19 return true
20 }
21 }
22
23 for _, ic := range podSpec.InitContainers {
24 if strings.HasPrefix(ic.Image, "cr.l5d.io/linkerd/proxy-init:") ||
25 strings.HasPrefix(ic.Image, "gcr.io/istio-release/proxy_init:") ||
26 ic.Name == "linkerd-init" ||
27 ic.Name == "istio-init" {
28 return true
29 }
30 }
31
32 return false
33 }
34
View as plain text