1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-05 23:46:56 +00:00
kyverno/cmd/cli/kubectl-kyverno/apis/v1alpha1/test.go
Anushka Mittal 66a2c7283b
chore: changes to use latest kyverno-json apis (#9980)
* changes to use latest kyverno-json apis

Signed-off-by: Anushka Mittal <anushka@nirmata.com>

* codegen diffs

Signed-off-by: Anushka Mittal <anushka@nirmata.com>

---------

Signed-off-by: Anushka Mittal <anushka@nirmata.com>
Co-authored-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
2024-04-02 14:35:26 +00:00

66 lines
1.9 KiB
Go

package v1alpha1
import (
"github.com/kyverno/kyverno-json/pkg/apis/policy/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +genclient
// +kubebuilder:object:root=true
// +kubebuilder:resource:scope="Cluster"
// Test declares a test
type Test struct {
metav1.TypeMeta `json:",inline,omitempty"`
metav1.ObjectMeta `json:"metadata,omitempty"`
// Name is the name of the test.
// This field is deprecated, use `metadata.name` instead
Name string `json:"name,omitempty"`
// Policies are the policies to be used in the test
Policies []string `json:"policies,omitempty"`
// Resources are the resource to be used in the test
Resources []string `json:"resources,omitempty"`
// Variables is the values to be used in the test
Variables string `json:"variables,omitempty"`
// UserInfo is the user info to be used in the test
UserInfo string `json:"userinfo,omitempty"`
// Results are the results to be checked in the test
Results []TestResult `json:"results,omitempty"`
// Checks are the verifications to be checked in the test
Checks []CheckResult `json:"checks,omitempty"`
// Values are the values to be used in the test
Values *ValuesSpec `json:"values,omitempty"`
// Policy Exceptions are the policy exceptions to be used in the test
PolicyExceptions []string `json:"exceptions,omitempty"`
}
type CheckResult struct {
// Match tells how to match relevant rule responses
Match CheckMatch `json:"match,omitempty"`
// Assert contains assertion to be performed on the relevant rule responses
Assert v1alpha1.Any `json:"assert"`
// Error contains negative assertion to be performed on the relevant rule responses
Error v1alpha1.Any `json:"error"`
}
type CheckMatch struct {
// Resource filters engine responses
Resource *v1alpha1.Any `json:"resource,omitempty"`
// Policy filters engine responses
Policy *v1alpha1.Any `json:"policy,omitempty"`
// Rule filters rule responses
Rule *v1alpha1.Any `json:"rule,omitempty"`
}