From 3e1cef790a1b31715054394702d447c9c41ec171 Mon Sep 17 00:00:00 2001 From: Mohan BE Date: Tue, 21 Jul 2020 11:33:51 +0530 Subject: [PATCH] added field type specification to types --- documentation/index.html | 26 +++++++++++++------------- go.sum | 6 ++++++ pkg/api/kyverno/v1/types.go | 24 ++++++++++++------------ 3 files changed, 31 insertions(+), 25 deletions(-) diff --git a/documentation/index.html b/documentation/index.html index eefcbc0d83..dd3fe0f311 100644 --- a/documentation/index.html +++ b/documentation/index.html @@ -323,7 +323,7 @@ string -

Policy is the name of the policy

+

Policy - The required field represents the name of the policy

@@ -726,7 +726,7 @@ string -

Policy is the name of the policy

+

Policy - The required field represents the name of the policy

@@ -805,7 +805,7 @@ string -

Message is the request status message

+

Message - An optional field is the request status message

@@ -1579,7 +1579,7 @@ string -

Kind represents resource kind

+

Kind - A required field represents resource kind

@@ -1590,7 +1590,7 @@ string -

Namespace represents resource namespace

+

Namespace - An optional field represents resource namespace

@@ -1601,7 +1601,7 @@ string -

Name represents resource name

+

Name -A required field represents resource name

@@ -1633,7 +1633,7 @@ string -

Name represents rule name

+

Name - A required field represents rule name

@@ -1646,7 +1646,7 @@ MatchResources -

MatchResources contains resources for which the rule has to be applied

+

MatchResources - A required field contains resources for which the rule has to be applied

@@ -1659,7 +1659,7 @@ ExcludeResources -

ExcludeResources contains resources for which rule can be excluded

+

ExcludeResources - An optional field contains resources for which rule can be excluded

@@ -1672,7 +1672,7 @@ ExcludeResources -

Conditions allow controlling policy rule execution

+

Conditions - An optional field allow controlling policy rule execution

@@ -1685,7 +1685,7 @@ Mutation -

Mutation contains patterns to mutate resources

+

Mutation - An optional field contains patterns to mutate resources

@@ -1698,7 +1698,7 @@ Validation -

Validation contains patterns to validate resources

+

Validation - An optional field contains patterns to validate resources

@@ -1711,7 +1711,7 @@ Generation -

Generation contains patterns to create additional resources

+

Generation - An optional field contains patterns to create additional resources

diff --git a/go.sum b/go.sum index 9d798488d1..6a3ba75118 100644 --- a/go.sum +++ b/go.sum @@ -502,6 +502,7 @@ github.com/hashicorp/vault/api v1.0.4/go.mod h1:gDcqh3WGcR1cpF5AJz/B1UFheUEneMoI github.com/hashicorp/vault/sdk v0.1.13/go.mod h1:B+hVj7TpuQY1Y/GPbCpffmgd+tSEwvhkWnjtSYCaS2M= github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= +github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= @@ -678,6 +679,7 @@ github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.11.0 h1:JAKSXpt1YjtLA7YpPiqO9ss6sNXEsPfSGdwN0UHqzrw= github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v0.0.0-20190113212917-5533ce8a0da3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= @@ -685,6 +687,7 @@ github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5 github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.8.1 h1:C5Dqfs/LeauYDX0jJXIe2SWmwCbGzx9yF8C8xy3Lh34= github.com/onsi/gomega v1.8.1/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= @@ -1068,6 +1071,7 @@ golang.org/x/tools v0.0.0-20190711191110-9a621aea19f8/go.mod h1:jcCCGcm9btYwXyDq golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200226224502-204d844ad48d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gomodules.xyz/jsonpatch/v2 v2.0.1/go.mod h1:IhYNNY4jnS53ZnfE4PAmpKtDpTCj1JFXc+3mwe7XcUU= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= @@ -1116,6 +1120,7 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw= @@ -1138,6 +1143,7 @@ gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/square/go-jose.v2 v2.1.9/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= diff --git a/pkg/api/kyverno/v1/types.go b/pkg/api/kyverno/v1/types.go index 69124b0d99..fc8e9f1f41 100644 --- a/pkg/api/kyverno/v1/types.go +++ b/pkg/api/kyverno/v1/types.go @@ -21,7 +21,7 @@ type GenerateRequest struct { //GenerateRequestSpec stores the request specification type GenerateRequestSpec struct { - // Policy is the name of the policy + // Policy - The required field represents the name of the policy Policy string `json:"policy"` // ResourceSpec is the information to identify the generate request Resource ResourceSpec `json:"resource"` @@ -49,7 +49,7 @@ type RequestInfo struct { type GenerateRequestStatus struct { // State represents state of the generate request State GenerateRequestState `json:"state"` - // Message is the request status message + // Message - An optional field is the request status message Message string `json:"message,omitempty"` // This will track the resources that are generated by the generate Policy // Will be used during clean up resources @@ -147,19 +147,19 @@ type Spec struct { // Rule is set of mutation, validation and generation actions // for the single resource description type Rule struct { - // Name represents rule name + // Name - A required field represents rule name Name string `json:"name"` - // MatchResources contains resources for which the rule has to be applied + // MatchResources - A required field contains resources for which the rule has to be applied MatchResources MatchResources `json:"match"` - // ExcludeResources contains resources for which rule can be excluded + // ExcludeResources - An optional field contains resources for which rule can be excluded ExcludeResources ExcludeResources `json:"exclude,omitempty"` - // Conditions allow controlling policy rule execution + // Conditions - An optional field allow controlling policy rule execution Conditions []Condition `json:"preconditions,omitempty"` - // Mutation contains patterns to mutate resources + // Mutation - An optional field contains patterns to mutate resources Mutation Mutation `json:"mutate,omitempty"` - // Validation contains patterns to validate resources + // Validation - An optional field contains patterns to validate resources Validation Validation `json:"validate,omitempty"` - // Generation contains patterns to create additional resources + // Generation - An optional field contains patterns to create additional resources Generation Generation `json:"generate,omitempty"` } @@ -345,11 +345,11 @@ type PolicyViolationSpec struct { // ResourceSpec information to identify the resource type ResourceSpec struct { - // Kind represents resource kind + // Kind - A required field represents resource kind Kind string `json:"kind"` - // Namespace represents resource namespace + // Namespace - An optional field represents resource namespace Namespace string `json:"namespace,omitempty"` - // Name represents resource name + // Name -A required field represents resource name Name string `json:"name"` }