mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-29 19:05:27 +00:00
Merge branch 'master' into add_testscenario
This commit is contained in:
commit
ac0404bd6c
3 changed files with 16 additions and 11 deletions
|
@ -106,6 +106,8 @@ spec:
|
|||
generate:
|
||||
kind: ConfigMap
|
||||
name: zk-kafka-address
|
||||
# create the resource in the new namespace
|
||||
namespace: "{{request.object.name}}"
|
||||
data:
|
||||
kind: ConfigMap
|
||||
data:
|
||||
|
|
|
@ -76,7 +76,7 @@ spec :
|
|||
- key: name # compares (key operator value)
|
||||
operator: Equal
|
||||
value: name # constant "name" == "name"
|
||||
- key: "{{serviceAccount}}" # refer to a pre-defined variable serviceAccount
|
||||
- key: "{{serviceAccountName}}" # refer to a pre-defined variable serviceAccountName
|
||||
operator: NotEqual
|
||||
value: "user1" # if service
|
||||
# Each rule can contain a single validate, mutate, or generate directive
|
||||
|
|
|
@ -232,17 +232,20 @@ func variableSubsitutionForAttributes(gen kyverno.Generation, ctx context.EvalIn
|
|||
if newNamespace, ok := newNamespaceVar.(string); ok {
|
||||
gen.Namespace = newNamespace
|
||||
}
|
||||
// Clone
|
||||
cloneName := gen.Clone.Name
|
||||
cloneNamespace := gen.Clone.Namespace
|
||||
|
||||
newcloneNameVar := variables.SubstituteVariables(ctx, cloneName)
|
||||
if newcloneName, ok := newcloneNameVar.(string); ok {
|
||||
gen.Clone.Name = newcloneName
|
||||
}
|
||||
newcloneNamespaceVar := variables.SubstituteVariables(ctx, cloneNamespace)
|
||||
if newcloneNamespace, ok := newcloneNamespaceVar.(string); ok {
|
||||
gen.Clone.Namespace = newcloneNamespace
|
||||
if gen.Clone != (kyverno.CloneFrom{}) {
|
||||
// Clone
|
||||
cloneName := gen.Clone.Name
|
||||
cloneNamespace := gen.Clone.Namespace
|
||||
|
||||
newcloneNameVar := variables.SubstituteVariables(ctx, cloneName)
|
||||
if newcloneName, ok := newcloneNameVar.(string); ok {
|
||||
gen.Clone.Name = newcloneName
|
||||
}
|
||||
newcloneNamespaceVar := variables.SubstituteVariables(ctx, cloneNamespace)
|
||||
if newcloneNamespace, ok := newcloneNamespaceVar.(string); ok {
|
||||
gen.Clone.Namespace = newcloneNamespace
|
||||
}
|
||||
}
|
||||
return gen
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue