From ed8b36631c50831fe7288ae94f2b1979e5b0c726 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?= Date: Tue, 14 Mar 2023 09:36:53 +0100 Subject: [PATCH] fix: remove hasVerifyYaml from policy cache (#6563) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Charles-Edouard Brétéché --- pkg/policycache/store.go | 5 +---- pkg/policycache/type.go | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/pkg/policycache/store.go b/pkg/policycache/store.go index 06b03e009a..8eeebfd6a0 100644 --- a/pkg/policycache/store.go +++ b/pkg/policycache/store.go @@ -95,7 +95,7 @@ func (m *policyMap) set(key string, policy kyvernov1.PolicyInterface, client Res enforcePolicy := computeEnforcePolicy(policy.GetSpec()) m.policies[key] = policy type state struct { - hasMutate, hasValidate, hasGenerate, hasVerifyImages, hasImagesValidationChecks, hasVerifyYAML bool + hasMutate, hasValidate, hasGenerate, hasVerifyImages, hasImagesValidationChecks bool } kindStates := map[dclient.GroupVersionResourceSubresource]state{} for _, rule := range autogen.ComputeRules(policy) { @@ -127,7 +127,6 @@ func (m *policyMap) set(key string, policy kyvernov1.PolicyInterface, client Res entry.hasGenerate = entry.hasGenerate || hasGenerate entry.hasVerifyImages = entry.hasVerifyImages || hasVerifyImages entry.hasImagesValidationChecks = entry.hasImagesValidationChecks || hasImagesValidationChecks - // TODO: hasVerifyYAML ? kindStates[gvrs] = entry } } @@ -141,7 +140,6 @@ func (m *policyMap) set(key string, policy kyvernov1.PolicyInterface, client Res Generate: sets.New[string](), VerifyImagesMutate: sets.New[string](), VerifyImagesValidate: sets.New[string](), - VerifyYAML: sets.New[string](), } } m.kindType[gvrs][Mutate] = set(m.kindType[gvrs][Mutate], key, state.hasMutate) @@ -150,7 +148,6 @@ func (m *policyMap) set(key string, policy kyvernov1.PolicyInterface, client Res m.kindType[gvrs][Generate] = set(m.kindType[gvrs][Generate], key, state.hasGenerate) m.kindType[gvrs][VerifyImagesMutate] = set(m.kindType[gvrs][VerifyImagesMutate], key, state.hasVerifyImages) m.kindType[gvrs][VerifyImagesValidate] = set(m.kindType[gvrs][VerifyImagesValidate], key, state.hasVerifyImages && state.hasImagesValidationChecks) - m.kindType[gvrs][VerifyYAML] = set(m.kindType[gvrs][VerifyYAML], key, state.hasVerifyYAML) } return multierr.Combine(errs...) } diff --git a/pkg/policycache/type.go b/pkg/policycache/type.go index cbdf0a6aff..778aa03206 100644 --- a/pkg/policycache/type.go +++ b/pkg/policycache/type.go @@ -11,5 +11,4 @@ const ( Generate VerifyImagesMutate VerifyImagesValidate - VerifyYAML )