diff --git a/pkg/kyverno/apply/apply_command.go b/pkg/kyverno/apply/apply_command.go index 0fd0bab589..9f67eae18c 100644 --- a/pkg/kyverno/apply/apply_command.go +++ b/pkg/kyverno/apply/apply_command.go @@ -221,7 +221,7 @@ func applyCommandHelper(resourcePaths []string, cluster bool, policyReport bool, } } - mutatedPolicies, err := common.MutatePolices(policies) + mutatedPolicies, err := common.MutatePolicies(policies) if err != nil { if !sanitizederror.IsErrorSanitized(err) { return rc, resources, skipInvalidPolicies, pvInfos, sanitizederror.NewWithError("failed to mutate policy", err) diff --git a/pkg/kyverno/common/common.go b/pkg/kyverno/common/common.go index 5e4f627215..63c1014ce7 100644 --- a/pkg/kyverno/common/common.go +++ b/pkg/kyverno/common/common.go @@ -415,7 +415,7 @@ func GetVariable(variablesString, valuesFile string, fs billy.Filesystem, isGit fmt.Printf(("\nNOTICE: request.object.* variables are automatically parsed from the supplied resource. Ignoring value of variables `%v`.\n"), reqObjVars) } - storePolices := make([]store.Policy, 0) + storePolicies := make([]store.Policy, 0) for policyName, ruleMap := range valuesMapRule { storeRules := make([]store.Rule, 0) for _, rule := range ruleMap { @@ -424,21 +424,21 @@ func GetVariable(variablesString, valuesFile string, fs billy.Filesystem, isGit Values: rule.Values, }) } - storePolices = append(storePolices, store.Policy{ + storePolicies = append(storePolicies, store.Policy{ Name: policyName, Rules: storeRules, }) } store.SetContext(store.Context{ - Policies: storePolices, + Policies: storePolicies, }) return variables, globalValMap, valuesMapResource, namespaceSelectorMap, nil } -// MutatePolices - function to apply mutation on policies -func MutatePolices(policies []*v1.ClusterPolicy) ([]*v1.ClusterPolicy, error) { +// MutatePolicies - function to apply mutation on policies +func MutatePolicies(policies []*v1.ClusterPolicy) ([]*v1.ClusterPolicy, error) { newPolicies := make([]*v1.ClusterPolicy, 0) logger := log.Log.WithName("apply") @@ -854,7 +854,7 @@ func processGenerateEngineResponse(policy *v1.ClusterPolicy, generateResponse *r } func SetInStoreContext(mutatedPolicies []*v1.ClusterPolicy, variables map[string]string) map[string]string { - storePolices := make([]store.Policy, 0) + storePolicies := make([]store.Policy, 0) for _, policy := range mutatedPolicies { storeRules := make([]store.Rule, 0) for _, rule := range policy.Spec.Rules { @@ -874,14 +874,14 @@ func SetInStoreContext(mutatedPolicies []*v1.ClusterPolicy, variables map[string }) } } - storePolices = append(storePolices, store.Policy{ + storePolicies = append(storePolicies, store.Policy{ Name: policy.Name, Rules: storeRules, }) } store.SetContext(store.Context{ - Policies: storePolices, + Policies: storePolicies, }) return variables diff --git a/pkg/kyverno/test/test_command.go b/pkg/kyverno/test/test_command.go index d6492efd36..28cfa1b1ac 100644 --- a/pkg/kyverno/test/test_command.go +++ b/pkg/kyverno/test/test_command.go @@ -701,7 +701,7 @@ func applyPoliciesFromPath(fs billy.Filesystem, policyBytes []byte, valuesFile s os.Exit(1) } - mutatedPolicies, err := common.MutatePolices(policies) + mutatedPolicies, err := common.MutatePolicies(policies) if err != nil { if !sanitizederror.IsErrorSanitized(err) { return sanitizederror.NewWithError("failed to mutate policy", err)