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

toggle for autogen version (#11535)

* toggle for autogen version

Signed-off-by: utsab818 <utsabsapkota4231@gmail.com>

* Updated toggle for autogenv2

Signed-off-by: utsab818 <utsabsapkota4231@gmail.com>

---------

Signed-off-by: utsab818 <utsabsapkota4231@gmail.com>
This commit is contained in:
Utsab Sapkota 2024-11-08 16:42:24 +05:30 committed by GitHub
parent 0ee6256044
commit 7501ec8f57
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View file

@ -12,6 +12,7 @@ type Toggles interface {
EnableDeferredLoading() bool
GenerateValidatingAdmissionPolicy() bool
DumpMutatePatches() bool
AutogenV2() bool
}
type defaultToggles struct{}
@ -36,6 +37,10 @@ func (defaultToggles) DumpMutatePatches() bool {
return DumpMutatePatches.enabled()
}
func (defaultToggles) AutogenV2() bool {
return AutogenV2.enabled()
}
type contextKey struct{}
func NewContext(ctx context.Context, toggles Toggles) context.Context {

View file

@ -31,6 +31,11 @@ const (
DumpMutatePatchesDescription = "Set the flag to 'true', to dump mutate patches."
dumpMutatePatchesEnvVar = "FLAG_DUMP_PATCHES"
defaultDumpMutatePatches = false
// select autogen
AutogenV2FlagName = "autogenV2"
AutogenV2Description = "Set the flag to 'true', to enable autogen v2."
autogenV2EnvVar = "FLAG_AUTOGEN_V2"
defaultAutogenV2 = false
)
var (
@ -39,6 +44,7 @@ var (
EnableDeferredLoading = newToggle(defaultEnableDeferredLoading, enableDeferredLoadingEnvVar)
GenerateValidatingAdmissionPolicy = newToggle(defaultGenerateValidatingAdmissionPolicy, generateValidatingAdmissionPolicyEnvVar)
DumpMutatePatches = newToggle(defaultDumpMutatePatches, dumpMutatePatchesEnvVar)
AutogenV2 = newToggle(defaultAutogenV2, autogenV2EnvVar)
)
type ToggleFlag interface {