mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 16:06:56 +00:00
added backward compatibility
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
This commit is contained in:
parent
a53613ffe2
commit
2eff4f2f3e
1 changed files with 14 additions and 2 deletions
|
@ -387,6 +387,7 @@ func GetVariable(variablesString, valuesFile string, fs billy.Filesystem, isGit
|
||||||
valuesMapRule := make(map[string]map[string]Rule)
|
valuesMapRule := make(map[string]map[string]Rule)
|
||||||
namespaceSelectorMap := make(map[string]map[string]string)
|
namespaceSelectorMap := make(map[string]map[string]string)
|
||||||
variables := make(map[string]string)
|
variables := make(map[string]string)
|
||||||
|
reqObjVars := ""
|
||||||
|
|
||||||
var yamlFile []byte
|
var yamlFile []byte
|
||||||
var err error
|
var err error
|
||||||
|
@ -395,7 +396,10 @@ func GetVariable(variablesString, valuesFile string, fs billy.Filesystem, isGit
|
||||||
for _, kvpair := range kvpairs {
|
for _, kvpair := range kvpairs {
|
||||||
kvs := strings.Split(strings.Trim(kvpair, " "), "=")
|
kvs := strings.Split(strings.Trim(kvpair, " "), "=")
|
||||||
if strings.Contains(kvs[0], "request.object") {
|
if strings.Contains(kvs[0], "request.object") {
|
||||||
return variables, valuesMapResource, namespaceSelectorMap, sanitizederror.NewWithError("variable request.object.* is handled by kyverno. please do not pass value for request.object variables ", err)
|
if !strings.Contains(reqObjVars, kvs[0]) {
|
||||||
|
reqObjVars = reqObjVars + "," + kvs[0]
|
||||||
|
}
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
variables[strings.Trim(kvs[0], " ")] = strings.Trim(kvs[1], " ")
|
variables[strings.Trim(kvs[0], " ")] = strings.Trim(kvs[1], " ")
|
||||||
|
@ -432,7 +436,11 @@ func GetVariable(variablesString, valuesFile string, fs billy.Filesystem, isGit
|
||||||
for _, r := range p.Resources {
|
for _, r := range p.Resources {
|
||||||
for variableInFile := range r.Values {
|
for variableInFile := range r.Values {
|
||||||
if strings.Contains(variableInFile, "request.object") {
|
if strings.Contains(variableInFile, "request.object") {
|
||||||
return variables, valuesMapResource, namespaceSelectorMap, sanitizederror.NewWithError("variable request.object.* is handled by kyverno. please do not pass value for request.object variables ", err)
|
if !strings.Contains(reqObjVars, variableInFile) {
|
||||||
|
reqObjVars = reqObjVars + "," + variableInFile
|
||||||
|
}
|
||||||
|
delete(r.Values, variableInFile)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resourceMap[r.Name] = r
|
resourceMap[r.Name] = r
|
||||||
|
@ -453,6 +461,10 @@ func GetVariable(variablesString, valuesFile string, fs billy.Filesystem, isGit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if reqObjVars != "" {
|
||||||
|
fmt.Printf(("\nvariable request.object.* is handled by kyverno. ignoring value of variables: `%v` passed by the user.\n"), reqObjVars)
|
||||||
|
}
|
||||||
|
|
||||||
storePolices := make([]store.Policy, 0)
|
storePolices := make([]store.Policy, 0)
|
||||||
for policyName, ruleMap := range valuesMapRule {
|
for policyName, ruleMap := range valuesMapRule {
|
||||||
storeRules := make([]store.Rule, 0)
|
storeRules := make([]store.Rule, 0)
|
||||||
|
|
Loading…
Add table
Reference in a new issue