diff --git a/pkg/api/kyverno/v1alpha1/types.go b/pkg/api/kyverno/v1alpha1/types.go index 2d6a31e9a2..e2f9f00fdd 100644 --- a/pkg/api/kyverno/v1alpha1/types.go +++ b/pkg/api/kyverno/v1alpha1/types.go @@ -1,6 +1,7 @@ package v1alpha1 import ( + rbacv1 "k8s.io/api/rbac/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -63,11 +64,17 @@ type Rule struct { //MatchResources contains resource description of the resources that the rule is to apply on type MatchResources struct { + Roles []string `json:"roles"` + ClusterRoles []string `json:"clusterRoles"` + Subjects []rbacv1.Subject `json:"subjects"` ResourceDescription `json:"resources"` } //ExcludeResources container resource description of the resources that are to be excluded from the applying the policy rule type ExcludeResources struct { + Roles []string `json:"roles"` + ClusterRoles []string `json:"clusterRoles"` + Subjects []rbacv1.Subject `json:"subjects"` ResourceDescription `json:"resources"` } diff --git a/pkg/api/kyverno/v1alpha1/zz_generated.deepcopy.go b/pkg/api/kyverno/v1alpha1/zz_generated.deepcopy.go index debd1e0789..a8dce70b46 100644 --- a/pkg/api/kyverno/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/api/kyverno/v1alpha1/zz_generated.deepcopy.go @@ -21,7 +21,8 @@ limitations under the License. package v1alpha1 import ( - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -166,6 +167,21 @@ func (in *ClusterPolicyViolationList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ExcludeResources) DeepCopyInto(out *ExcludeResources) { *out = *in + if in.Roles != nil { + in, out := &in.Roles, &out.Roles + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ClusterRoles != nil { + in, out := &in.ClusterRoles, &out.ClusterRoles + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Subjects != nil { + in, out := &in.Subjects, &out.Subjects + *out = make([]v1.Subject, len(*in)) + copy(*out, *in) + } in.ResourceDescription.DeepCopyInto(&out.ResourceDescription) return } @@ -209,6 +225,21 @@ func (in *ManagedResourceSpec) DeepCopy() *ManagedResourceSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MatchResources) DeepCopyInto(out *MatchResources) { *out = *in + if in.Roles != nil { + in, out := &in.Roles, &out.Roles + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ClusterRoles != nil { + in, out := &in.ClusterRoles, &out.ClusterRoles + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Subjects != nil { + in, out := &in.Subjects, &out.Subjects + *out = make([]v1.Subject, len(*in)) + copy(*out, *in) + } in.ResourceDescription.DeepCopyInto(&out.ResourceDescription) return } @@ -348,7 +379,7 @@ func (in *ResourceDescription) DeepCopyInto(out *ResourceDescription) { } if in.Selector != nil { in, out := &in.Selector, &out.Selector - *out = new(v1.LabelSelector) + *out = new(metav1.LabelSelector) (*in).DeepCopyInto(*out) } return