mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-10 01:46:55 +00:00
* initial commit * background policy validation * correct message * skip non-background policy process for add/update * add Generate Request CR * generate Request Generator Initial * test generate request CR generation * initial commit gr generator * generate controller initial framework * add crd for generate request * gr cleanup controller initial commit * cleanup controller initial * generate mid-commit * generate rule processing * create PV on generate error * embed resource type * testing phase 1- generate resources with variable substitution * fix tests * comment broken test #586 * add printer column for state * return if existing resource for clone * set resync time to 2 mins & remove resource version check in update handler for gr * generate events for reporting * fix logs * cleanup * CR fixes * fix logs
459 lines
14 KiB
YAML
459 lines
14 KiB
YAML
apiVersion: apiextensions.k8s.io/v1beta1
|
|
kind: CustomResourceDefinition
|
|
metadata:
|
|
name: clusterpolicies.kyverno.io
|
|
spec:
|
|
group: kyverno.io
|
|
versions:
|
|
- name: v1
|
|
served: true
|
|
storage: true
|
|
scope: Cluster
|
|
names:
|
|
kind: ClusterPolicy
|
|
plural: clusterpolicies
|
|
singular: clusterpolicy
|
|
shortNames:
|
|
- cpol
|
|
subresources:
|
|
status: {}
|
|
validation:
|
|
openAPIV3Schema:
|
|
properties:
|
|
spec:
|
|
required:
|
|
- rules
|
|
properties:
|
|
# default values to be handled by user
|
|
validationFailureAction:
|
|
type: string
|
|
enum:
|
|
- enforce # blocks the resorce api-reques if a rule fails.
|
|
- audit # allows resource creation and reports the failed validation rules as violations. Default
|
|
rules:
|
|
type: array
|
|
items:
|
|
type: object
|
|
required:
|
|
- name
|
|
- match
|
|
properties:
|
|
name:
|
|
type: string
|
|
match:
|
|
type: object
|
|
required:
|
|
- resources
|
|
properties:
|
|
roles:
|
|
type: array
|
|
items:
|
|
type: string
|
|
clusterRoles:
|
|
type: array
|
|
items:
|
|
type: string
|
|
subjects:
|
|
type: array
|
|
items:
|
|
type: object
|
|
required:
|
|
- kind
|
|
- name
|
|
properties:
|
|
kind:
|
|
type: string
|
|
apiGroup:
|
|
type: string
|
|
name:
|
|
type: string
|
|
namespace:
|
|
type: string
|
|
resources:
|
|
type: object
|
|
required:
|
|
- kinds
|
|
properties:
|
|
kinds:
|
|
type: array
|
|
items:
|
|
type: string
|
|
name:
|
|
type: string
|
|
namespaces:
|
|
type: array
|
|
items:
|
|
type: string
|
|
selector:
|
|
properties:
|
|
matchLabels:
|
|
type: object
|
|
additionalProperties:
|
|
type: string
|
|
matchExpressions:
|
|
type: array
|
|
items:
|
|
type: object
|
|
required:
|
|
- key
|
|
- operator
|
|
properties:
|
|
key:
|
|
type: string
|
|
operator:
|
|
type: string
|
|
values:
|
|
type: array
|
|
items:
|
|
type: string
|
|
exclude:
|
|
type: object
|
|
required:
|
|
- resources
|
|
properties:
|
|
roles:
|
|
type: array
|
|
items:
|
|
type: string
|
|
clusterRoles:
|
|
type: array
|
|
items:
|
|
type: string
|
|
subjects:
|
|
type: array
|
|
items:
|
|
type: object
|
|
required:
|
|
- kind
|
|
- name
|
|
properties:
|
|
kind:
|
|
type: string
|
|
apiGroup:
|
|
type: string
|
|
name:
|
|
type: string
|
|
Namespace:
|
|
type: string
|
|
resources:
|
|
type: object
|
|
properties:
|
|
kinds:
|
|
type: array
|
|
items:
|
|
type: string
|
|
name:
|
|
type: string
|
|
namespaces:
|
|
type: array
|
|
items:
|
|
type: string
|
|
selector:
|
|
properties:
|
|
matchLabels:
|
|
type: object
|
|
additionalProperties:
|
|
type: string
|
|
matchExpressions:
|
|
type: array
|
|
items:
|
|
type: object
|
|
required:
|
|
- key
|
|
- operator
|
|
properties:
|
|
key:
|
|
type: string
|
|
operator:
|
|
type: string
|
|
values:
|
|
type: array
|
|
items:
|
|
type: string
|
|
mutate:
|
|
type: object
|
|
properties:
|
|
overlay:
|
|
AnyValue: {}
|
|
patches:
|
|
type: array
|
|
items:
|
|
type: object
|
|
required:
|
|
- path
|
|
- op
|
|
properties:
|
|
path:
|
|
type: string
|
|
op:
|
|
type: string
|
|
enum:
|
|
- add
|
|
- replace
|
|
- remove
|
|
value:
|
|
AnyValue: {}
|
|
validate:
|
|
type: object
|
|
properties:
|
|
message:
|
|
type: string
|
|
pattern:
|
|
AnyValue: {}
|
|
anyPattern:
|
|
AnyValue: {}
|
|
generate:
|
|
type: object
|
|
required:
|
|
- kind
|
|
- name
|
|
properties:
|
|
kind:
|
|
type: string
|
|
name:
|
|
type: string
|
|
clone:
|
|
type: object
|
|
required:
|
|
- namespace
|
|
- name
|
|
properties:
|
|
namespace:
|
|
type: string
|
|
name:
|
|
type: string
|
|
data:
|
|
AnyValue: {}
|
|
---
|
|
apiVersion: apiextensions.k8s.io/v1beta1
|
|
kind: CustomResourceDefinition
|
|
metadata:
|
|
name: clusterpolicyviolations.kyverno.io
|
|
spec:
|
|
group: kyverno.io
|
|
versions:
|
|
- name: v1
|
|
served: true
|
|
storage: true
|
|
scope: Cluster
|
|
names:
|
|
kind: ClusterPolicyViolation
|
|
plural: clusterpolicyviolations
|
|
singular: clusterpolicyviolation
|
|
shortNames:
|
|
- cpolv
|
|
subresources:
|
|
status: {}
|
|
additionalPrinterColumns:
|
|
- name: Policy
|
|
type: string
|
|
description: The policy that resulted in the violation
|
|
JSONPath: .spec.policy
|
|
- name: ResourceKind
|
|
type: string
|
|
description: The resource kind that cause the violation
|
|
JSONPath: .spec.resource.kind
|
|
- name: ResourceName
|
|
type: string
|
|
description: The resource name that caused the violation
|
|
JSONPath: .spec.resource.name
|
|
- name: Age
|
|
type: date
|
|
JSONPath: .metadata.creationTimestamp
|
|
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
|
|
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
|
|
creationBlocked:
|
|
type: boolean
|
|
---
|
|
apiVersion: apiextensions.k8s.io/v1beta1
|
|
kind: CustomResourceDefinition
|
|
metadata:
|
|
name: policyviolations.kyverno.io
|
|
spec:
|
|
group: kyverno.io
|
|
versions:
|
|
- name: v1
|
|
served: true
|
|
storage: true
|
|
scope: Namespaced
|
|
names:
|
|
kind: PolicyViolation
|
|
plural: policyviolations
|
|
singular: policyviolation
|
|
shortNames:
|
|
- polv
|
|
subresources:
|
|
status: {}
|
|
additionalPrinterColumns:
|
|
- name: Policy
|
|
type: string
|
|
description: The policy that resulted in the violation
|
|
JSONPath: .spec.policy
|
|
- name: ResourceKind
|
|
type: string
|
|
description: The resource kind that cause the violation
|
|
JSONPath: .spec.resource.kind
|
|
- name: ResourceName
|
|
type: string
|
|
description: The resource name that caused the violation
|
|
JSONPath: .spec.resource.name
|
|
- name: Age
|
|
type: date
|
|
JSONPath: .metadata.creationTimestamp
|
|
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
|
|
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
|
|
creationBlocked:
|
|
type: boolean
|
|
---
|
|
apiVersion: apiextensions.k8s.io/v1beta1
|
|
kind: CustomResourceDefinition
|
|
metadata:
|
|
name: generaterequests.kyverno.io
|
|
spec:
|
|
group: kyverno.io
|
|
versions:
|
|
- name: v1
|
|
served: true
|
|
storage: true
|
|
scope: Namespaced
|
|
names:
|
|
kind: GenerateRequest
|
|
plural: generaterequests
|
|
singular: generaterequest
|
|
shortNames:
|
|
- gr
|
|
subresources:
|
|
status: {}
|
|
additionalPrinterColumns:
|
|
- name: Policy
|
|
type: string
|
|
description: The policy that resulted in the violation
|
|
JSONPath: .spec.policy
|
|
- name: ResourceKind
|
|
type: string
|
|
description: The resource kind that cause the violation
|
|
JSONPath: .spec.resource.kind
|
|
- name: ResourceName
|
|
type: string
|
|
description: The resource name that caused the violation
|
|
JSONPath: .spec.resource.name
|
|
- name: ResourceNamespace
|
|
type: string
|
|
description: The resource namespace that caused the violation
|
|
JSONPath: .spec.resource.namespace
|
|
- name: status
|
|
type: string
|
|
description: Current state of generate request
|
|
JSONPath: .status.state
|
|
- name: Age
|
|
type: date
|
|
JSONPath: .metadata.creationTimestamp
|
|
validation:
|
|
openAPIV3Schema:
|
|
properties:
|
|
spec:
|
|
required:
|
|
- policy
|
|
- resource
|
|
properties:
|
|
policy:
|
|
type: string
|
|
resource:
|
|
type: object
|
|
required:
|
|
- kind
|
|
- name
|
|
properties:
|
|
kind:
|
|
type: string
|
|
name:
|
|
type: string
|
|
namespace:
|
|
type: string
|
|
---
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: init-config
|
|
namespace: kyverno
|
|
data:
|
|
# resource types to be skipped by kyverno policy engine
|
|
resourceFilters: "[Event,*,*][*,kube-system,*][*,kube-public,*][*,kube-node-lease,*][Node,*,*][APIService,*,*][TokenReview,*,*][SubjectAccessReview,*,*][*,kyverno,*]"
|