From bfac92890de5b7fb5c9511336bb494a025de2045 Mon Sep 17 00:00:00 2001 From: Sam Stoelinga Date: Fri, 22 Jul 2022 06:55:49 -0700 Subject: [PATCH] Better handling when owner is Node --- pspmutating.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pspmutating.go b/pspmutating.go index 639fadc..0266dd9 100644 --- a/pspmutating.go +++ b/pspmutating.go @@ -18,7 +18,6 @@ package pspmigrator import ( "context" - "fmt" "strings" "github.com/go-test/deep" @@ -81,7 +80,8 @@ func IsPodBeingMutatedByPSP(pod *v1.Pod, clientset *kubernetes.Clientset) (mutat parentPod = ds.Spec.Template } if owner.Kind == "Node" { - return false, diff, fmt.Errorf("Pod with ownerReference of kind Node is not supported. OwnerReference of pod %v was %#v", pod.Name, owner) + // static pods launched by the node that can't be mutated + return false, diff, nil } // TODO investigate if 1st party library can be used such as github.com/google/go-cmp or smth from k8s if diffNew := deep.Equal(GetContainerSecurityContexts(parentPod.Spec), GetContainerSecurityContexts(pod.Spec)); diffNew != nil {