From 56c14081e1764d61d0ada57c7e2b8998618c0095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?= Date: Sat, 9 Mar 2024 22:26:34 +0100 Subject: [PATCH] feat: add lookup operation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Charles-Edouard Brétéché --- .crds/chainsaw.kyverno.io_configurations.yaml | 68 +++ .crds/chainsaw.kyverno.io_tests.yaml | 275 ++++++++++++ .crds/chainsaw.kyverno.io_teststeps.yaml | 204 +++++++++ .../json/configuration-chainsaw-v1alpha1.json | 104 +++++ .schemas/json/test-chainsaw-v1alpha1.json | 416 ++++++++++++++++++ pkg/apis/v1alpha1/catch.go | 24 +- pkg/apis/v1alpha1/finally.go | 24 +- pkg/apis/v1alpha1/lookup.go | 32 ++ pkg/apis/v1alpha1/operation.go | 4 + pkg/apis/v1alpha1/zz_generated.deepcopy.go | 116 +++-- .../chainsaw.kyverno.io_configurations.yaml | 68 +++ pkg/data/crds/chainsaw.kyverno.io_tests.yaml | 275 ++++++++++++ .../crds/chainsaw.kyverno.io_teststeps.yaml | 204 +++++++++ .../json/configuration-chainsaw-v1alpha1.json | 104 +++++ .../schemas/json/test-chainsaw-v1alpha1.json | 416 ++++++++++++++++++ pkg/validation/test/catch.go | 20 +- pkg/validation/test/finally.go | 20 +- pkg/validation/test/lookup.go | 16 + pkg/validation/test/operation.go | 4 + website/docs/apis/chainsaw.v1alpha1.md | 47 +- 20 files changed, 2365 insertions(+), 76 deletions(-) create mode 100644 pkg/apis/v1alpha1/lookup.go create mode 100644 pkg/validation/test/lookup.go diff --git a/.crds/chainsaw.kyverno.io_configurations.yaml b/.crds/chainsaw.kyverno.io_configurations.yaml index b0fa76fc5..223ed826f 100644 --- a/.crds/chainsaw.kyverno.io_configurations.yaml +++ b/.crds/chainsaw.kyverno.io_configurations.yaml @@ -312,6 +312,74 @@ spec: timeout set in the Configuration. type: string type: object + lookup: + description: Lookup determines the resource lookup to execute. + properties: + bindings: + description: Bindings defines additional binding key/values. + items: + description: Binding represents a key/value set as a binding + in an executing test. + properties: + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + cluster: + description: Cluster defines the target cluster (default + cluster will be used if not specified and/or overridden). + type: string + file: + description: File is the path to the referenced file. This + can be a direct path to a file or an expression that matches + multiple files, such as "manifest/*.yaml" for all YAML + files within the "manifest" directory. + type: string + outputs: + description: Outputs defines output bindings. + items: + description: Output represents an output binding with + a match to determine if the binding must be considered + or not. + properties: + match: + description: Match defines the matching statement. + type: object + x-kubernetes-preserve-unknown-fields: true + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + resource: + description: Resource provides a resource to be applied. + type: object + x-kubernetes-embedded-resource: true + x-kubernetes-preserve-unknown-fields: true + template: + description: Template determines whether resources should + be considered for templating. + type: boolean + timeout: + description: Timeout for the operation. Overrides the global + timeout set in the Configuration. + type: string + type: object podLogs: description: PodLogs determines the pod logs collector to execute. properties: diff --git a/.crds/chainsaw.kyverno.io_tests.yaml b/.crds/chainsaw.kyverno.io_tests.yaml index 9b2e7af9f..be674f40b 100644 --- a/.crds/chainsaw.kyverno.io_tests.yaml +++ b/.crds/chainsaw.kyverno.io_tests.yaml @@ -329,6 +329,74 @@ spec: timeout set in the Configuration. type: string type: object + lookup: + description: Lookup determines the resource lookup to execute. + properties: + bindings: + description: Bindings defines additional binding key/values. + items: + description: Binding represents a key/value set as a binding + in an executing test. + properties: + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + cluster: + description: Cluster defines the target cluster (default + cluster will be used if not specified and/or overridden). + type: string + file: + description: File is the path to the referenced file. This + can be a direct path to a file or an expression that matches + multiple files, such as "manifest/*.yaml" for all YAML + files within the "manifest" directory. + type: string + outputs: + description: Outputs defines output bindings. + items: + description: Output represents an output binding with + a match to determine if the binding must be considered + or not. + properties: + match: + description: Match defines the matching statement. + type: object + x-kubernetes-preserve-unknown-fields: true + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + resource: + description: Resource provides a resource to be applied. + type: object + x-kubernetes-embedded-resource: true + x-kubernetes-preserve-unknown-fields: true + template: + description: Template determines whether resources should + be considered for templating. + type: boolean + timeout: + description: Timeout for the operation. Overrides the global + timeout set in the Configuration. + type: string + type: object podLogs: description: PodLogs determines the pod logs collector to execute. properties: @@ -866,6 +934,75 @@ spec: the global timeout set in the Configuration. type: string type: object + lookup: + description: Lookup determines the resource lookup to + execute. + properties: + bindings: + description: Bindings defines additional binding key/values. + items: + description: Binding represents a key/value set + as a binding in an executing test. + properties: + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + cluster: + description: Cluster defines the target cluster (default + cluster will be used if not specified and/or overridden). + type: string + file: + description: File is the path to the referenced file. + This can be a direct path to a file or an expression + that matches multiple files, such as "manifest/*.yaml" + for all YAML files within the "manifest" directory. + type: string + outputs: + description: Outputs defines output bindings. + items: + description: Output represents an output binding + with a match to determine if the binding must + be considered or not. + properties: + match: + description: Match defines the matching statement. + type: object + x-kubernetes-preserve-unknown-fields: true + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + resource: + description: Resource provides a resource to be applied. + type: object + x-kubernetes-embedded-resource: true + x-kubernetes-preserve-unknown-fields: true + template: + description: Template determines whether resources + should be considered for templating. + type: boolean + timeout: + description: Timeout for the operation. Overrides + the global timeout set in the Configuration. + type: string + type: object podLogs: description: PodLogs determines the pod logs collector to execute. @@ -1359,6 +1496,75 @@ spec: the global timeout set in the Configuration. type: string type: object + lookup: + description: Lookup determines the resource lookup to + execute. + properties: + bindings: + description: Bindings defines additional binding key/values. + items: + description: Binding represents a key/value set + as a binding in an executing test. + properties: + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + cluster: + description: Cluster defines the target cluster (default + cluster will be used if not specified and/or overridden). + type: string + file: + description: File is the path to the referenced file. + This can be a direct path to a file or an expression + that matches multiple files, such as "manifest/*.yaml" + for all YAML files within the "manifest" directory. + type: string + outputs: + description: Outputs defines output bindings. + items: + description: Output represents an output binding + with a match to determine if the binding must + be considered or not. + properties: + match: + description: Match defines the matching statement. + type: object + x-kubernetes-preserve-unknown-fields: true + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + resource: + description: Resource provides a resource to be applied. + type: object + x-kubernetes-embedded-resource: true + x-kubernetes-preserve-unknown-fields: true + template: + description: Template determines whether resources + should be considered for templating. + type: boolean + timeout: + description: Timeout for the operation. Overrides + the global timeout set in the Configuration. + type: string + type: object podLogs: description: PodLogs determines the pod logs collector to execute. @@ -2068,6 +2274,75 @@ spec: the global timeout set in the Configuration. type: string type: object + lookup: + description: Lookup determines the resource lookup to + execute. + properties: + bindings: + description: Bindings defines additional binding key/values. + items: + description: Binding represents a key/value set + as a binding in an executing test. + properties: + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + cluster: + description: Cluster defines the target cluster (default + cluster will be used if not specified and/or overridden). + type: string + file: + description: File is the path to the referenced file. + This can be a direct path to a file or an expression + that matches multiple files, such as "manifest/*.yaml" + for all YAML files within the "manifest" directory. + type: string + outputs: + description: Outputs defines output bindings. + items: + description: Output represents an output binding + with a match to determine if the binding must + be considered or not. + properties: + match: + description: Match defines the matching statement. + type: object + x-kubernetes-preserve-unknown-fields: true + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + resource: + description: Resource provides a resource to be applied. + type: object + x-kubernetes-embedded-resource: true + x-kubernetes-preserve-unknown-fields: true + template: + description: Template determines whether resources + should be considered for templating. + type: boolean + timeout: + description: Timeout for the operation. Overrides + the global timeout set in the Configuration. + type: string + type: object patch: description: Patch represents a patch operation. properties: diff --git a/.crds/chainsaw.kyverno.io_teststeps.yaml b/.crds/chainsaw.kyverno.io_teststeps.yaml index 9ae65a96c..33e42b3e9 100644 --- a/.crds/chainsaw.kyverno.io_teststeps.yaml +++ b/.crds/chainsaw.kyverno.io_teststeps.yaml @@ -329,6 +329,74 @@ spec: timeout set in the Configuration. type: string type: object + lookup: + description: Lookup determines the resource lookup to execute. + properties: + bindings: + description: Bindings defines additional binding key/values. + items: + description: Binding represents a key/value set as a binding + in an executing test. + properties: + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + cluster: + description: Cluster defines the target cluster (default + cluster will be used if not specified and/or overridden). + type: string + file: + description: File is the path to the referenced file. This + can be a direct path to a file or an expression that matches + multiple files, such as "manifest/*.yaml" for all YAML + files within the "manifest" directory. + type: string + outputs: + description: Outputs defines output bindings. + items: + description: Output represents an output binding with + a match to determine if the binding must be considered + or not. + properties: + match: + description: Match defines the matching statement. + type: object + x-kubernetes-preserve-unknown-fields: true + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + resource: + description: Resource provides a resource to be applied. + type: object + x-kubernetes-embedded-resource: true + x-kubernetes-preserve-unknown-fields: true + template: + description: Template determines whether resources should + be considered for templating. + type: boolean + timeout: + description: Timeout for the operation. Overrides the global + timeout set in the Configuration. + type: string + type: object podLogs: description: PodLogs determines the pod logs collector to execute. properties: @@ -801,6 +869,74 @@ spec: timeout set in the Configuration. type: string type: object + lookup: + description: Lookup determines the resource lookup to execute. + properties: + bindings: + description: Bindings defines additional binding key/values. + items: + description: Binding represents a key/value set as a binding + in an executing test. + properties: + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + cluster: + description: Cluster defines the target cluster (default + cluster will be used if not specified and/or overridden). + type: string + file: + description: File is the path to the referenced file. This + can be a direct path to a file or an expression that matches + multiple files, such as "manifest/*.yaml" for all YAML + files within the "manifest" directory. + type: string + outputs: + description: Outputs defines output bindings. + items: + description: Output represents an output binding with + a match to determine if the binding must be considered + or not. + properties: + match: + description: Match defines the matching statement. + type: object + x-kubernetes-preserve-unknown-fields: true + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + resource: + description: Resource provides a resource to be applied. + type: object + x-kubernetes-embedded-resource: true + x-kubernetes-preserve-unknown-fields: true + template: + description: Template determines whether resources should + be considered for templating. + type: boolean + timeout: + description: Timeout for the operation. Overrides the global + timeout set in the Configuration. + type: string + type: object podLogs: description: PodLogs determines the pod logs collector to execute. properties: @@ -1486,6 +1622,74 @@ spec: timeout set in the Configuration. type: string type: object + lookup: + description: Lookup determines the resource lookup to execute. + properties: + bindings: + description: Bindings defines additional binding key/values. + items: + description: Binding represents a key/value set as a binding + in an executing test. + properties: + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + cluster: + description: Cluster defines the target cluster (default + cluster will be used if not specified and/or overridden). + type: string + file: + description: File is the path to the referenced file. This + can be a direct path to a file or an expression that matches + multiple files, such as "manifest/*.yaml" for all YAML + files within the "manifest" directory. + type: string + outputs: + description: Outputs defines output bindings. + items: + description: Output represents an output binding with + a match to determine if the binding must be considered + or not. + properties: + match: + description: Match defines the matching statement. + type: object + x-kubernetes-preserve-unknown-fields: true + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + resource: + description: Resource provides a resource to be applied. + type: object + x-kubernetes-embedded-resource: true + x-kubernetes-preserve-unknown-fields: true + template: + description: Template determines whether resources should + be considered for templating. + type: boolean + timeout: + description: Timeout for the operation. Overrides the global + timeout set in the Configuration. + type: string + type: object patch: description: Patch represents a patch operation. properties: diff --git a/.schemas/json/configuration-chainsaw-v1alpha1.json b/.schemas/json/configuration-chainsaw-v1alpha1.json index 098d22dd3..d138be974 100644 --- a/.schemas/json/configuration-chainsaw-v1alpha1.json +++ b/.schemas/json/configuration-chainsaw-v1alpha1.json @@ -772,6 +772,110 @@ } } }, + "lookup": { + "description": "Lookup determines the resource lookup to execute.", + "type": [ + "object", + "null" + ], + "properties": { + "bindings": { + "description": "Bindings defines additional binding key/values.", + "type": [ + "array", + "null" + ], + "items": { + "description": "Binding represents a key/value set as a binding in an executing test.", + "type": [ + "object", + "null" + ], + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "description": "Name the name of the binding.", + "type": "string", + "pattern": "^(?:\\w+|\\(.+\\))$" + }, + "value": { + "description": "Value value of the binding.", + "x-kubernetes-preserve-unknown-fields": true + } + } + } + }, + "cluster": { + "description": "Cluster defines the target cluster (default cluster will be used if not specified and/or overridden).", + "type": [ + "string", + "null" + ] + }, + "file": { + "description": "File is the path to the referenced file. This can be a direct path to a file or an expression that matches multiple files, such as \"manifest/*.yaml\" for all YAML files within the \"manifest\" directory.", + "type": [ + "string", + "null" + ] + }, + "outputs": { + "description": "Outputs defines output bindings.", + "type": [ + "array", + "null" + ], + "items": { + "description": "Output represents an output binding with a match to determine if the binding must be considered or not.", + "type": [ + "object", + "null" + ], + "required": [ + "name", + "value" + ], + "properties": { + "match": { + "description": "Match defines the matching statement.", + "x-kubernetes-preserve-unknown-fields": true + }, + "name": { + "description": "Name the name of the binding.", + "type": "string", + "pattern": "^(?:\\w+|\\(.+\\))$" + }, + "value": { + "description": "Value value of the binding.", + "x-kubernetes-preserve-unknown-fields": true + } + } + } + }, + "resource": { + "description": "Resource provides a resource to be applied.", + "x-kubernetes-embedded-resource": true, + "x-kubernetes-preserve-unknown-fields": true + }, + "template": { + "description": "Template determines whether resources should be considered for templating.", + "type": [ + "boolean", + "null" + ] + }, + "timeout": { + "description": "Timeout for the operation. Overrides the global timeout set in the Configuration.", + "type": [ + "string", + "null" + ] + } + } + }, "podLogs": { "description": "PodLogs determines the pod logs collector to execute.", "type": [ diff --git a/.schemas/json/test-chainsaw-v1alpha1.json b/.schemas/json/test-chainsaw-v1alpha1.json index 00ca79cd5..3e7dc3ce3 100644 --- a/.schemas/json/test-chainsaw-v1alpha1.json +++ b/.schemas/json/test-chainsaw-v1alpha1.json @@ -804,6 +804,110 @@ } } }, + "lookup": { + "description": "Lookup determines the resource lookup to execute.", + "type": [ + "object", + "null" + ], + "properties": { + "bindings": { + "description": "Bindings defines additional binding key/values.", + "type": [ + "array", + "null" + ], + "items": { + "description": "Binding represents a key/value set as a binding in an executing test.", + "type": [ + "object", + "null" + ], + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "description": "Name the name of the binding.", + "type": "string", + "pattern": "^(?:\\w+|\\(.+\\))$" + }, + "value": { + "description": "Value value of the binding.", + "x-kubernetes-preserve-unknown-fields": true + } + } + } + }, + "cluster": { + "description": "Cluster defines the target cluster (default cluster will be used if not specified and/or overridden).", + "type": [ + "string", + "null" + ] + }, + "file": { + "description": "File is the path to the referenced file. This can be a direct path to a file or an expression that matches multiple files, such as \"manifest/*.yaml\" for all YAML files within the \"manifest\" directory.", + "type": [ + "string", + "null" + ] + }, + "outputs": { + "description": "Outputs defines output bindings.", + "type": [ + "array", + "null" + ], + "items": { + "description": "Output represents an output binding with a match to determine if the binding must be considered or not.", + "type": [ + "object", + "null" + ], + "required": [ + "name", + "value" + ], + "properties": { + "match": { + "description": "Match defines the matching statement.", + "x-kubernetes-preserve-unknown-fields": true + }, + "name": { + "description": "Name the name of the binding.", + "type": "string", + "pattern": "^(?:\\w+|\\(.+\\))$" + }, + "value": { + "description": "Value value of the binding.", + "x-kubernetes-preserve-unknown-fields": true + } + } + } + }, + "resource": { + "description": "Resource provides a resource to be applied.", + "x-kubernetes-embedded-resource": true, + "x-kubernetes-preserve-unknown-fields": true + }, + "template": { + "description": "Template determines whether resources should be considered for templating.", + "type": [ + "boolean", + "null" + ] + }, + "timeout": { + "description": "Timeout for the operation. Overrides the global timeout set in the Configuration.", + "type": [ + "string", + "null" + ] + } + } + }, "podLogs": { "description": "PodLogs determines the pod logs collector to execute.", "type": [ @@ -1723,6 +1827,110 @@ } } }, + "lookup": { + "description": "Lookup determines the resource lookup to execute.", + "type": [ + "object", + "null" + ], + "properties": { + "bindings": { + "description": "Bindings defines additional binding key/values.", + "type": [ + "array", + "null" + ], + "items": { + "description": "Binding represents a key/value set as a binding in an executing test.", + "type": [ + "object", + "null" + ], + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "description": "Name the name of the binding.", + "type": "string", + "pattern": "^(?:\\w+|\\(.+\\))$" + }, + "value": { + "description": "Value value of the binding.", + "x-kubernetes-preserve-unknown-fields": true + } + } + } + }, + "cluster": { + "description": "Cluster defines the target cluster (default cluster will be used if not specified and/or overridden).", + "type": [ + "string", + "null" + ] + }, + "file": { + "description": "File is the path to the referenced file. This can be a direct path to a file or an expression that matches multiple files, such as \"manifest/*.yaml\" for all YAML files within the \"manifest\" directory.", + "type": [ + "string", + "null" + ] + }, + "outputs": { + "description": "Outputs defines output bindings.", + "type": [ + "array", + "null" + ], + "items": { + "description": "Output represents an output binding with a match to determine if the binding must be considered or not.", + "type": [ + "object", + "null" + ], + "required": [ + "name", + "value" + ], + "properties": { + "match": { + "description": "Match defines the matching statement.", + "x-kubernetes-preserve-unknown-fields": true + }, + "name": { + "description": "Name the name of the binding.", + "type": "string", + "pattern": "^(?:\\w+|\\(.+\\))$" + }, + "value": { + "description": "Value value of the binding.", + "x-kubernetes-preserve-unknown-fields": true + } + } + } + }, + "resource": { + "description": "Resource provides a resource to be applied.", + "x-kubernetes-embedded-resource": true, + "x-kubernetes-preserve-unknown-fields": true + }, + "template": { + "description": "Template determines whether resources should be considered for templating.", + "type": [ + "boolean", + "null" + ] + }, + "timeout": { + "description": "Timeout for the operation. Overrides the global timeout set in the Configuration.", + "type": [ + "string", + "null" + ] + } + } + }, "podLogs": { "description": "PodLogs determines the pod logs collector to execute.", "type": [ @@ -2554,6 +2762,110 @@ } } }, + "lookup": { + "description": "Lookup determines the resource lookup to execute.", + "type": [ + "object", + "null" + ], + "properties": { + "bindings": { + "description": "Bindings defines additional binding key/values.", + "type": [ + "array", + "null" + ], + "items": { + "description": "Binding represents a key/value set as a binding in an executing test.", + "type": [ + "object", + "null" + ], + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "description": "Name the name of the binding.", + "type": "string", + "pattern": "^(?:\\w+|\\(.+\\))$" + }, + "value": { + "description": "Value value of the binding.", + "x-kubernetes-preserve-unknown-fields": true + } + } + } + }, + "cluster": { + "description": "Cluster defines the target cluster (default cluster will be used if not specified and/or overridden).", + "type": [ + "string", + "null" + ] + }, + "file": { + "description": "File is the path to the referenced file. This can be a direct path to a file or an expression that matches multiple files, such as \"manifest/*.yaml\" for all YAML files within the \"manifest\" directory.", + "type": [ + "string", + "null" + ] + }, + "outputs": { + "description": "Outputs defines output bindings.", + "type": [ + "array", + "null" + ], + "items": { + "description": "Output represents an output binding with a match to determine if the binding must be considered or not.", + "type": [ + "object", + "null" + ], + "required": [ + "name", + "value" + ], + "properties": { + "match": { + "description": "Match defines the matching statement.", + "x-kubernetes-preserve-unknown-fields": true + }, + "name": { + "description": "Name the name of the binding.", + "type": "string", + "pattern": "^(?:\\w+|\\(.+\\))$" + }, + "value": { + "description": "Value value of the binding.", + "x-kubernetes-preserve-unknown-fields": true + } + } + } + }, + "resource": { + "description": "Resource provides a resource to be applied.", + "x-kubernetes-embedded-resource": true, + "x-kubernetes-preserve-unknown-fields": true + }, + "template": { + "description": "Template determines whether resources should be considered for templating.", + "type": [ + "boolean", + "null" + ] + }, + "timeout": { + "description": "Timeout for the operation. Overrides the global timeout set in the Configuration.", + "type": [ + "string", + "null" + ] + } + } + }, "podLogs": { "description": "PodLogs determines the pod logs collector to execute.", "type": [ @@ -3667,6 +3979,110 @@ } } }, + "lookup": { + "description": "Lookup determines the resource lookup to execute.", + "type": [ + "object", + "null" + ], + "properties": { + "bindings": { + "description": "Bindings defines additional binding key/values.", + "type": [ + "array", + "null" + ], + "items": { + "description": "Binding represents a key/value set as a binding in an executing test.", + "type": [ + "object", + "null" + ], + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "description": "Name the name of the binding.", + "type": "string", + "pattern": "^(?:\\w+|\\(.+\\))$" + }, + "value": { + "description": "Value value of the binding.", + "x-kubernetes-preserve-unknown-fields": true + } + } + } + }, + "cluster": { + "description": "Cluster defines the target cluster (default cluster will be used if not specified and/or overridden).", + "type": [ + "string", + "null" + ] + }, + "file": { + "description": "File is the path to the referenced file. This can be a direct path to a file or an expression that matches multiple files, such as \"manifest/*.yaml\" for all YAML files within the \"manifest\" directory.", + "type": [ + "string", + "null" + ] + }, + "outputs": { + "description": "Outputs defines output bindings.", + "type": [ + "array", + "null" + ], + "items": { + "description": "Output represents an output binding with a match to determine if the binding must be considered or not.", + "type": [ + "object", + "null" + ], + "required": [ + "name", + "value" + ], + "properties": { + "match": { + "description": "Match defines the matching statement.", + "x-kubernetes-preserve-unknown-fields": true + }, + "name": { + "description": "Name the name of the binding.", + "type": "string", + "pattern": "^(?:\\w+|\\(.+\\))$" + }, + "value": { + "description": "Value value of the binding.", + "x-kubernetes-preserve-unknown-fields": true + } + } + } + }, + "resource": { + "description": "Resource provides a resource to be applied.", + "x-kubernetes-embedded-resource": true, + "x-kubernetes-preserve-unknown-fields": true + }, + "template": { + "description": "Template determines whether resources should be considered for templating.", + "type": [ + "boolean", + "null" + ] + }, + "timeout": { + "description": "Timeout for the operation. Overrides the global timeout set in the Configuration.", + "type": [ + "string", + "null" + ] + } + } + }, "patch": { "description": "Patch represents a patch operation.", "type": [ diff --git a/pkg/apis/v1alpha1/catch.go b/pkg/apis/v1alpha1/catch.go index 1da4ccf0a..733e47c5c 100644 --- a/pkg/apis/v1alpha1/catch.go +++ b/pkg/apis/v1alpha1/catch.go @@ -6,33 +6,33 @@ type Catch struct { // +optional Description string `json:"description,omitempty"` - // PodLogs determines the pod logs collector to execute. + // Command defines a command to run. // +optional - PodLogs *PodLogs `json:"podLogs,omitempty"` + Command *Command `json:"command,omitempty"` - // Events determines the events collector to execute. + // Delete represents a deletion operation. // +optional - Events *Events `json:"events,omitempty"` + Delete *Delete `json:"delete,omitempty"` // Describe determines the resource describe collector to execute. // +optional Describe *Describe `json:"describe,omitempty"` - // Wait determines the resource wait collector to execute. + // Events determines the events collector to execute. // +optional - Wait *Wait `json:"wait,omitempty"` + Events *Events `json:"events,omitempty"` // Get determines the resource get collector to execute. // +optional Get *Get `json:"get,omitempty"` - // Delete represents a deletion operation. + // Lookup determines the resource lookup to execute. // +optional - Delete *Delete `json:"delete,omitempty"` + Lookup *Lookup `json:"lookup,omitempty"` - // Command defines a command to run. + // PodLogs determines the pod logs collector to execute. // +optional - Command *Command `json:"command,omitempty"` + PodLogs *PodLogs `json:"podLogs,omitempty"` // Script defines a script to run. // +optional @@ -41,4 +41,8 @@ type Catch struct { // Sleep defines zzzz. // +optional Sleep *Sleep `json:"sleep,omitempty"` + + // Wait determines the resource wait collector to execute. + // +optional + Wait *Wait `json:"wait,omitempty"` } diff --git a/pkg/apis/v1alpha1/finally.go b/pkg/apis/v1alpha1/finally.go index 4be9a1713..6ebab43fc 100644 --- a/pkg/apis/v1alpha1/finally.go +++ b/pkg/apis/v1alpha1/finally.go @@ -6,33 +6,33 @@ type Finally struct { // +optional Description string `json:"description,omitempty"` - // PodLogs determines the pod logs collector to execute. + // Command defines a command to run. // +optional - PodLogs *PodLogs `json:"podLogs,omitempty"` + Command *Command `json:"command,omitempty"` - // Events determines the events collector to execute. + // Delete represents a deletion operation. // +optional - Events *Events `json:"events,omitempty"` + Delete *Delete `json:"delete,omitempty"` // Describe determines the resource describe collector to execute. // +optional Describe *Describe `json:"describe,omitempty"` - // Wait determines the resource wait collector to execute. + // Events determines the events collector to execute. // +optional - Wait *Wait `json:"wait,omitempty"` + Events *Events `json:"events,omitempty"` // Get determines the resource get collector to execute. // +optional Get *Get `json:"get,omitempty"` - // Delete represents a deletion operation. + // Lookup determines the resource lookup to execute. // +optional - Delete *Delete `json:"delete,omitempty"` + Lookup *Lookup `json:"lookup,omitempty"` - // Command defines a command to run. + // PodLogs determines the pod logs collector to execute. // +optional - Command *Command `json:"command,omitempty"` + PodLogs *PodLogs `json:"podLogs,omitempty"` // Script defines a script to run. // +optional @@ -41,4 +41,8 @@ type Finally struct { // Sleep defines zzzz. // +optional Sleep *Sleep `json:"sleep,omitempty"` + + // Wait determines the resource wait collector to execute. + // +optional + Wait *Wait `json:"wait,omitempty"` } diff --git a/pkg/apis/v1alpha1/lookup.go b/pkg/apis/v1alpha1/lookup.go new file mode 100644 index 000000000..d1bb0f851 --- /dev/null +++ b/pkg/apis/v1alpha1/lookup.go @@ -0,0 +1,32 @@ +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// Lookup represents a set of resources that should be looked up. +// If a resource doesn't exist in the cluster it will fail. +type Lookup struct { + // Timeout for the operation. Overrides the global timeout set in the Configuration. + // +optional + Timeout *metav1.Duration `json:"timeout,omitempty"` + + // Bindings defines additional binding key/values. + // +optional + Bindings []Binding `json:"bindings,omitempty"` + + // Outputs defines output bindings. + // +optional + Outputs []Output `json:"outputs,omitempty"` + + // Cluster defines the target cluster (default cluster will be used if not specified and/or overridden). + // +optional + Cluster string `json:"cluster,omitempty"` + + // FileRefOrResource provides a reference to the file containing the resources to be created. + FileRefOrResource `json:",inline"` + + // Template determines whether resources should be considered for templating. + // +optional + Template *bool `json:"template,omitempty"` +} diff --git a/pkg/apis/v1alpha1/operation.go b/pkg/apis/v1alpha1/operation.go index ff38e2a97..68414d03d 100644 --- a/pkg/apis/v1alpha1/operation.go +++ b/pkg/apis/v1alpha1/operation.go @@ -37,6 +37,10 @@ type Operation struct { // +optional Error *Error `json:"error,omitempty"` + // Lookup determines the resource lookup to execute. + // +optional + Lookup *Lookup `json:"lookup,omitempty"` + // Patch represents a patch operation. // +optional Patch *Patch `json:"patch,omitempty"` diff --git a/pkg/apis/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/v1alpha1/zz_generated.deepcopy.go index 0c226148e..ba999d6b7 100644 --- a/pkg/apis/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/v1alpha1/zz_generated.deepcopy.go @@ -133,14 +133,14 @@ func (in *Binding) DeepCopy() *Binding { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Catch) DeepCopyInto(out *Catch) { *out = *in - if in.PodLogs != nil { - in, out := &in.PodLogs, &out.PodLogs - *out = new(PodLogs) + if in.Command != nil { + in, out := &in.Command, &out.Command + *out = new(Command) (*in).DeepCopyInto(*out) } - if in.Events != nil { - in, out := &in.Events, &out.Events - *out = new(Events) + if in.Delete != nil { + in, out := &in.Delete, &out.Delete + *out = new(Delete) (*in).DeepCopyInto(*out) } if in.Describe != nil { @@ -148,9 +148,9 @@ func (in *Catch) DeepCopyInto(out *Catch) { *out = new(Describe) (*in).DeepCopyInto(*out) } - if in.Wait != nil { - in, out := &in.Wait, &out.Wait - *out = new(Wait) + if in.Events != nil { + in, out := &in.Events, &out.Events + *out = new(Events) (*in).DeepCopyInto(*out) } if in.Get != nil { @@ -158,14 +158,14 @@ func (in *Catch) DeepCopyInto(out *Catch) { *out = new(Get) (*in).DeepCopyInto(*out) } - if in.Delete != nil { - in, out := &in.Delete, &out.Delete - *out = new(Delete) + if in.Lookup != nil { + in, out := &in.Lookup, &out.Lookup + *out = new(Lookup) (*in).DeepCopyInto(*out) } - if in.Command != nil { - in, out := &in.Command, &out.Command - *out = new(Command) + if in.PodLogs != nil { + in, out := &in.PodLogs, &out.PodLogs + *out = new(PodLogs) (*in).DeepCopyInto(*out) } if in.Script != nil { @@ -178,6 +178,11 @@ func (in *Catch) DeepCopyInto(out *Catch) { *out = new(Sleep) **out = **in } + if in.Wait != nil { + in, out := &in.Wait, &out.Wait + *out = new(Wait) + (*in).DeepCopyInto(*out) + } return } @@ -642,14 +647,14 @@ func (in *FileRefOrResource) DeepCopy() *FileRefOrResource { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Finally) DeepCopyInto(out *Finally) { *out = *in - if in.PodLogs != nil { - in, out := &in.PodLogs, &out.PodLogs - *out = new(PodLogs) + if in.Command != nil { + in, out := &in.Command, &out.Command + *out = new(Command) (*in).DeepCopyInto(*out) } - if in.Events != nil { - in, out := &in.Events, &out.Events - *out = new(Events) + if in.Delete != nil { + in, out := &in.Delete, &out.Delete + *out = new(Delete) (*in).DeepCopyInto(*out) } if in.Describe != nil { @@ -657,9 +662,9 @@ func (in *Finally) DeepCopyInto(out *Finally) { *out = new(Describe) (*in).DeepCopyInto(*out) } - if in.Wait != nil { - in, out := &in.Wait, &out.Wait - *out = new(Wait) + if in.Events != nil { + in, out := &in.Events, &out.Events + *out = new(Events) (*in).DeepCopyInto(*out) } if in.Get != nil { @@ -667,14 +672,14 @@ func (in *Finally) DeepCopyInto(out *Finally) { *out = new(Get) (*in).DeepCopyInto(*out) } - if in.Delete != nil { - in, out := &in.Delete, &out.Delete - *out = new(Delete) + if in.Lookup != nil { + in, out := &in.Lookup, &out.Lookup + *out = new(Lookup) (*in).DeepCopyInto(*out) } - if in.Command != nil { - in, out := &in.Command, &out.Command - *out = new(Command) + if in.PodLogs != nil { + in, out := &in.PodLogs, &out.PodLogs + *out = new(PodLogs) (*in).DeepCopyInto(*out) } if in.Script != nil { @@ -687,6 +692,11 @@ func (in *Finally) DeepCopyInto(out *Finally) { *out = new(Sleep) **out = **in } + if in.Wait != nil { + in, out := &in.Wait, &out.Wait + *out = new(Wait) + (*in).DeepCopyInto(*out) + } return } @@ -749,6 +759,47 @@ func (in *Get) DeepCopy() *Get { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Lookup) DeepCopyInto(out *Lookup) { + *out = *in + if in.Timeout != nil { + in, out := &in.Timeout, &out.Timeout + *out = new(v1.Duration) + **out = **in + } + if in.Bindings != nil { + in, out := &in.Bindings, &out.Bindings + *out = make([]Binding, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Outputs != nil { + in, out := &in.Outputs, &out.Outputs + *out = make([]Output, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.FileRefOrResource.DeepCopyInto(&out.FileRefOrResource) + if in.Template != nil { + in, out := &in.Template, &out.Template + *out = new(bool) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Lookup. +func (in *Lookup) DeepCopy() *Lookup { + if in == nil { + return nil + } + out := new(Lookup) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ObjectLabelsSelector) DeepCopyInto(out *ObjectLabelsSelector) { *out = *in @@ -860,6 +911,11 @@ func (in *Operation) DeepCopyInto(out *Operation) { *out = new(Error) (*in).DeepCopyInto(*out) } + if in.Lookup != nil { + in, out := &in.Lookup, &out.Lookup + *out = new(Lookup) + (*in).DeepCopyInto(*out) + } if in.Patch != nil { in, out := &in.Patch, &out.Patch *out = new(Patch) diff --git a/pkg/data/crds/chainsaw.kyverno.io_configurations.yaml b/pkg/data/crds/chainsaw.kyverno.io_configurations.yaml index b0fa76fc5..223ed826f 100644 --- a/pkg/data/crds/chainsaw.kyverno.io_configurations.yaml +++ b/pkg/data/crds/chainsaw.kyverno.io_configurations.yaml @@ -312,6 +312,74 @@ spec: timeout set in the Configuration. type: string type: object + lookup: + description: Lookup determines the resource lookup to execute. + properties: + bindings: + description: Bindings defines additional binding key/values. + items: + description: Binding represents a key/value set as a binding + in an executing test. + properties: + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + cluster: + description: Cluster defines the target cluster (default + cluster will be used if not specified and/or overridden). + type: string + file: + description: File is the path to the referenced file. This + can be a direct path to a file or an expression that matches + multiple files, such as "manifest/*.yaml" for all YAML + files within the "manifest" directory. + type: string + outputs: + description: Outputs defines output bindings. + items: + description: Output represents an output binding with + a match to determine if the binding must be considered + or not. + properties: + match: + description: Match defines the matching statement. + type: object + x-kubernetes-preserve-unknown-fields: true + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + resource: + description: Resource provides a resource to be applied. + type: object + x-kubernetes-embedded-resource: true + x-kubernetes-preserve-unknown-fields: true + template: + description: Template determines whether resources should + be considered for templating. + type: boolean + timeout: + description: Timeout for the operation. Overrides the global + timeout set in the Configuration. + type: string + type: object podLogs: description: PodLogs determines the pod logs collector to execute. properties: diff --git a/pkg/data/crds/chainsaw.kyverno.io_tests.yaml b/pkg/data/crds/chainsaw.kyverno.io_tests.yaml index 9b2e7af9f..be674f40b 100644 --- a/pkg/data/crds/chainsaw.kyverno.io_tests.yaml +++ b/pkg/data/crds/chainsaw.kyverno.io_tests.yaml @@ -329,6 +329,74 @@ spec: timeout set in the Configuration. type: string type: object + lookup: + description: Lookup determines the resource lookup to execute. + properties: + bindings: + description: Bindings defines additional binding key/values. + items: + description: Binding represents a key/value set as a binding + in an executing test. + properties: + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + cluster: + description: Cluster defines the target cluster (default + cluster will be used if not specified and/or overridden). + type: string + file: + description: File is the path to the referenced file. This + can be a direct path to a file or an expression that matches + multiple files, such as "manifest/*.yaml" for all YAML + files within the "manifest" directory. + type: string + outputs: + description: Outputs defines output bindings. + items: + description: Output represents an output binding with + a match to determine if the binding must be considered + or not. + properties: + match: + description: Match defines the matching statement. + type: object + x-kubernetes-preserve-unknown-fields: true + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + resource: + description: Resource provides a resource to be applied. + type: object + x-kubernetes-embedded-resource: true + x-kubernetes-preserve-unknown-fields: true + template: + description: Template determines whether resources should + be considered for templating. + type: boolean + timeout: + description: Timeout for the operation. Overrides the global + timeout set in the Configuration. + type: string + type: object podLogs: description: PodLogs determines the pod logs collector to execute. properties: @@ -866,6 +934,75 @@ spec: the global timeout set in the Configuration. type: string type: object + lookup: + description: Lookup determines the resource lookup to + execute. + properties: + bindings: + description: Bindings defines additional binding key/values. + items: + description: Binding represents a key/value set + as a binding in an executing test. + properties: + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + cluster: + description: Cluster defines the target cluster (default + cluster will be used if not specified and/or overridden). + type: string + file: + description: File is the path to the referenced file. + This can be a direct path to a file or an expression + that matches multiple files, such as "manifest/*.yaml" + for all YAML files within the "manifest" directory. + type: string + outputs: + description: Outputs defines output bindings. + items: + description: Output represents an output binding + with a match to determine if the binding must + be considered or not. + properties: + match: + description: Match defines the matching statement. + type: object + x-kubernetes-preserve-unknown-fields: true + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + resource: + description: Resource provides a resource to be applied. + type: object + x-kubernetes-embedded-resource: true + x-kubernetes-preserve-unknown-fields: true + template: + description: Template determines whether resources + should be considered for templating. + type: boolean + timeout: + description: Timeout for the operation. Overrides + the global timeout set in the Configuration. + type: string + type: object podLogs: description: PodLogs determines the pod logs collector to execute. @@ -1359,6 +1496,75 @@ spec: the global timeout set in the Configuration. type: string type: object + lookup: + description: Lookup determines the resource lookup to + execute. + properties: + bindings: + description: Bindings defines additional binding key/values. + items: + description: Binding represents a key/value set + as a binding in an executing test. + properties: + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + cluster: + description: Cluster defines the target cluster (default + cluster will be used if not specified and/or overridden). + type: string + file: + description: File is the path to the referenced file. + This can be a direct path to a file or an expression + that matches multiple files, such as "manifest/*.yaml" + for all YAML files within the "manifest" directory. + type: string + outputs: + description: Outputs defines output bindings. + items: + description: Output represents an output binding + with a match to determine if the binding must + be considered or not. + properties: + match: + description: Match defines the matching statement. + type: object + x-kubernetes-preserve-unknown-fields: true + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + resource: + description: Resource provides a resource to be applied. + type: object + x-kubernetes-embedded-resource: true + x-kubernetes-preserve-unknown-fields: true + template: + description: Template determines whether resources + should be considered for templating. + type: boolean + timeout: + description: Timeout for the operation. Overrides + the global timeout set in the Configuration. + type: string + type: object podLogs: description: PodLogs determines the pod logs collector to execute. @@ -2068,6 +2274,75 @@ spec: the global timeout set in the Configuration. type: string type: object + lookup: + description: Lookup determines the resource lookup to + execute. + properties: + bindings: + description: Bindings defines additional binding key/values. + items: + description: Binding represents a key/value set + as a binding in an executing test. + properties: + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + cluster: + description: Cluster defines the target cluster (default + cluster will be used if not specified and/or overridden). + type: string + file: + description: File is the path to the referenced file. + This can be a direct path to a file or an expression + that matches multiple files, such as "manifest/*.yaml" + for all YAML files within the "manifest" directory. + type: string + outputs: + description: Outputs defines output bindings. + items: + description: Output represents an output binding + with a match to determine if the binding must + be considered or not. + properties: + match: + description: Match defines the matching statement. + type: object + x-kubernetes-preserve-unknown-fields: true + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + resource: + description: Resource provides a resource to be applied. + type: object + x-kubernetes-embedded-resource: true + x-kubernetes-preserve-unknown-fields: true + template: + description: Template determines whether resources + should be considered for templating. + type: boolean + timeout: + description: Timeout for the operation. Overrides + the global timeout set in the Configuration. + type: string + type: object patch: description: Patch represents a patch operation. properties: diff --git a/pkg/data/crds/chainsaw.kyverno.io_teststeps.yaml b/pkg/data/crds/chainsaw.kyverno.io_teststeps.yaml index 9ae65a96c..33e42b3e9 100644 --- a/pkg/data/crds/chainsaw.kyverno.io_teststeps.yaml +++ b/pkg/data/crds/chainsaw.kyverno.io_teststeps.yaml @@ -329,6 +329,74 @@ spec: timeout set in the Configuration. type: string type: object + lookup: + description: Lookup determines the resource lookup to execute. + properties: + bindings: + description: Bindings defines additional binding key/values. + items: + description: Binding represents a key/value set as a binding + in an executing test. + properties: + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + cluster: + description: Cluster defines the target cluster (default + cluster will be used if not specified and/or overridden). + type: string + file: + description: File is the path to the referenced file. This + can be a direct path to a file or an expression that matches + multiple files, such as "manifest/*.yaml" for all YAML + files within the "manifest" directory. + type: string + outputs: + description: Outputs defines output bindings. + items: + description: Output represents an output binding with + a match to determine if the binding must be considered + or not. + properties: + match: + description: Match defines the matching statement. + type: object + x-kubernetes-preserve-unknown-fields: true + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + resource: + description: Resource provides a resource to be applied. + type: object + x-kubernetes-embedded-resource: true + x-kubernetes-preserve-unknown-fields: true + template: + description: Template determines whether resources should + be considered for templating. + type: boolean + timeout: + description: Timeout for the operation. Overrides the global + timeout set in the Configuration. + type: string + type: object podLogs: description: PodLogs determines the pod logs collector to execute. properties: @@ -801,6 +869,74 @@ spec: timeout set in the Configuration. type: string type: object + lookup: + description: Lookup determines the resource lookup to execute. + properties: + bindings: + description: Bindings defines additional binding key/values. + items: + description: Binding represents a key/value set as a binding + in an executing test. + properties: + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + cluster: + description: Cluster defines the target cluster (default + cluster will be used if not specified and/or overridden). + type: string + file: + description: File is the path to the referenced file. This + can be a direct path to a file or an expression that matches + multiple files, such as "manifest/*.yaml" for all YAML + files within the "manifest" directory. + type: string + outputs: + description: Outputs defines output bindings. + items: + description: Output represents an output binding with + a match to determine if the binding must be considered + or not. + properties: + match: + description: Match defines the matching statement. + type: object + x-kubernetes-preserve-unknown-fields: true + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + resource: + description: Resource provides a resource to be applied. + type: object + x-kubernetes-embedded-resource: true + x-kubernetes-preserve-unknown-fields: true + template: + description: Template determines whether resources should + be considered for templating. + type: boolean + timeout: + description: Timeout for the operation. Overrides the global + timeout set in the Configuration. + type: string + type: object podLogs: description: PodLogs determines the pod logs collector to execute. properties: @@ -1486,6 +1622,74 @@ spec: timeout set in the Configuration. type: string type: object + lookup: + description: Lookup determines the resource lookup to execute. + properties: + bindings: + description: Bindings defines additional binding key/values. + items: + description: Binding represents a key/value set as a binding + in an executing test. + properties: + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + cluster: + description: Cluster defines the target cluster (default + cluster will be used if not specified and/or overridden). + type: string + file: + description: File is the path to the referenced file. This + can be a direct path to a file or an expression that matches + multiple files, such as "manifest/*.yaml" for all YAML + files within the "manifest" directory. + type: string + outputs: + description: Outputs defines output bindings. + items: + description: Output represents an output binding with + a match to determine if the binding must be considered + or not. + properties: + match: + description: Match defines the matching statement. + type: object + x-kubernetes-preserve-unknown-fields: true + name: + description: Name the name of the binding. + pattern: ^(?:\w+|\(.+\))$ + type: string + value: + description: Value value of the binding. + x-kubernetes-preserve-unknown-fields: true + required: + - name + - value + type: object + type: array + resource: + description: Resource provides a resource to be applied. + type: object + x-kubernetes-embedded-resource: true + x-kubernetes-preserve-unknown-fields: true + template: + description: Template determines whether resources should + be considered for templating. + type: boolean + timeout: + description: Timeout for the operation. Overrides the global + timeout set in the Configuration. + type: string + type: object patch: description: Patch represents a patch operation. properties: diff --git a/pkg/data/schemas/json/configuration-chainsaw-v1alpha1.json b/pkg/data/schemas/json/configuration-chainsaw-v1alpha1.json index 098d22dd3..d138be974 100644 --- a/pkg/data/schemas/json/configuration-chainsaw-v1alpha1.json +++ b/pkg/data/schemas/json/configuration-chainsaw-v1alpha1.json @@ -772,6 +772,110 @@ } } }, + "lookup": { + "description": "Lookup determines the resource lookup to execute.", + "type": [ + "object", + "null" + ], + "properties": { + "bindings": { + "description": "Bindings defines additional binding key/values.", + "type": [ + "array", + "null" + ], + "items": { + "description": "Binding represents a key/value set as a binding in an executing test.", + "type": [ + "object", + "null" + ], + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "description": "Name the name of the binding.", + "type": "string", + "pattern": "^(?:\\w+|\\(.+\\))$" + }, + "value": { + "description": "Value value of the binding.", + "x-kubernetes-preserve-unknown-fields": true + } + } + } + }, + "cluster": { + "description": "Cluster defines the target cluster (default cluster will be used if not specified and/or overridden).", + "type": [ + "string", + "null" + ] + }, + "file": { + "description": "File is the path to the referenced file. This can be a direct path to a file or an expression that matches multiple files, such as \"manifest/*.yaml\" for all YAML files within the \"manifest\" directory.", + "type": [ + "string", + "null" + ] + }, + "outputs": { + "description": "Outputs defines output bindings.", + "type": [ + "array", + "null" + ], + "items": { + "description": "Output represents an output binding with a match to determine if the binding must be considered or not.", + "type": [ + "object", + "null" + ], + "required": [ + "name", + "value" + ], + "properties": { + "match": { + "description": "Match defines the matching statement.", + "x-kubernetes-preserve-unknown-fields": true + }, + "name": { + "description": "Name the name of the binding.", + "type": "string", + "pattern": "^(?:\\w+|\\(.+\\))$" + }, + "value": { + "description": "Value value of the binding.", + "x-kubernetes-preserve-unknown-fields": true + } + } + } + }, + "resource": { + "description": "Resource provides a resource to be applied.", + "x-kubernetes-embedded-resource": true, + "x-kubernetes-preserve-unknown-fields": true + }, + "template": { + "description": "Template determines whether resources should be considered for templating.", + "type": [ + "boolean", + "null" + ] + }, + "timeout": { + "description": "Timeout for the operation. Overrides the global timeout set in the Configuration.", + "type": [ + "string", + "null" + ] + } + } + }, "podLogs": { "description": "PodLogs determines the pod logs collector to execute.", "type": [ diff --git a/pkg/data/schemas/json/test-chainsaw-v1alpha1.json b/pkg/data/schemas/json/test-chainsaw-v1alpha1.json index 00ca79cd5..3e7dc3ce3 100644 --- a/pkg/data/schemas/json/test-chainsaw-v1alpha1.json +++ b/pkg/data/schemas/json/test-chainsaw-v1alpha1.json @@ -804,6 +804,110 @@ } } }, + "lookup": { + "description": "Lookup determines the resource lookup to execute.", + "type": [ + "object", + "null" + ], + "properties": { + "bindings": { + "description": "Bindings defines additional binding key/values.", + "type": [ + "array", + "null" + ], + "items": { + "description": "Binding represents a key/value set as a binding in an executing test.", + "type": [ + "object", + "null" + ], + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "description": "Name the name of the binding.", + "type": "string", + "pattern": "^(?:\\w+|\\(.+\\))$" + }, + "value": { + "description": "Value value of the binding.", + "x-kubernetes-preserve-unknown-fields": true + } + } + } + }, + "cluster": { + "description": "Cluster defines the target cluster (default cluster will be used if not specified and/or overridden).", + "type": [ + "string", + "null" + ] + }, + "file": { + "description": "File is the path to the referenced file. This can be a direct path to a file or an expression that matches multiple files, such as \"manifest/*.yaml\" for all YAML files within the \"manifest\" directory.", + "type": [ + "string", + "null" + ] + }, + "outputs": { + "description": "Outputs defines output bindings.", + "type": [ + "array", + "null" + ], + "items": { + "description": "Output represents an output binding with a match to determine if the binding must be considered or not.", + "type": [ + "object", + "null" + ], + "required": [ + "name", + "value" + ], + "properties": { + "match": { + "description": "Match defines the matching statement.", + "x-kubernetes-preserve-unknown-fields": true + }, + "name": { + "description": "Name the name of the binding.", + "type": "string", + "pattern": "^(?:\\w+|\\(.+\\))$" + }, + "value": { + "description": "Value value of the binding.", + "x-kubernetes-preserve-unknown-fields": true + } + } + } + }, + "resource": { + "description": "Resource provides a resource to be applied.", + "x-kubernetes-embedded-resource": true, + "x-kubernetes-preserve-unknown-fields": true + }, + "template": { + "description": "Template determines whether resources should be considered for templating.", + "type": [ + "boolean", + "null" + ] + }, + "timeout": { + "description": "Timeout for the operation. Overrides the global timeout set in the Configuration.", + "type": [ + "string", + "null" + ] + } + } + }, "podLogs": { "description": "PodLogs determines the pod logs collector to execute.", "type": [ @@ -1723,6 +1827,110 @@ } } }, + "lookup": { + "description": "Lookup determines the resource lookup to execute.", + "type": [ + "object", + "null" + ], + "properties": { + "bindings": { + "description": "Bindings defines additional binding key/values.", + "type": [ + "array", + "null" + ], + "items": { + "description": "Binding represents a key/value set as a binding in an executing test.", + "type": [ + "object", + "null" + ], + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "description": "Name the name of the binding.", + "type": "string", + "pattern": "^(?:\\w+|\\(.+\\))$" + }, + "value": { + "description": "Value value of the binding.", + "x-kubernetes-preserve-unknown-fields": true + } + } + } + }, + "cluster": { + "description": "Cluster defines the target cluster (default cluster will be used if not specified and/or overridden).", + "type": [ + "string", + "null" + ] + }, + "file": { + "description": "File is the path to the referenced file. This can be a direct path to a file or an expression that matches multiple files, such as \"manifest/*.yaml\" for all YAML files within the \"manifest\" directory.", + "type": [ + "string", + "null" + ] + }, + "outputs": { + "description": "Outputs defines output bindings.", + "type": [ + "array", + "null" + ], + "items": { + "description": "Output represents an output binding with a match to determine if the binding must be considered or not.", + "type": [ + "object", + "null" + ], + "required": [ + "name", + "value" + ], + "properties": { + "match": { + "description": "Match defines the matching statement.", + "x-kubernetes-preserve-unknown-fields": true + }, + "name": { + "description": "Name the name of the binding.", + "type": "string", + "pattern": "^(?:\\w+|\\(.+\\))$" + }, + "value": { + "description": "Value value of the binding.", + "x-kubernetes-preserve-unknown-fields": true + } + } + } + }, + "resource": { + "description": "Resource provides a resource to be applied.", + "x-kubernetes-embedded-resource": true, + "x-kubernetes-preserve-unknown-fields": true + }, + "template": { + "description": "Template determines whether resources should be considered for templating.", + "type": [ + "boolean", + "null" + ] + }, + "timeout": { + "description": "Timeout for the operation. Overrides the global timeout set in the Configuration.", + "type": [ + "string", + "null" + ] + } + } + }, "podLogs": { "description": "PodLogs determines the pod logs collector to execute.", "type": [ @@ -2554,6 +2762,110 @@ } } }, + "lookup": { + "description": "Lookup determines the resource lookup to execute.", + "type": [ + "object", + "null" + ], + "properties": { + "bindings": { + "description": "Bindings defines additional binding key/values.", + "type": [ + "array", + "null" + ], + "items": { + "description": "Binding represents a key/value set as a binding in an executing test.", + "type": [ + "object", + "null" + ], + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "description": "Name the name of the binding.", + "type": "string", + "pattern": "^(?:\\w+|\\(.+\\))$" + }, + "value": { + "description": "Value value of the binding.", + "x-kubernetes-preserve-unknown-fields": true + } + } + } + }, + "cluster": { + "description": "Cluster defines the target cluster (default cluster will be used if not specified and/or overridden).", + "type": [ + "string", + "null" + ] + }, + "file": { + "description": "File is the path to the referenced file. This can be a direct path to a file or an expression that matches multiple files, such as \"manifest/*.yaml\" for all YAML files within the \"manifest\" directory.", + "type": [ + "string", + "null" + ] + }, + "outputs": { + "description": "Outputs defines output bindings.", + "type": [ + "array", + "null" + ], + "items": { + "description": "Output represents an output binding with a match to determine if the binding must be considered or not.", + "type": [ + "object", + "null" + ], + "required": [ + "name", + "value" + ], + "properties": { + "match": { + "description": "Match defines the matching statement.", + "x-kubernetes-preserve-unknown-fields": true + }, + "name": { + "description": "Name the name of the binding.", + "type": "string", + "pattern": "^(?:\\w+|\\(.+\\))$" + }, + "value": { + "description": "Value value of the binding.", + "x-kubernetes-preserve-unknown-fields": true + } + } + } + }, + "resource": { + "description": "Resource provides a resource to be applied.", + "x-kubernetes-embedded-resource": true, + "x-kubernetes-preserve-unknown-fields": true + }, + "template": { + "description": "Template determines whether resources should be considered for templating.", + "type": [ + "boolean", + "null" + ] + }, + "timeout": { + "description": "Timeout for the operation. Overrides the global timeout set in the Configuration.", + "type": [ + "string", + "null" + ] + } + } + }, "podLogs": { "description": "PodLogs determines the pod logs collector to execute.", "type": [ @@ -3667,6 +3979,110 @@ } } }, + "lookup": { + "description": "Lookup determines the resource lookup to execute.", + "type": [ + "object", + "null" + ], + "properties": { + "bindings": { + "description": "Bindings defines additional binding key/values.", + "type": [ + "array", + "null" + ], + "items": { + "description": "Binding represents a key/value set as a binding in an executing test.", + "type": [ + "object", + "null" + ], + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "description": "Name the name of the binding.", + "type": "string", + "pattern": "^(?:\\w+|\\(.+\\))$" + }, + "value": { + "description": "Value value of the binding.", + "x-kubernetes-preserve-unknown-fields": true + } + } + } + }, + "cluster": { + "description": "Cluster defines the target cluster (default cluster will be used if not specified and/or overridden).", + "type": [ + "string", + "null" + ] + }, + "file": { + "description": "File is the path to the referenced file. This can be a direct path to a file or an expression that matches multiple files, such as \"manifest/*.yaml\" for all YAML files within the \"manifest\" directory.", + "type": [ + "string", + "null" + ] + }, + "outputs": { + "description": "Outputs defines output bindings.", + "type": [ + "array", + "null" + ], + "items": { + "description": "Output represents an output binding with a match to determine if the binding must be considered or not.", + "type": [ + "object", + "null" + ], + "required": [ + "name", + "value" + ], + "properties": { + "match": { + "description": "Match defines the matching statement.", + "x-kubernetes-preserve-unknown-fields": true + }, + "name": { + "description": "Name the name of the binding.", + "type": "string", + "pattern": "^(?:\\w+|\\(.+\\))$" + }, + "value": { + "description": "Value value of the binding.", + "x-kubernetes-preserve-unknown-fields": true + } + } + } + }, + "resource": { + "description": "Resource provides a resource to be applied.", + "x-kubernetes-embedded-resource": true, + "x-kubernetes-preserve-unknown-fields": true + }, + "template": { + "description": "Template determines whether resources should be considered for templating.", + "type": [ + "boolean", + "null" + ] + }, + "timeout": { + "description": "Timeout for the operation. Overrides the global timeout set in the Configuration.", + "type": [ + "string", + "null" + ] + } + } + }, "patch": { "description": "Patch represents a patch operation.", "type": [ diff --git a/pkg/validation/test/catch.go b/pkg/validation/test/catch.go index 27ea1862e..192472b3b 100644 --- a/pkg/validation/test/catch.go +++ b/pkg/validation/test/catch.go @@ -10,22 +10,25 @@ import ( func ValidateCatch(path *field.Path, obj v1alpha1.Catch) field.ErrorList { var errs field.ErrorList count := 0 - if obj.PodLogs != nil { + if obj.Command != nil { count++ } - if obj.Events != nil { + if obj.Delete != nil { count++ } if obj.Describe != nil { count++ } + if obj.Events != nil { + count++ + } if obj.Get != nil { count++ } - if obj.Delete != nil { + if obj.Lookup != nil { count++ } - if obj.Command != nil { + if obj.PodLogs != nil { count++ } if obj.Script != nil { @@ -42,13 +45,14 @@ func ValidateCatch(path *field.Path, obj v1alpha1.Catch) field.ErrorList { } else if count > 1 { errs = append(errs, field.Invalid(path, obj, fmt.Sprintf("only one statement is allowed per operation (found %d)", count))) } else { - errs = append(errs, ValidatePodLogs(path.Child("podLogs"), obj.PodLogs)...) - errs = append(errs, ValidateEvents(path.Child("events"), obj.Events)...) errs = append(errs, ValidateCommand(path.Child("command"), obj.Command)...) - errs = append(errs, ValidateScript(path.Child("script"), obj.Script)...) + errs = append(errs, ValidateDelete(path.Child("delete"), obj.Delete)...) errs = append(errs, ValidateDescribe(path.Child("describe"), obj.Describe)...) + errs = append(errs, ValidateEvents(path.Child("events"), obj.Events)...) errs = append(errs, ValidateGet(path.Child("get"), obj.Get)...) - errs = append(errs, ValidateDelete(path.Child("delete"), obj.Delete)...) + errs = append(errs, ValidateLookup(path.Child("lookup"), obj.Lookup)...) + errs = append(errs, ValidatePodLogs(path.Child("podLogs"), obj.PodLogs)...) + errs = append(errs, ValidateScript(path.Child("script"), obj.Script)...) errs = append(errs, ValidateWait(path.Child("wait"), obj.Wait)...) } return errs diff --git a/pkg/validation/test/finally.go b/pkg/validation/test/finally.go index 4cd45a3d6..480dbeb04 100644 --- a/pkg/validation/test/finally.go +++ b/pkg/validation/test/finally.go @@ -10,22 +10,25 @@ import ( func ValidateFinally(path *field.Path, obj v1alpha1.Finally) field.ErrorList { var errs field.ErrorList count := 0 - if obj.PodLogs != nil { + if obj.Command != nil { count++ } - if obj.Events != nil { + if obj.Delete != nil { count++ } if obj.Describe != nil { count++ } + if obj.Events != nil { + count++ + } if obj.Get != nil { count++ } - if obj.Delete != nil { + if obj.Lookup != nil { count++ } - if obj.Command != nil { + if obj.PodLogs != nil { count++ } if obj.Script != nil { @@ -42,13 +45,14 @@ func ValidateFinally(path *field.Path, obj v1alpha1.Finally) field.ErrorList { } else if count > 1 { errs = append(errs, field.Invalid(path, obj, fmt.Sprintf("only one statement is allowed per operation (found %d)", count))) } else { - errs = append(errs, ValidatePodLogs(path.Child("podLogs"), obj.PodLogs)...) - errs = append(errs, ValidateEvents(path.Child("events"), obj.Events)...) errs = append(errs, ValidateCommand(path.Child("command"), obj.Command)...) - errs = append(errs, ValidateScript(path.Child("script"), obj.Script)...) + errs = append(errs, ValidateDelete(path.Child("delete"), obj.Delete)...) errs = append(errs, ValidateDescribe(path.Child("describe"), obj.Describe)...) + errs = append(errs, ValidateEvents(path.Child("events"), obj.Events)...) errs = append(errs, ValidateGet(path.Child("get"), obj.Get)...) - errs = append(errs, ValidateDelete(path.Child("delete"), obj.Delete)...) + errs = append(errs, ValidateLookup(path.Child("lookup"), obj.Lookup)...) + errs = append(errs, ValidatePodLogs(path.Child("podLogs"), obj.PodLogs)...) + errs = append(errs, ValidateScript(path.Child("script"), obj.Script)...) errs = append(errs, ValidateWait(path.Child("wait"), obj.Wait)...) } return errs diff --git a/pkg/validation/test/lookup.go b/pkg/validation/test/lookup.go new file mode 100644 index 000000000..5d99a58c6 --- /dev/null +++ b/pkg/validation/test/lookup.go @@ -0,0 +1,16 @@ +package test + +import ( + "github.com/kyverno/chainsaw/pkg/apis/v1alpha1" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +func ValidateLookup(path *field.Path, obj *v1alpha1.Lookup) field.ErrorList { + var errs field.ErrorList + if obj != nil { + errs = append(errs, ValidateFileRefOrResource(path, obj.FileRefOrResource)...) + errs = append(errs, ValidateBindings(path.Child("bindings"), obj.Bindings...)...) + errs = append(errs, ValidateOutputs(path.Child("outputs"), obj.Outputs...)...) + } + return errs +} diff --git a/pkg/validation/test/operation.go b/pkg/validation/test/operation.go index 7065d2646..d4476d421 100644 --- a/pkg/validation/test/operation.go +++ b/pkg/validation/test/operation.go @@ -28,6 +28,9 @@ func ValidateOperation(path *field.Path, obj v1alpha1.Operation) field.ErrorList if obj.Error != nil { count++ } + if obj.Lookup != nil { + count++ + } if obj.Patch != nil { count++ } @@ -54,6 +57,7 @@ func ValidateOperation(path *field.Path, obj v1alpha1.Operation) field.ErrorList errs = append(errs, ValidateCreate(path.Child("create"), obj.Create)...) errs = append(errs, ValidateDelete(path.Child("delete"), obj.Delete)...) errs = append(errs, ValidateError(path.Child("error"), obj.Error)...) + errs = append(errs, ValidateLookup(path.Child("lookup"), obj.Lookup)...) errs = append(errs, ValidatePatch(path.Child("error"), obj.Patch)...) errs = append(errs, ValidateScript(path.Child("script"), obj.Script)...) errs = append(errs, ValidateUpdate(path.Child("update"), obj.Update)...) diff --git a/website/docs/apis/chainsaw.v1alpha1.md b/website/docs/apis/chainsaw.v1alpha1.md index 4114d1b85..b2e78b58d 100644 --- a/website/docs/apis/chainsaw.v1alpha1.md +++ b/website/docs/apis/chainsaw.v1alpha1.md @@ -99,6 +99,7 @@ during the testing process.

- [Create](#chainsaw-kyverno-io-v1alpha1-Create) - [Delete](#chainsaw-kyverno-io-v1alpha1-Delete) - [Error](#chainsaw-kyverno-io-v1alpha1-Error) +- [Lookup](#chainsaw-kyverno-io-v1alpha1-Lookup) - [Output](#chainsaw-kyverno-io-v1alpha1-Output) - [Patch](#chainsaw-kyverno-io-v1alpha1-Patch) - [Script](#chainsaw-kyverno-io-v1alpha1-Script) @@ -128,15 +129,16 @@ during the testing process.

| Field | Type | Required | Inline | Description | |---|---|---|---|---| | `description` | `string` | | |

Description contains a description of the operation.

| -| `podLogs` | [`PodLogs`](#chainsaw-kyverno-io-v1alpha1-PodLogs) | | |

PodLogs determines the pod logs collector to execute.

| -| `events` | [`Events`](#chainsaw-kyverno-io-v1alpha1-Events) | | |

Events determines the events collector to execute.

| +| `command` | [`Command`](#chainsaw-kyverno-io-v1alpha1-Command) | | |

Command defines a command to run.

| +| `delete` | [`Delete`](#chainsaw-kyverno-io-v1alpha1-Delete) | | |

Delete represents a deletion operation.

| | `describe` | [`Describe`](#chainsaw-kyverno-io-v1alpha1-Describe) | | |

Describe determines the resource describe collector to execute.

| -| `wait` | [`Wait`](#chainsaw-kyverno-io-v1alpha1-Wait) | | |

Wait determines the resource wait collector to execute.

| +| `events` | [`Events`](#chainsaw-kyverno-io-v1alpha1-Events) | | |

Events determines the events collector to execute.

| | `get` | [`Get`](#chainsaw-kyverno-io-v1alpha1-Get) | | |

Get determines the resource get collector to execute.

| -| `delete` | [`Delete`](#chainsaw-kyverno-io-v1alpha1-Delete) | | |

Delete represents a deletion operation.

| -| `command` | [`Command`](#chainsaw-kyverno-io-v1alpha1-Command) | | |

Command defines a command to run.

| +| `lookup` | [`Lookup`](#chainsaw-kyverno-io-v1alpha1-Lookup) | | |

Lookup determines the resource lookup to execute.

| +| `podLogs` | [`PodLogs`](#chainsaw-kyverno-io-v1alpha1-PodLogs) | | |

PodLogs determines the pod logs collector to execute.

| | `script` | [`Script`](#chainsaw-kyverno-io-v1alpha1-Script) | | |

Script defines a script to run.

| | `sleep` | [`Sleep`](#chainsaw-kyverno-io-v1alpha1-Sleep) | | |

Sleep defines zzzz.

| +| `wait` | [`Wait`](#chainsaw-kyverno-io-v1alpha1-Wait) | | |

Wait determines the resource wait collector to execute.

| ## `Cluster` {#chainsaw-kyverno-io-v1alpha1-Cluster} @@ -374,6 +376,7 @@ with a match filter to determine if the verification should be considered.

- [Apply](#chainsaw-kyverno-io-v1alpha1-Apply) - [Create](#chainsaw-kyverno-io-v1alpha1-Create) +- [Lookup](#chainsaw-kyverno-io-v1alpha1-Lookup) - [Patch](#chainsaw-kyverno-io-v1alpha1-Patch) - [Update](#chainsaw-kyverno-io-v1alpha1-Update) @@ -397,15 +400,16 @@ with a match filter to determine if the verification should be considered.

| Field | Type | Required | Inline | Description | |---|---|---|---|---| | `description` | `string` | | |

Description contains a description of the operation.

| -| `podLogs` | [`PodLogs`](#chainsaw-kyverno-io-v1alpha1-PodLogs) | | |

PodLogs determines the pod logs collector to execute.

| -| `events` | [`Events`](#chainsaw-kyverno-io-v1alpha1-Events) | | |

Events determines the events collector to execute.

| +| `command` | [`Command`](#chainsaw-kyverno-io-v1alpha1-Command) | | |

Command defines a command to run.

| +| `delete` | [`Delete`](#chainsaw-kyverno-io-v1alpha1-Delete) | | |

Delete represents a deletion operation.

| | `describe` | [`Describe`](#chainsaw-kyverno-io-v1alpha1-Describe) | | |

Describe determines the resource describe collector to execute.

| -| `wait` | [`Wait`](#chainsaw-kyverno-io-v1alpha1-Wait) | | |

Wait determines the resource wait collector to execute.

| +| `events` | [`Events`](#chainsaw-kyverno-io-v1alpha1-Events) | | |

Events determines the events collector to execute.

| | `get` | [`Get`](#chainsaw-kyverno-io-v1alpha1-Get) | | |

Get determines the resource get collector to execute.

| -| `delete` | [`Delete`](#chainsaw-kyverno-io-v1alpha1-Delete) | | |

Delete represents a deletion operation.

| -| `command` | [`Command`](#chainsaw-kyverno-io-v1alpha1-Command) | | |

Command defines a command to run.

| +| `lookup` | [`Lookup`](#chainsaw-kyverno-io-v1alpha1-Lookup) | | |

Lookup determines the resource lookup to execute.

| +| `podLogs` | [`PodLogs`](#chainsaw-kyverno-io-v1alpha1-PodLogs) | | |

PodLogs determines the pod logs collector to execute.

| | `script` | [`Script`](#chainsaw-kyverno-io-v1alpha1-Script) | | |

Script defines a script to run.

| | `sleep` | [`Sleep`](#chainsaw-kyverno-io-v1alpha1-Sleep) | | |

Sleep defines zzzz.

| +| `wait` | [`Wait`](#chainsaw-kyverno-io-v1alpha1-Wait) | | |

Wait determines the resource wait collector to execute.

| ## `For` {#chainsaw-kyverno-io-v1alpha1-For} @@ -452,6 +456,27 @@ with a match filter to determine if the verification should be considered.

| `ObjectLabelsSelector` | [`ObjectLabelsSelector`](#chainsaw-kyverno-io-v1alpha1-ObjectLabelsSelector) | :white_check_mark: | :white_check_mark: |

ObjectLabelsSelector determines the selection process of referenced objects.

| | `format` | [`Format`](#chainsaw-kyverno-io-v1alpha1-Format) | | |

Format determines the output format (json or yaml).

| +## `Lookup` {#chainsaw-kyverno-io-v1alpha1-Lookup} + +**Appears in:** + +- [Catch](#chainsaw-kyverno-io-v1alpha1-Catch) +- [Finally](#chainsaw-kyverno-io-v1alpha1-Finally) +- [Operation](#chainsaw-kyverno-io-v1alpha1-Operation) + +

Lookup represents a set of resources that should be looked up. +If a resource doesn't exist in the cluster it will fail.

+ + +| Field | Type | Required | Inline | Description | +|---|---|---|---|---| +| `timeout` | [`meta/v1.Duration`](https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1#Duration) | | |

Timeout for the operation. Overrides the global timeout set in the Configuration.

| +| `bindings` | [`[]Binding`](#chainsaw-kyverno-io-v1alpha1-Binding) | | |

Bindings defines additional binding key/values.

| +| `outputs` | [`[]Output`](#chainsaw-kyverno-io-v1alpha1-Output) | | |

Outputs defines output bindings.

| +| `cluster` | `string` | | |

Cluster defines the target cluster (default cluster will be used if not specified and/or overridden).

| +| `FileRefOrResource` | [`FileRefOrResource`](#chainsaw-kyverno-io-v1alpha1-FileRefOrResource) | :white_check_mark: | :white_check_mark: |

FileRefOrResource provides a reference to the file containing the resources to be created.

| +| `template` | `bool` | | |

Template determines whether resources should be considered for templating.

| + ## `ObjectLabelsSelector` {#chainsaw-kyverno-io-v1alpha1-ObjectLabelsSelector} **Appears in:** @@ -539,6 +564,7 @@ For multiple objects use labels.

| `create` | [`Create`](#chainsaw-kyverno-io-v1alpha1-Create) | | |

Create represents a creation operation.

| | `delete` | [`Delete`](#chainsaw-kyverno-io-v1alpha1-Delete) | | |

Delete represents a deletion operation.

| | `error` | [`Error`](#chainsaw-kyverno-io-v1alpha1-Error) | | |

Error represents the expected errors for this test step. If any of these errors occur, the test will consider them as expected; otherwise, they will be treated as test failures.

| +| `lookup` | [`Lookup`](#chainsaw-kyverno-io-v1alpha1-Lookup) | | |

Lookup determines the resource lookup to execute.

| | `patch` | [`Patch`](#chainsaw-kyverno-io-v1alpha1-Patch) | | |

Patch represents a patch operation.

| | `script` | [`Script`](#chainsaw-kyverno-io-v1alpha1-Script) | | |

Script defines a script to run.

| | `sleep` | [`Sleep`](#chainsaw-kyverno-io-v1alpha1-Sleep) | | |

Sleep defines zzzz.

| @@ -552,6 +578,7 @@ For multiple objects use labels.

- [Apply](#chainsaw-kyverno-io-v1alpha1-Apply) - [Command](#chainsaw-kyverno-io-v1alpha1-Command) - [Create](#chainsaw-kyverno-io-v1alpha1-Create) +- [Lookup](#chainsaw-kyverno-io-v1alpha1-Lookup) - [Patch](#chainsaw-kyverno-io-v1alpha1-Patch) - [Script](#chainsaw-kyverno-io-v1alpha1-Script) - [Update](#chainsaw-kyverno-io-v1alpha1-Update)