diff --git a/pkg/webhook/webhook.go b/pkg/webhook/webhook.go index 5b7ed3aac..06e9642a7 100644 --- a/pkg/webhook/webhook.go +++ b/pkg/webhook/webhook.go @@ -6,6 +6,7 @@ import ( "fmt" "net/http" "path/filepath" + "slices" "strconv" "strings" "time" @@ -271,11 +272,12 @@ func (m *podMutator) injectProxySidecarContainer(containers []corev1.Container, } func shouldInjectProxySidecar(pod *corev1.Pod) bool { + positiveAnnotationVal := []string{"true", "1", "yes"} if len(pod.Annotations) == 0 { return false } - _, ok := pod.Annotations[InjectProxySidecarAnnotation] - return ok + val, ok := pod.Annotations[InjectProxySidecarAnnotation] + return ok && slices.Contains(positiveAnnotationVal, val) } // getSkipContainers gets the list of containers to skip based on the annotation