mirror of
https://github.com/kyverno/kyverno.git
synced 2025-04-08 10:04:25 +00:00
update crd
This commit is contained in:
parent
2893cc3f7d
commit
3706822df7
4 changed files with 87 additions and 5 deletions
|
@ -243,7 +243,7 @@ spec:
|
|||
apiVersion: apiextensions.k8s.io/v1beta1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: policyviolations.kyverno.io
|
||||
name: namespacedpolicyviolations.kyverno.io
|
||||
spec:
|
||||
group: kyverno.io
|
||||
versions:
|
||||
|
@ -252,9 +252,9 @@ spec:
|
|||
storage: true
|
||||
scope: Namespaced
|
||||
names:
|
||||
kind: PolicyViolation
|
||||
plural: policyviolations
|
||||
singular: policyviolation
|
||||
kind: NamespacedPolicyViolation
|
||||
plural: namespacedpolicyviolations
|
||||
singular: namespacedpolicyviolation
|
||||
subresources:
|
||||
status: {}
|
||||
validation:
|
||||
|
|
|
@ -240,6 +240,71 @@ spec:
|
|||
creationBlocked:
|
||||
type: boolean
|
||||
---
|
||||
apiVersion: apiextensions.k8s.io/v1beta1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: namespacedpolicyviolations.kyverno.io
|
||||
spec:
|
||||
group: kyverno.io
|
||||
versions:
|
||||
- name: v1alpha1
|
||||
served: true
|
||||
storage: true
|
||||
scope: Namespaced
|
||||
names:
|
||||
kind: NamespacedPolicyViolation
|
||||
plural: namespacedpolicyviolations
|
||||
singular: namespacedpolicyviolation
|
||||
subresources:
|
||||
status: {}
|
||||
validation:
|
||||
openAPIV3Schema:
|
||||
properties:
|
||||
spec:
|
||||
required:
|
||||
- policy
|
||||
- resource
|
||||
- rules
|
||||
properties:
|
||||
policy:
|
||||
type: string
|
||||
resource:
|
||||
type: object
|
||||
required:
|
||||
- kind
|
||||
- name
|
||||
properties:
|
||||
kind:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
namespace:
|
||||
type: string
|
||||
rules:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
required:
|
||||
- name
|
||||
- type
|
||||
- message
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
type:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
managedResource:
|
||||
type: object
|
||||
properties:
|
||||
kind:
|
||||
type: string
|
||||
namespace:
|
||||
type: string
|
||||
creationBlocked:
|
||||
type: boolean
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
|
|
|
@ -37,6 +37,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
|
|||
&ClusterPolicyList{},
|
||||
&ClusterPolicyViolation{},
|
||||
&ClusterPolicyViolationList{},
|
||||
&NamespacedPolicyViolation{},
|
||||
&NamespacedPolicyViolationList{},
|
||||
)
|
||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
return nil
|
||||
|
|
|
@ -52,7 +52,9 @@ type ClusterPolicyViolationListerExpansion interface {
|
|||
|
||||
// NamespacedPolicyViolationListerExpansion allows custom methods to be added to
|
||||
// NamespacedPolicyViolationLister.
|
||||
type NamespacedPolicyViolationListerExpansion interface{}
|
||||
type NamespacedPolicyViolationListerExpansion interface {
|
||||
// ListResources(selector labels.Selector) (ret []*v1alpha1.NamespacedPolicyViolation, err error)
|
||||
}
|
||||
|
||||
// NamespacedPolicyViolationNamespaceListerExpansion allows custom methods to be added to
|
||||
// NamespacedPolicyViolationNamespaceLister.
|
||||
|
@ -79,6 +81,19 @@ func (pl *clusterPolicyLister) ListResources(selector labels.Selector) (ret []*v
|
|||
return policies, err
|
||||
}
|
||||
|
||||
// func (namespacepvl *namespacedPolicyViolationLister) ListResources(selector labels.Selector) (ret []*kyverno.NamespacedPolicyViolation, err error) {
|
||||
// namespacepvs, err := namespacepvl.List(selector)
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
|
||||
// for index := range namespacepvs {
|
||||
// namespacepvs[index].SetGroupVersionKind(kyverno.SchemeGroupVersion.WithKind("NamespacedPolicyViolation"))
|
||||
// }
|
||||
|
||||
// return namespacepvs, nil
|
||||
// }
|
||||
|
||||
func (pl *clusterPolicyLister) GetPolicyForPolicyViolation(pv *kyverno.ClusterPolicyViolation) ([]*kyverno.ClusterPolicy, error) {
|
||||
if len(pv.Labels) == 0 {
|
||||
return nil, fmt.Errorf("no Policy found for PolicyViolation %v because it has no labels", pv.Name)
|
||||
|
|
Loading…
Add table
Reference in a new issue