1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00

fix: remove hasVerifyYaml from policy cache (#6563)

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
Charles-Edouard Brétéché 2023-03-14 09:36:53 +01:00 committed by GitHub
parent 072344e798
commit ed8b36631c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 5 deletions

View file

@ -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...)
}

View file

@ -11,5 +11,4 @@ const (
Generate
VerifyImagesMutate
VerifyImagesValidate
VerifyYAML
)