1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-04-16 09:16:24 +00:00

Merge branch 'master' into 261_dynamic_config

This commit is contained in:
Shivkumar Dudhani 2019-10-28 15:06:37 -05:00 committed by GitHub
commit 158a499feb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 17 deletions

View file

@ -232,15 +232,13 @@ spec:
type: string type: string
managedResource: managedResource:
type: object type: object
required:
- kind
properties: properties:
kind: kind:
type: string type: string
namespace: namespace:
type: string type: string
creationBlocked: creationBlocked:
type: bool type: boolean
--- ---
kind: Namespace kind: Namespace
apiVersion: v1 apiVersion: v1

View file

@ -232,15 +232,14 @@ spec:
type: string type: string
managedResource: managedResource:
type: object type: object
required:
- kind
properties: properties:
kind: kind:
type: string type: string
namespace: namespace:
type: string type: string
creationBlocked: creationBlocked:
type: bool type: boolean
---
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:

View file

@ -173,13 +173,13 @@ type ResourceSpec struct {
// ViolatedRule stores the information regarding the rule // ViolatedRule stores the information regarding the rule
type ViolatedRule struct { type ViolatedRule struct {
Name string `json:"name"` Name string `json:"name"`
Type string `json:"type"` Type string `json:"type"`
Message string `json:"message"` Message string `json:"message"`
ManagedResource ManagedResource `json:"managedResource,omitempty"` ManagedResource ManagedResourceSpec `json:"managedResource,omitempty"`
} }
type ManagedResource struct { type ManagedResourceSpec struct {
Kind string `json:"kind,omitempty"` Kind string `json:"kind,omitempty"`
Namespace string `json:"namespace,omitempty"` Namespace string `json:"namespace,omitempty"`
CreationBlocked bool `json:"creationBlocked,omitempty"` CreationBlocked bool `json:"creationBlocked,omitempty"`

View file

@ -191,17 +191,17 @@ func (in *Generation) DeepCopy() *Generation {
} }
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ManagedResource) DeepCopyInto(out *ManagedResource) { func (in *ManagedResourceSpec) DeepCopyInto(out *ManagedResourceSpec) {
*out = *in *out = *in
return return
} }
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedResource. // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedResourceSpec.
func (in *ManagedResource) DeepCopy() *ManagedResource { func (in *ManagedResourceSpec) DeepCopy() *ManagedResourceSpec {
if in == nil { if in == nil {
return nil return nil
} }
out := new(ManagedResource) out := new(ManagedResourceSpec)
in.DeepCopyInto(out) in.DeepCopyInto(out)
return out return out
} }

View file

@ -259,7 +259,7 @@ func (pvc *PolicyViolationController) syncActiveResource(curPv *kyverno.ClusterP
// when rejected resource created in the cluster // when rejected resource created in the cluster
func (pvc *PolicyViolationController) syncBlockedResource(curPv *kyverno.ClusterPolicyViolation) error { func (pvc *PolicyViolationController) syncBlockedResource(curPv *kyverno.ClusterPolicyViolation) error {
for _, violatedRule := range curPv.Spec.ViolatedRules { for _, violatedRule := range curPv.Spec.ViolatedRules {
if reflect.DeepEqual(violatedRule.ManagedResource, kyverno.ManagedResource{}) { if reflect.DeepEqual(violatedRule.ManagedResource, kyverno.ManagedResourceSpec{}) {
continue continue
} }

View file

@ -248,7 +248,7 @@ func getOwners(dclient *dclient.Client, unstr unstructured.Unstructured) []pvRes
func newViolatedRules(er engine.EngineResponse, msg string) (violatedRules []kyverno.ViolatedRule) { func newViolatedRules(er engine.EngineResponse, msg string) (violatedRules []kyverno.ViolatedRule) {
unstr := er.PatchedResource unstr := er.PatchedResource
dependant := kyverno.ManagedResource{ dependant := kyverno.ManagedResourceSpec{
Kind: unstr.GetKind(), Kind: unstr.GetKind(),
Namespace: unstr.GetNamespace(), Namespace: unstr.GetNamespace(),
CreationBlocked: true, CreationBlocked: true,