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

bug fix - nil pointer (#1093)

* add watch policy to clusterrole kyverno:customresources

* fix build

* fix nil pointer
This commit is contained in:
shuting 2020-09-01 17:23:54 -07:00 committed by GitHub
parent b319a816c5
commit 9a210e24d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,6 +2,7 @@ package policymutation
import (
"fmt"
"reflect"
"strings"
"github.com/go-logr/logr"
@ -20,6 +21,10 @@ func generateCronJobRule(rule kyverno.Rule, controllers string, log logr.Logger)
logger.V(3).Info("")
jobRule := generateRuleForControllers(rule, "Job", logger)
if reflect.DeepEqual(jobRule, kyvernoRule{}) {
return kyvernoRule{}
}
cronJobRule := &jobRule
cronJobRule.Name = fmt.Sprintf("autogen-cronjob-%s", rule.Name)
cronJobRule.MatchResources.Kinds = []string{engine.PodControllerCronJob}