mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +00:00
add omitempty to types
This commit is contained in:
parent
38987d50c3
commit
e3a8cabe8d
1 changed files with 26 additions and 26 deletions
|
@ -56,13 +56,13 @@ type PolicyViolationList struct {
|
|||
type Policy struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
Spec Spec `json:"spec"`
|
||||
Spec Spec `json:"spec,omitempty"`
|
||||
Status PolicyStatus `json:"status"`
|
||||
}
|
||||
|
||||
// Spec describes policy behavior by its rules
|
||||
type Spec struct {
|
||||
Rules []Rule `json:"rules"`
|
||||
Rules []Rule `json:"rules,omitempty"`
|
||||
ValidationFailureAction string `json:"validationFailureAction"`
|
||||
}
|
||||
|
||||
|
@ -72,39 +72,39 @@ type Rule struct {
|
|||
Name string `json:"name"`
|
||||
MatchResources MatchResources `json:"match"`
|
||||
ExcludeResources ExcludeResources `json:"exclude,omitempty"`
|
||||
Mutation Mutation `json:"mutate"`
|
||||
Validation Validation `json:"validate"`
|
||||
Generation Generation `json:"generate"`
|
||||
Mutation Mutation `json:"mutate,omitempty"`
|
||||
Validation Validation `json:"validate,omitempty"`
|
||||
Generation Generation `json:"generate,omitempty"`
|
||||
}
|
||||
|
||||
//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"`
|
||||
Roles []string `json:"roles,omitempty"`
|
||||
ClusterRoles []string `json:"clusterRoles,omitempty"`
|
||||
Subjects []rbacv1.Subject `json:"subjects,omitempty"`
|
||||
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"`
|
||||
Roles []string `json:"roles,omitempty"`
|
||||
ClusterRoles []string `json:"clusterRoles,omitempty"`
|
||||
Subjects []rbacv1.Subject `json:"subjects,omitempty"`
|
||||
ResourceDescription `json:"resources,omitempty"`
|
||||
}
|
||||
|
||||
// ResourceDescription describes the resource to which the PolicyRule will be applied.
|
||||
type ResourceDescription struct {
|
||||
Kinds []string `json:"kinds"`
|
||||
Name string `json:"name"`
|
||||
Kinds []string `json:"kinds,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespaces []string `json:"namespaces,omitempty"`
|
||||
Selector *metav1.LabelSelector `json:"selector"`
|
||||
Selector *metav1.LabelSelector `json:"selector,omitempty"`
|
||||
}
|
||||
|
||||
// Mutation describes the way how Mutating Webhook will react on resource creation
|
||||
type Mutation struct {
|
||||
Overlay interface{} `json:"overlay"`
|
||||
Patches []Patch `json:"patches"`
|
||||
Overlay interface{} `json:"overlay,omitempty"`
|
||||
Patches []Patch `json:"patches,omitempty"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen=false
|
||||
|
@ -118,24 +118,24 @@ type Patch struct {
|
|||
|
||||
// Validation describes the way how Validating Webhook will check the resource on creation
|
||||
type Validation struct {
|
||||
Message string `json:"message"`
|
||||
Pattern interface{} `json:"pattern"`
|
||||
AnyPattern []interface{} `json:"anyPattern"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Pattern interface{} `json:"pattern,omitempty"`
|
||||
AnyPattern []interface{} `json:"anyPattern,omitempty"`
|
||||
}
|
||||
|
||||
// Generation describes which resources will be created when other resource is created
|
||||
type Generation struct {
|
||||
Kind string `json:"kind"`
|
||||
Name string `json:"name"`
|
||||
Data interface{} `json:"data"`
|
||||
Clone CloneFrom `json:"clone"`
|
||||
Kind string `json:"kind,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Data interface{} `json:"data,omitempty"`
|
||||
Clone CloneFrom `json:"clone,omitempty"`
|
||||
}
|
||||
|
||||
// CloneFrom - location of a Secret or a ConfigMap
|
||||
// which will be used as source when applying 'generate'
|
||||
type CloneFrom struct {
|
||||
Namespace string `json:"namespace"`
|
||||
Name string `json:"name"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
//PolicyStatus provides status for violations
|
||||
|
|
Loading…
Add table
Reference in a new issue