Skip to content

Commit 76a7c20

Browse files
authored
refactor: processors (#1777)
* refactor: engine bindings Signed-off-by: Charles-Edouard Brétéché <[email protected]> * refactor: processors Signed-off-by: Charles-Edouard Brétéché <[email protected]> * context data Signed-off-by: Charles-Edouard Brétéché <[email protected]> * rm dead code Signed-off-by: Charles-Edouard Brétéché <[email protected]> --------- Signed-off-by: Charles-Edouard Brétéché <[email protected]>
1 parent 2129593 commit 76a7c20

File tree

14 files changed

+182
-291
lines changed

14 files changed

+182
-291
lines changed

.crds/chainsaw.kyverno.io_configurations.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,7 @@ spec:
845845
tests (implies SkipClusterDelete).
846846
type: boolean
847847
template:
848+
default: true
848849
description: Template determines whether resources should be considered
849850
for templating.
850851
type: boolean

.schemas/json/configuration-chainsaw-v1alpha1.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1646,7 +1646,8 @@
16461646
"type": [
16471647
"boolean",
16481648
"null"
1649-
]
1649+
],
1650+
"default": true
16501651
},
16511652
"testFile": {
16521653
"description": "TestFile is the name of the file containing the test to run.\nIf no extension is provided, chainsaw will try with .yaml first and .yml if needed.",

pkg/apis/conversion/configuration.go

+3-9
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func Convert_v1alpha2_ConfigurationSpec_To_v1alpha1_ConfigurationSpec(in *v1alph
2727
out.ReportPath = in.Path
2828
out.ReportName = in.Name
2929
}
30-
out.Template = &in.Templating.Enabled
30+
out.Template = in.Templating.Enabled
3131
out.Timeouts = in.Timeouts
3232
return nil
3333
}
@@ -65,14 +65,8 @@ func Convert_v1alpha1_ConfigurationSpec_To_v1alpha2_ConfigurationSpec(in *v1alph
6565
Path: in.ReportPath,
6666
Name: in.ReportName,
6767
}
68-
if in.Template == nil {
69-
out.Templating = v1alpha2.TemplatingOptions{
70-
Enabled: true,
71-
}
72-
} else {
73-
out.Templating = v1alpha2.TemplatingOptions{
74-
Enabled: *in.Template,
75-
}
68+
out.Templating = v1alpha2.TemplatingOptions{
69+
Enabled: in.Template,
7670
}
7771
out.Timeouts = in.Timeouts
7872
return nil

pkg/apis/v1alpha1/configuration.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ type ConfigurationSpec struct {
3434

3535
// Template determines whether resources should be considered for templating.
3636
// +optional
37-
Template *bool `json:"template,omitempty"`
37+
// +kubebuilder:default:=true
38+
Template bool `json:"template"`
3839

3940
// FailFast determines whether the test should stop upon encountering the first failure.
4041
// +optional

pkg/apis/v1alpha1/zz_generated.deepcopy.go

-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/commands/test/command.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"github.com/kyverno/chainsaw/pkg/loaders/values"
1515
"github.com/kyverno/chainsaw/pkg/runner"
1616
"github.com/kyverno/chainsaw/pkg/runner/failer"
17-
"github.com/kyverno/chainsaw/pkg/runner/template"
1817
flagutils "github.com/kyverno/chainsaw/pkg/utils/flag"
1918
fsutils "github.com/kyverno/chainsaw/pkg/utils/fs"
2019
restutils "github.com/kyverno/chainsaw/pkg/utils/rest"
@@ -349,7 +348,7 @@ func Command() *cobra.Command {
349348
// namespace options
350349
cmd.Flags().StringVar(&options.namespace, "namespace", "", "Namespace to use for tests")
351350
// templating options
352-
cmd.Flags().BoolVar(&options.template, "template", template.DefaultTemplate, "If set, resources will be considered for templating")
351+
cmd.Flags().BoolVar(&options.template, "template", config.Spec.Templating.Enabled, "If set, resources will be considered for templating")
353352
// cleanup options
354353
cmd.Flags().BoolVar(&options.skipDelete, "skip-delete", false, "If set, do not delete the resources after running the tests")
355354
cmd.Flags().DurationVar(&options.delayBeforeCleanup.Duration, "cleanup-delay", 0, "Adds a delay between the time a test ends and the time cleanup starts")

pkg/data/crds/chainsaw.kyverno.io_configurations.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,7 @@ spec:
845845
tests (implies SkipClusterDelete).
846846
type: boolean
847847
template:
848+
default: true
848849
description: Template determines whether resources should be considered
849850
for templating.
850851
type: boolean

pkg/data/schemas/json/configuration-chainsaw-v1alpha1.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1646,7 +1646,8 @@
16461646
"type": [
16471647
"boolean",
16481648
"null"
1649-
]
1649+
],
1650+
"default": true
16501651
},
16511652
"testFile": {
16521653
"description": "TestFile is the name of the file containing the test to run.\nIf no extension is provided, chainsaw will try with .yaml first and .yml if needed.",

0 commit comments

Comments
 (0)