1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-10 09:56:55 +00:00
kyverno/cmd/cli/kubectl-kyverno/apis/v1alpha1/test_result.go

72 lines
2.9 KiB
Go
Raw Normal View History

package v1alpha1
import (
policyreportv1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2"
)
// TestResultBase declares a test result base fields
type TestResultBase struct {
// Policy mentions the name of the policy.
Policy string `json:"policy"`
// Rule mentions the name of the rule in the policy.
// It's required in case policy is a kyverno policy.
// +optional
Rule string `json:"rule,omitempty"`
// IsValidatingAdmissionPolicy indicates if the policy is a validating admission policy.
// It's required in case policy is a validating admission policy.
// +optional
IsValidatingAdmissionPolicy bool `json:"isValidatingAdmissionPolicy,omitempty"`
// Result mentions the result that the user is expecting.
// Possible values are pass, fail and skip.
Result policyreportv1alpha2.PolicyResult `json:"result"`
// Kind mentions the kind of the resource on which the policy is to be applied.
Kind string `json:"kind"`
chore: Add a new field in the test results CRD to specify patched resources (#11297) * chore: Add a new field in the test results CRD to specify patched resources - The currently existing PatchedResource field has a misleading name, leading to users believing that it can only take a yaml containing a single resource. Another field with proper naming is added until this field is removed completely. - Generate the new CRD from the struct. Signed-off-by: aerosouund <aerosound161@gmail.com> * Update cmd/cli/kubectl-kyverno/apis/v1alpha1/test_result.go Signed-off-by: Jim Bugwadia <jim@nirmata.com> * chore: use more chainsaw step templates (#11296) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * chore(deps): bump golangci/golangci-lint-action from 6.1.0 to 6.1.1 (#11298) Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6.1.0 to 6.1.1. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/aaa42aa0628b4ae2578232a66b541047968fac86...971e284b6050e8a5849b72094c50ab08da042db8) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore: use more chainsaw step templates (#11300) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * chore: use more chainsaw step templates (#11303) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: aerosouund <aerosound161@gmail.com> Signed-off-by: Jim Bugwadia <jim@nirmata.com> Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Jim Bugwadia <jim@nirmata.com> Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: shuting <shuting@nirmata.com>
2024-10-08 14:41:40 +03:00
// Deprecated. Use `patchedResources` instead.
// PatchedResource takes a resource configuration file in yaml format from
// the user to compare it against the Kyverno mutated resource configuration.
PatchedResource string `json:"patchedResource,omitempty"`
chore: Add a new field in the test results CRD to specify patched resources (#11297) * chore: Add a new field in the test results CRD to specify patched resources - The currently existing PatchedResource field has a misleading name, leading to users believing that it can only take a yaml containing a single resource. Another field with proper naming is added until this field is removed completely. - Generate the new CRD from the struct. Signed-off-by: aerosouund <aerosound161@gmail.com> * Update cmd/cli/kubectl-kyverno/apis/v1alpha1/test_result.go Signed-off-by: Jim Bugwadia <jim@nirmata.com> * chore: use more chainsaw step templates (#11296) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * chore(deps): bump golangci/golangci-lint-action from 6.1.0 to 6.1.1 (#11298) Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6.1.0 to 6.1.1. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/aaa42aa0628b4ae2578232a66b541047968fac86...971e284b6050e8a5849b72094c50ab08da042db8) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore: use more chainsaw step templates (#11300) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * chore: use more chainsaw step templates (#11303) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: aerosouund <aerosound161@gmail.com> Signed-off-by: Jim Bugwadia <jim@nirmata.com> Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Jim Bugwadia <jim@nirmata.com> Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: shuting <shuting@nirmata.com>
2024-10-08 14:41:40 +03:00
// PatchedResource takes a resource configuration file in yaml format from
// the user to compare it against the Kyverno mutated resource configuration.
// Multiple resources can be passed in the same file
PatchedResources string `json:"patchedResources,omitempty"`
// GeneratedResource takes a resource configuration file in yaml format from
// the user to compare it against the Kyverno generated resource configuration.
GeneratedResource string `json:"generatedResource,omitempty"`
// CloneSourceResource takes the resource configuration file in yaml format
// from the user which is meant to be cloned by the generate rule.
CloneSourceResource string `json:"cloneSourceResource,omitempty"`
}
// TestResultBase declares a test result deprecated fields
type TestResultDeprecated struct {
// Status mentions the status that the user is expecting.
// Possible values are pass, fail and skip.
// This is DEPRECATED, use `Result` instead.
Status policyreportv1alpha2.PolicyResult `json:"status,omitempty"`
// Resource mentions the name of the resource on which the policy is to be applied.
// This is DEPRECATED, use `Resources` instead.
Resource string `json:"resource,omitempty"`
// Namespace mentions the namespace of the policy which has namespace scope.
// This is DEPRECATED, use a name in the form `<namespace>/<name>` for policies and/or resources instead.
Namespace string `json:"namespace,omitempty"`
}
// TestResultBase declares a test result
type TestResult struct {
TestResultBase `json:",inline,omitempty"`
TestResultDeprecated `json:",inline,omitempty"`
// Resources gives us the list of resources on which the policy is going to be applied.
Resources []string `json:"resources"`
}