From 0676fd81983be1748d3114ea5028e3047cb852a4 Mon Sep 17 00:00:00 2001 From: jeremyharisch Date: Fri, 24 Nov 2023 15:07:04 +0100 Subject: [PATCH 01/13] Quick safe --- cmd/kyma/alpha/create/module/module.go | 2 +- cmd/kyma/alpha/create/module/moduleconfig.go | 1 + pkg/module/template.go | 14 ++++++++++--- pkg/module/template_test.go | 21 ++++++++++++++------ 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/cmd/kyma/alpha/create/module/module.go b/cmd/kyma/alpha/create/module/module.go index 69849b556..e5269dc63 100644 --- a/cmd/kyma/alpha/create/module/module.go +++ b/cmd/kyma/alpha/create/module/module.go @@ -397,7 +397,7 @@ func (cmd *command) Run(ctx context.Context) error { annotations := cmd.getModuleTemplateAnnotations(modCnf, crValidator) template, err := module.Template(componentVersionAccess, resourceName, namespace, - channel, modDef.DefaultCR, labels, annotations, modDef.CustomStateChecks) + channel, modDef.DefaultCR, labels, annotations, modDef.CustomStateChecks, modCnf.Mandatory) if err != nil { cmd.CurrentStep.Failure() return err diff --git a/cmd/kyma/alpha/create/module/moduleconfig.go b/cmd/kyma/alpha/create/module/moduleconfig.go index 5f70915ec..49979ebb1 100644 --- a/cmd/kyma/alpha/create/module/moduleconfig.go +++ b/cmd/kyma/alpha/create/module/moduleconfig.go @@ -17,6 +17,7 @@ type Config struct { Version string `yaml:"version"` //required, the version of the Module Channel string `yaml:"channel"` //required, channel that should be used in the ModuleTemplate ManifestPath string `yaml:"manifest"` //required, reference to the manifests, must be a relative file name. + Mandatory bool `yaml:"mandatory"` //required, indicates whether the module is mandatory to be installed on all clusters. DefaultCRPath string `yaml:"defaultCR"` //optional, reference to a YAML file containing the default CR for the module, must be a relative file name. ResourceName string `yaml:"resourceName"` //optional, default={NAME}-{CHANNEL}, the name for the ModuleTemplate that will be created Namespace string `yaml:"namespace"` //optional, default=kcp-system, the namespace where the ModuleTemplate will be deployed diff --git a/pkg/module/template.go b/pkg/module/template.go index b10552a1c..d33ead417 100644 --- a/pkg/module/template.go +++ b/pkg/module/template.go @@ -3,10 +3,11 @@ package module import ( "bytes" "fmt" - "github.com/kyma-project/lifecycle-manager/api/v1beta2" "strings" "text/template" + "github.com/kyma-project/lifecycle-manager/api/v1beta2" + "github.com/open-component-model/ocm/pkg/contexts/ocm" "github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc" "sigs.k8s.io/yaml" @@ -48,6 +49,7 @@ spec: {{- end}} descriptor: {{yaml .Descriptor | printf "%s" | indent 4}} + mandatory: {{.Mandatory}} ` ) @@ -60,10 +62,12 @@ type moduleTemplateData struct { Labels map[string]string Annotations map[string]string CustomStateChecks []v1beta2.CustomStateCheck + Mandatory bool } func Template(remote ocm.ComponentVersionAccess, moduleTemplateName, namespace, channel string, data []byte, - labels, annotations map[string]string, customsStateChecks []v1beta2.CustomStateCheck) ([]byte, error) { + labels, annotations map[string]string, customsStateChecks []v1beta2.CustomStateCheck, mandatory bool) ([]byte, + error) { descriptor := remote.GetDescriptor() ref, err := oci.ParseRef(descriptor.Name) if err != nil { @@ -90,9 +94,13 @@ func Template(remote ocm.ComponentVersionAccess, moduleTemplateName, namespace, Labels: labels, Annotations: annotations, CustomStateChecks: customsStateChecks, + Mandatory: mandatory, } - t, err := template.New("modTemplate").Funcs(template.FuncMap{"yaml": yaml.Marshal, "indent": Indent}).Parse(modTemplate) + t, err := template.New("modTemplate").Funcs(template.FuncMap{ + "yaml": yaml.Marshal, + "indent": Indent, + }).Parse(modTemplate) if err != nil { return nil, err } diff --git a/pkg/module/template_test.go b/pkg/module/template_test.go index 11895889d..339fd654e 100644 --- a/pkg/module/template_test.go +++ b/pkg/module/template_test.go @@ -58,7 +58,8 @@ func TestTemplate(t *testing.T) { }, want: getExpectedModuleTemplate(t, "", map[string]string{ - "operator.kyma-project.io/module-name": "template-operator"}, map[string]string{}, + "operator.kyma-project.io/module-name": "template-operator", + }, map[string]string{}, noCustomStateCheck), wantErr: false, }, @@ -74,7 +75,8 @@ func TestTemplate(t *testing.T) { }, want: getExpectedModuleTemplate(t, "kyma-system", map[string]string{ - "operator.kyma-project.io/module-name": "template-operator"}, map[string]string{}, + "operator.kyma-project.io/module-name": "template-operator", + }, map[string]string{}, noCustomStateCheck), wantErr: false, }, @@ -90,7 +92,8 @@ func TestTemplate(t *testing.T) { }, want: getExpectedModuleTemplate(t, "kyma-system", map[string]string{ - "operator.kyma-project.io/module-name": "template-operator", "is-custom-label": "true"}, + "operator.kyma-project.io/module-name": "template-operator", "is-custom-label": "true", + }, map[string]string{}, noCustomStateCheck), wantErr: false, }, @@ -106,7 +109,8 @@ func TestTemplate(t *testing.T) { }, want: getExpectedModuleTemplate(t, "kyma-system", map[string]string{ - "operator.kyma-project.io/module-name": "template-operator"}, + "operator.kyma-project.io/module-name": "template-operator", + }, map[string]string{"is-custom-annotation": "true"}, []v1beta2.CustomStateCheck{}), wantErr: false, }, @@ -127,6 +131,7 @@ func TestTemplate(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + // TODO adaapt tests got, err := Template(tt.args.remote, tt.args.moduleTemplateName, tt.args.namespace, tt.args.channel, tt.args.data, tt.args.labels, tt.args.annotations, tt.args.checks) if (err != nil) != tt.wantErr { @@ -143,7 +148,8 @@ func TestTemplate(t *testing.T) { func createOcmComponentVersionAccess(t *testing.T) ocm.ComponentVersionAccess { tempFs, err := osfs.NewTempFileSystem() assert.Equal(t, nil, err) - ociSpec, err := ctf.NewRepositorySpec(accessobj.ACC_CREATE, "test", accessio.PathFileSystem(tempFs), accessobj.FormatDirectory) + ociSpec, err := ctf.NewRepositorySpec(accessobj.ACC_CREATE, "test", accessio.PathFileSystem(tempFs), + accessobj.FormatDirectory) assert.Equal(t, nil, err) repo, err := ocm.New().RepositoryForSpec(ociSpec) assert.Equal(t, nil, err) @@ -160,7 +166,10 @@ func getExpectedModuleTemplate(t *testing.T, annotations map[string]string, checks []v1beta2.CustomStateCheck) []byte { cva, err := compdesc.Convert(accessVersion.GetDescriptor()) assert.Equal(t, nil, err) - temp, err := template.New("modTemplate").Funcs(template.FuncMap{"yaml": yaml.Marshal, "indent": Indent}).Parse(modTemplate) + temp, err := template.New("modTemplate").Funcs(template.FuncMap{ + "yaml": yaml.Marshal, + "indent": Indent, + }).Parse(modTemplate) assert.Equal(t, nil, err) td := moduleTemplateData{ ResourceName: "template-operator-regular", From 28bdbd95611e0c8ff5376c31e105ac6d46aba53d Mon Sep 17 00:00:00 2001 From: jeremyharisch Date: Fri, 24 Nov 2023 15:23:30 +0100 Subject: [PATCH 02/13] Add test --- pkg/module/template_test.go | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/pkg/module/template_test.go b/pkg/module/template_test.go index 339fd654e..c2d14c004 100644 --- a/pkg/module/template_test.go +++ b/pkg/module/template_test.go @@ -40,6 +40,7 @@ func TestTemplate(t *testing.T) { labels map[string]string annotations map[string]string checks []v1beta2.CustomStateCheck + mandatory bool } tests := []struct { name string @@ -55,12 +56,13 @@ func TestTemplate(t *testing.T) { labels: map[string]string{}, annotations: map[string]string{}, checks: noCustomStateCheck, + mandatory: false, }, want: getExpectedModuleTemplate(t, "", map[string]string{ "operator.kyma-project.io/module-name": "template-operator", }, map[string]string{}, - noCustomStateCheck), + noCustomStateCheck, false), wantErr: false, }, { @@ -72,12 +74,13 @@ func TestTemplate(t *testing.T) { labels: map[string]string{}, annotations: map[string]string{}, checks: noCustomStateCheck, + mandatory: false, }, want: getExpectedModuleTemplate(t, "kyma-system", map[string]string{ "operator.kyma-project.io/module-name": "template-operator", }, map[string]string{}, - noCustomStateCheck), + noCustomStateCheck, false), wantErr: false, }, { @@ -89,12 +92,13 @@ func TestTemplate(t *testing.T) { labels: map[string]string{"is-custom-label": "true"}, annotations: map[string]string{}, checks: noCustomStateCheck, + mandatory: false, }, want: getExpectedModuleTemplate(t, "kyma-system", map[string]string{ "operator.kyma-project.io/module-name": "template-operator", "is-custom-label": "true", }, - map[string]string{}, noCustomStateCheck), + map[string]string{}, noCustomStateCheck, false), wantErr: false, }, { @@ -106,12 +110,13 @@ func TestTemplate(t *testing.T) { labels: map[string]string{}, annotations: map[string]string{"is-custom-annotation": "true"}, checks: noCustomStateCheck, + mandatory: false, }, want: getExpectedModuleTemplate(t, "kyma-system", map[string]string{ "operator.kyma-project.io/module-name": "template-operator", }, - map[string]string{"is-custom-annotation": "true"}, []v1beta2.CustomStateCheck{}), + map[string]string{"is-custom-annotation": "true"}, []v1beta2.CustomStateCheck{}, false), wantErr: false, }, { @@ -125,15 +130,30 @@ func TestTemplate(t *testing.T) { }, want: getExpectedModuleTemplate(t, "", map[string]string{"operator.kyma-project.io/module-name": "template-operator"}, map[string]string{}, - defaultCustomStateCheck), + defaultCustomStateCheck, false), + wantErr: false, + }, + { + name: "Mandatory ModuleTemplate", + args: args{ + remote: accessVersion, + namespace: "kyma-system", + channel: "regular", + labels: map[string]string{}, + annotations: map[string]string{}, + checks: noCustomStateCheck, + mandatory: true, + }, + want: getExpectedModuleTemplate(t, "kyma-system", + map[string]string{"operator.kyma-project.io/module-name": "template-operator"}, map[string]string{}, + []v1beta2.CustomStateCheck{}, true), wantErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - // TODO adaapt tests got, err := Template(tt.args.remote, tt.args.moduleTemplateName, tt.args.namespace, tt.args.channel, - tt.args.data, tt.args.labels, tt.args.annotations, tt.args.checks) + tt.args.data, tt.args.labels, tt.args.annotations, tt.args.checks, tt.args.mandatory) if (err != nil) != tt.wantErr { t.Errorf("Template() error = %v, wantErr %v", err, tt.wantErr) return @@ -163,7 +183,7 @@ func createOcmComponentVersionAccess(t *testing.T) ocm.ComponentVersionAccess { func getExpectedModuleTemplate(t *testing.T, namespace string, labels map[string]string, - annotations map[string]string, checks []v1beta2.CustomStateCheck) []byte { + annotations map[string]string, checks []v1beta2.CustomStateCheck, mandatory bool) []byte { cva, err := compdesc.Convert(accessVersion.GetDescriptor()) assert.Equal(t, nil, err) temp, err := template.New("modTemplate").Funcs(template.FuncMap{ @@ -180,6 +200,7 @@ func getExpectedModuleTemplate(t *testing.T, Data: "", Descriptor: cva, CustomStateChecks: checks, + Mandatory: mandatory, } w := &bytes.Buffer{} err = temp.Execute(w, td) From d4f2ee772003f6de3441c13a8d76ede09ee5e51f Mon Sep 17 00:00:00 2001 From: jeremyharisch Date: Fri, 24 Nov 2023 16:00:50 +0100 Subject: [PATCH 03/13] Adapt e2e test --- go.mod | 26 +++++------ go.sum | 44 +++++++++++++++++++ .../create_module/kyma_create_module_test.go | 15 +++++-- 3 files changed, 68 insertions(+), 17 deletions(-) diff --git a/go.mod b/go.mod index 80489aa7c..51a8d6057 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/kyma-incubator/reconciler v0.0.0-20230927075501-a4fa93d4b07a github.com/kyma-project/hydroform/function v0.0.0-20230831071441-f3501c89bace github.com/kyma-project/hydroform/provision v0.0.0-20230831071441-f3501c89bace - github.com/kyma-project/lifecycle-manager v0.0.0-20230911065458-6926c58bcd43 + github.com/kyma-project/lifecycle-manager v0.0.0-20231124135553-fdda00209549 github.com/mandelsoft/vfs v0.4.0 github.com/onsi/ginkgo/v2 v2.13.1 github.com/onsi/gomega v1.30.0 @@ -47,13 +47,13 @@ require ( require ( k8s.io/api v0.28.4 - k8s.io/apiextensions-apiserver v0.28.3 + k8s.io/apiextensions-apiserver v0.28.4 k8s.io/apimachinery v0.28.4 - k8s.io/apiserver v0.28.3 // indirect - k8s.io/cli-runtime v0.28.3 + k8s.io/apiserver v0.28.4 // indirect + k8s.io/cli-runtime v0.28.4 k8s.io/client-go v0.28.4 - k8s.io/component-base v0.28.3 // indirect - k8s.io/kubectl v0.28.2 // indirect + k8s.io/component-base v0.28.4 // indirect + k8s.io/kubectl v0.28.4 // indirect ) require ( @@ -108,7 +108,7 @@ require ( github.com/aws/aws-sdk-go-v2/config v1.19.1 // indirect github.com/aws/aws-sdk-go-v2/credentials v1.13.43 // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.13 // indirect - github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.33 // indirect + github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.70 // indirect github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.43 // indirect github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.37 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.3.45 // indirect @@ -130,7 +130,7 @@ require ( github.com/buildkite/agent/v3 v3.58.0 // indirect github.com/buildkite/interpolate v0.0.0-20200526001904-07f35b4ae251 // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect - github.com/cert-manager/cert-manager v1.12.3 // indirect + github.com/cert-manager/cert-manager v1.13.2 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chai2010/gettext-go v1.0.2 // indirect github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589 // indirect @@ -177,7 +177,7 @@ require ( github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/go-billy/v5 v5.5.0 // indirect github.com/go-gorp/gorp/v3 v3.1.0 // indirect - github.com/go-jose/go-jose/v3 v3.0.0 // indirect + github.com/go-jose/go-jose/v3 v3.0.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/analysis v0.21.4 // indirect github.com/go-openapi/errors v0.20.4 // indirect @@ -233,7 +233,7 @@ require ( github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/jedisct1/go-minisign v0.0.0-20230811132847-661be99b8267 // indirect github.com/jellydator/ttlcache/v3 v3.1.0 // indirect - github.com/jmespath/go-jmespath v0.4.0 // indirect + github.com/jmespath/go-jmespath v0.4.1-0.20220621161143-b0104c826a24 // indirect github.com/jmoiron/sqlx v1.3.5 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -376,7 +376,7 @@ require ( golang.org/x/sys v0.14.0 // indirect golang.org/x/term v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect - golang.org/x/time v0.3.0 // indirect + golang.org/x/time v0.4.0 // indirect golang.org/x/tools v0.14.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect @@ -397,12 +397,12 @@ require ( gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect inet.af/netaddr v0.0.0-20230525184311-b8eac61e914a // indirect - istio.io/api v1.20.0-beta.0.0.20231031143729-871b2914253f // indirect + istio.io/api v1.20.0 // indirect istio.io/istio v0.0.0-20230828165045-9fdfe780e1fc // indirect k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect oras.land/oras-go v1.2.4 // indirect - sigs.k8s.io/gateway-api v0.8.0-rc2 // indirect + sigs.k8s.io/gateway-api v0.8.0 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/release-utils v0.7.6 // indirect sigs.k8s.io/structured-merge-diff/v4 v4.3.0 // indirect diff --git a/go.sum b/go.sum index fea7a57c2..2fb381846 100644 --- a/go.sum +++ b/go.sum @@ -289,45 +289,56 @@ github.com/aws/aws-sdk-go v1.47.0/go.mod h1:DlEaEbWKZmsITVbqlSVvekPARM1HzeV9PMYg github.com/aws/aws-sdk-go-v2 v1.8.0/go.mod h1:xEFuWz+3TYdlPRuo+CqATbeDWIWyaT5uAPwPaWtgse0= github.com/aws/aws-sdk-go-v2 v1.9.2/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= github.com/aws/aws-sdk-go-v2 v1.16.16/go.mod h1:SwiyXi/1zTUZ6KIAmLK5V5ll8SiURNUYOqTerZPaF9k= +github.com/aws/aws-sdk-go-v2 v1.18.1/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw= github.com/aws/aws-sdk-go-v2 v1.21.0/go.mod h1:/RfNgGmRxI+iFOB1OeJUyxiU+9s88k3pfHvDagGEp0M= github.com/aws/aws-sdk-go-v2 v1.21.2 h1:+LXZ0sgo8quN9UOKXXzAWRT3FWd4NxeXWOZom9pE7GA= github.com/aws/aws-sdk-go-v2 v1.21.2/go.mod h1:ErQhvNuEMhJjweavOYhxVkn2RUx7kQXVATHrjKtxIpM= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.8/go.mod h1:JTnlBSot91steJeti4ryyu/tLd4Sk84O5W22L7O2EQU= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10/go.mod h1:VeTZetY5KRJLuD/7fkQXMU6Mw7H5m/KP2J5Iy9osMno= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.13 h1:OPLEkmhXf6xFPiz0bLeDArZIDx1NNS4oJyG4nv3Gct0= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.13/go.mod h1:gpAbvyDGQFozTEmlTFO8XcQKHzubdq0LzRyJpG6MiXM= github.com/aws/aws-sdk-go-v2/config v1.6.0/go.mod h1:TNtBVmka80lRPk5+S9ZqVfFszOQAGJJ9KbT3EM3CHNU= github.com/aws/aws-sdk-go-v2/config v1.8.3/go.mod h1:4AEiLtAb8kLs7vgw2ZV3p2VZ1+hBavOc84hqxVNpCyw= github.com/aws/aws-sdk-go-v2/config v1.17.7/go.mod h1:dN2gja/QXxFF15hQreyrqYhLBaQo1d9ZKe/v/uplQoI= +github.com/aws/aws-sdk-go-v2/config v1.18.27/go.mod h1:0My+YgmkGxeqjXZb5BYme5pc4drjTnM+x1GJ3zv42Nw= github.com/aws/aws-sdk-go-v2/config v1.19.1 h1:oe3vqcGftyk40icfLymhhhNysAwk0NfiwkDi2GTPMXs= github.com/aws/aws-sdk-go-v2/config v1.19.1/go.mod h1:ZwDUgFnQgsazQTnWfeLWk5GjeqTQTL8lMkoE1UXzxdE= github.com/aws/aws-sdk-go-v2/credentials v1.3.2/go.mod h1:PACKuTJdt6AlXvEq8rFI4eDmoqDFC5DpVKQbWysaDgM= github.com/aws/aws-sdk-go-v2/credentials v1.4.3/go.mod h1:FNNC6nQZQUuyhq5aE5c7ata8o9e4ECGmS4lAXC7o1mQ= github.com/aws/aws-sdk-go-v2/credentials v1.12.20/go.mod h1:UKY5HyIux08bbNA7Blv4PcXQ8cTkGh7ghHMFklaviR4= +github.com/aws/aws-sdk-go-v2/credentials v1.13.26/go.mod h1:GoXt2YC8jHUBbA4jr+W3JiemnIbkXOfxSXcisUsZ3os= github.com/aws/aws-sdk-go-v2/credentials v1.13.43 h1:LU8vo40zBlo3R7bAvBVy/ku4nxGEyZe9N8MqAeFTzF8= github.com/aws/aws-sdk-go-v2/credentials v1.13.43/go.mod h1:zWJBz1Yf1ZtX5NGax9ZdNjhhI4rgjfgsyk6vTY1yfVg= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.4.0/go.mod h1:Mj/U8OpDbcVcoctrYwA2bak8k/HFPdcLzI/vaiXMwuM= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.6.0/go.mod h1:gqlclDEZp4aqJOancXK6TN24aKhT0W0Ae9MHk3wzTMM= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.17/go.mod h1:yIkQcCDYNsZfXpd5UX2Cy+sWA1jPgIhGTw9cOBzfVnQ= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.4/go.mod h1:E1hLXN/BL2e6YizK1zFlYd8vsfi2GTjbjBazinMmeaM= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.13 h1:PIktER+hwIG286DqXyvVENjgLTAwGgoeriLDD5C+YlQ= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.13/go.mod h1:f/Ib/qYjhV2/qdsf79H3QP/eRE4AkVyEf6sk7XfZ1tg= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.4.0/go.mod h1:eHwXu2+uE/T6gpnYWwBwqoeqRf9IXyCcolyOWDRAErQ= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.5.4/go.mod h1:Ex7XQmbFmgFHrjUX6TN3mApKW5Hglyga+F7wZHTtYhA= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.33 h1:fAoVmNGhir6BR+RU0/EI+6+D7abM+MCwWf8v4ip5jNI= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.33/go.mod h1:84XgODVR8uRhmOnUkKGUZKqIMxmjmLOR8Uyp7G/TPwc= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.70 h1:4bh28MeeXoBFTjb0JjQ5sVatzlf5xA1DziV8mZed9v4= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.70/go.mod h1:9yI5NXzqy2yOiMytv6QLZHvlyHLwYxO9iIq+bZIbrFg= github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.23/go.mod h1:2DFxAQ9pfIRy0imBCJv+vZ2X6RKxves6fbnEuSry6b4= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.34/go.mod h1:wZpTEecJe0Btj3IYnDx/VlUzor9wm3fJHyvLpQF0VwY= github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41/go.mod h1:CrObHAuPneJBlfEJ5T3szXOUkLEThaGfvnhTf33buas= github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.43 h1:nFBQlGtkbPzp/NjZLuFxRqmT91rLJkgvsEQs68h962Y= github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.43/go.mod h1:auo+PiyLl0n1l8A0e8RIeR8tOzYPfZZH/JNlrJ8igTQ= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.17/go.mod h1:pRwaTYCJemADaqCbUAxltMoHKata7hmB5PjEXeu0kfg= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.28/go.mod h1:7VRpKQQedkfIEXb4k52I7swUnZP0wohVajJMRn3vsUw= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35/go.mod h1:SJC1nEVVva1g3pHAIdCp7QsRIkMmLAgoDquQ9Rr8kYw= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.37 h1:JRVhO25+r3ar2mKGP7E0LDl8K9/G36gjlqca5iQbaqc= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.37/go.mod h1:Qe+2KtKml+FEsQF/DHmDV+xjtche/hwoF75EG4UlHW8= github.com/aws/aws-sdk-go-v2/internal/ini v1.2.0/go.mod h1:Q5jATQc+f1MfZp3PDMhn6ry18hGvE0i8yvbXoKbnZaE= github.com/aws/aws-sdk-go-v2/internal/ini v1.2.4/go.mod h1:ZcBrrI3zBKlhGFNYWvju0I3TR93I7YIgAfy82Fh4lcQ= github.com/aws/aws-sdk-go-v2/internal/ini v1.3.24/go.mod h1:jULHjqqjDlbyTa7pfM7WICATnOv+iOhjletM3N0Xbu8= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.35/go.mod h1:0Eg1YjxE0Bhn56lx+SHJwCzhW+2JGtizsrx+lCqrfm0= github.com/aws/aws-sdk-go-v2/internal/ini v1.3.45 h1:hze8YsjSh8Wl1rYa1CJpRmXP21BvOBuc76YhW0HsuQ4= github.com/aws/aws-sdk-go-v2/internal/ini v1.3.45/go.mod h1:lD5M20o09/LCuQ2mE62Mb/iSdSlCNuj6H5ci7tW7OsE= github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.14/go.mod h1:AyGgqiKv9ECM6IZeNQtdT8NnMvUb3/2wokeq2Fgryto= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.26/go.mod h1:MtYiox5gvyB+OyP0Mr0Sm/yzbEAIPL9eijj/ouHAPw0= github.com/aws/aws-sdk-go-v2/internal/v4a v1.1.4 h1:6lJvvkQ9HmbHZ4h/IEwclwv2mrTW8Uq1SOB/kXy0mfw= github.com/aws/aws-sdk-go-v2/internal/v4a v1.1.4/go.mod h1:1PrKYwxTM+zjpw9Y41KFtoJCQrJ34Z47Y4VgVbfndjo= github.com/aws/aws-sdk-go-v2/service/ecr v1.20.2 h1:y6LX9GUoEA3mO0qpFl1ZQHj1rFyPWVphlzebiSt2tKE= @@ -337,20 +348,24 @@ github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.18.2/go.mod h1:fUHpGXr4DrXkEDp github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.2.2/go.mod h1:EASdTcM1lGhUe1/p4gkojHwlGJkeoRjjr1sRCzup3Is= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.3.0/go.mod h1:v8ygadNyATSm6elwJ/4gzJwcFhri9RqS8skgHKiwXPU= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.9/go.mod h1:a9j48l6yL5XINLHLcOKInjdvknN+vWqPBxqeIDw7ktw= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11/go.mod h1:iV4q2hsqtNECrfmlXyord9u4zyuFEJX9eLgLpSPzWA8= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.14 h1:m0QTSI6pZYJTk5WSKx3fm5cNW/DCicVzULBgU/6IyD0= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.14/go.mod h1:dDilntgHy9WnHXsh7dDtUPgHKEfTJIBUTHM8OWm0f/0= github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.18/go.mod h1:NS55eQ4YixUJPTC+INxi2/jCqe1y2Uw3rnh9wEOVJxY= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.29/go.mod h1:z7EjRjVwZ6pWcWdI2H64dKttvzaP99jRIj5hphW0M5U= github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.36 h1:eev2yZX7esGRjqRbnVk1UxMLw4CyVZDpZXRCcy75oQk= github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.36/go.mod h1:lGnOkH9NJATw0XEPcAknFBj3zzNTEGRHtSw+CwC1YTg= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.2.2/go.mod h1:NXmNI41bdEsJMrD0v9rUvbGCB5GwdBEpKvUvIY3vTFg= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.3.2/go.mod h1:72HRZDLMtmVQiLG2tLfQcaWLCssELvGl+Zf2WVxMmR8= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.17/go.mod h1:4nYOrY41Lrbk2170/BGkcJKBhws9Pfn8MG3aGqjjeFI= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.28/go.mod h1:jj7znCIg05jXlaGBlFMGP8+7UN3VtCkRBG2spnmRQkU= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.35/go.mod h1:QGF2Rs33W5MaN9gYdEQOBBFPLwTZkEhRwI33f7KIG0o= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.37 h1:WWZA/I2K4ptBS1kg0kV1JbBtG/umed0vwHRrmcr9z7k= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.37/go.mod h1:vBmDnwWXWxNPFRMmG2m/3MKOe+xEcMDo1tanpaWCcck= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.5.2/go.mod h1:QuL2Ym8BkrLmN4lUofXYq6000/i5jPjosCNK//t6gak= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.7.2/go.mod h1:np7TMuJNT83O0oDOSF8i4dF3dvGqA6hPYYo6YYkzgRA= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.17/go.mod h1:YqMdV+gEKCQ59NrB7rzrJdALeBIsYiVi8Inj3+KcqHI= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.14.3/go.mod h1:f1QyiAsvIv4B49DmCqrhlXqyaR+0IxMmyX+1P+AnzOM= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.4 h1:v0jkRigbSD6uOdwcaUQmgEwG1BkPfAPDqaeNt/29ghg= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.4/go.mod h1:LhTyt8J04LL+9cIt7pYJ5lbS/U98ZmXovLOR/4LUsk8= github.com/aws/aws-sdk-go-v2/service/kms v1.24.7 h1:uRGw0UKo5hc7M2T7uGsK/Yg2qwecq/dnVjQbbq9RCzY= @@ -358,24 +373,29 @@ github.com/aws/aws-sdk-go-v2/service/kms v1.24.7/go.mod h1:z3O9CXfVrKAV3c9fMWOUU github.com/aws/aws-sdk-go-v2/service/s3 v1.12.0/go.mod h1:6J++A5xpo7QDsIeSqPK4UHqMSyPOCopa+zKtqAMhqVQ= github.com/aws/aws-sdk-go-v2/service/s3 v1.16.1/go.mod h1:CQe/KvWV1AqRc65KqeJjrLzr5X2ijnFTTVzJW0VBRCI= github.com/aws/aws-sdk-go-v2/service/s3 v1.27.11/go.mod h1:fmgDANqTUCxciViKl9hb/zD5LFbvPINFRgWhDbR+vZo= +github.com/aws/aws-sdk-go-v2/service/s3 v1.35.0/go.mod h1:aVbf0sko/TsLWHx30c/uVu7c62+0EAJ3vbxaJga0xCw= github.com/aws/aws-sdk-go-v2/service/s3 v1.40.0 h1:wl5dxN1NONhTDQD9uaEvNsDRX29cBmGED/nl0jkWlt4= github.com/aws/aws-sdk-go-v2/service/s3 v1.40.0/go.mod h1:rDGMZA7f4pbmTtPOk5v5UM2lmX6UAbRnMDJeDvnH7AM= github.com/aws/aws-sdk-go-v2/service/sso v1.3.2/go.mod h1:J21I6kF+d/6XHVk7kp/cx9YVD2TMD2TbLwtRGVcinXo= github.com/aws/aws-sdk-go-v2/service/sso v1.4.2/go.mod h1:NBvT9R1MEF+Ud6ApJKM0G+IkPchKS7p7c2YPKwHmBOk= github.com/aws/aws-sdk-go-v2/service/sso v1.11.23/go.mod h1:/w0eg9IhFGjGyyncHIQrXtU8wvNsTJOP0R6PPj0wf80= +github.com/aws/aws-sdk-go-v2/service/sso v1.12.12/go.mod h1:HuCOxYsF21eKrerARYO6HapNeh9GBNq7fius2AcwodY= github.com/aws/aws-sdk-go-v2/service/sso v1.15.2 h1:JuPGc7IkOP4AaqcZSIcyqLpFSqBWK32rM9+a1g6u73k= github.com/aws/aws-sdk-go-v2/service/sso v1.15.2/go.mod h1:gsL4keucRCgW+xA85ALBpRFfdSLH4kHOVSnLMSuBECo= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.5/go.mod h1:csZuQY65DAdFBt1oIjO5hhBR49kQqop4+lcuCjf2arA= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.12/go.mod h1:E4VrHCPzmVB/KFXtqBGKb3c8zpbNBgKe3fisDNLAW5w= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.3 h1:HFiiRkf1SdaAmV3/BHOFZ9DjFynPHj8G/UIO1lQS+fk= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.3/go.mod h1:a7bHA82fyUXOm+ZSWKU6PIoBxrjSprdLoM8xPYvzYVg= github.com/aws/aws-sdk-go-v2/service/sts v1.6.1/go.mod h1:hLZ/AnkIKHLuPGjEiyghNEdvJ2PP0MgOxcmv9EBJ4xs= github.com/aws/aws-sdk-go-v2/service/sts v1.7.2/go.mod h1:8EzeIqfWt2wWT4rJVu3f21TfrhJ8AEMzVybRNSb/b4g= github.com/aws/aws-sdk-go-v2/service/sts v1.16.19/go.mod h1:h4J3oPZQbxLhzGnk+j9dfYHi5qIOVJ5kczZd658/ydM= +github.com/aws/aws-sdk-go-v2/service/sts v1.19.2/go.mod h1:dp0yLPsLBOi++WTxzCjA/oZqi6NPIhoR+uF7GeMU9eg= github.com/aws/aws-sdk-go-v2/service/sts v1.23.2 h1:0BkLfgeDjfZnZ+MhB3ONb01u9pwFYTCZVhlsSSBvlbU= github.com/aws/aws-sdk-go-v2/service/sts v1.23.2/go.mod h1:Eows6e1uQEsc4ZaHANmsPRzAKcVDrcmjjWiih2+HUUQ= github.com/aws/smithy-go v1.7.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= github.com/aws/smithy-go v1.13.3/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= github.com/aws/smithy-go v1.14.2/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= github.com/aws/smithy-go v1.15.0 h1:PS/durmlzvAFpQHDs4wi4sNNP9ExsqZh6IlfdHXgKK8= github.com/aws/smithy-go v1.15.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= @@ -433,6 +453,8 @@ github.com/census-instrumentation/opencensus-proto v0.4.1 h1:iKLQ0xPNFxR/2hzXZMr github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= github.com/cert-manager/cert-manager v1.12.3 h1:3gZkP7hHI2CjgX5qZ1Tm98YbHVXB2NGAZPVbOLb3AjU= github.com/cert-manager/cert-manager v1.12.3/go.mod h1:/RYHUvK9cxuU5dbRyhb7g6am9jCcZc8huF3AnADE+nA= +github.com/cert-manager/cert-manager v1.13.2 h1:LG8+OLvxtc49CSyfjW7zHSyvlt7JVaHgRGyhfdvPpkk= +github.com/cert-manager/cert-manager v1.13.2/go.mod h1:AdfSU8muS+bj3C46YaD1VrlpXh672z5MeW/k1k5Sl1w= github.com/certifi/gocertifi v0.0.0-20191021191039-0944d244cd40/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= @@ -828,6 +850,8 @@ github.com/go-gorp/gorp/v3 v3.1.0/go.mod h1:dLEjIyyRNiXvNZ8PSmzpt1GsWAUK8kjVhEpj github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-jose/go-jose/v3 v3.0.0 h1:s6rrhirfEP/CGIoc6p+PZAeogN2SxKav6Wp7+dyMWVo= github.com/go-jose/go-jose/v3 v3.0.0/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= +github.com/go-jose/go-jose/v3 v3.0.1 h1:pWmKFVtt+Jl0vBZTIpz/eAKwsm6LkIxDVVbFHKkchhA= +github.com/go-jose/go-jose/v3 v3.0.1/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= @@ -1301,6 +1325,8 @@ github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath v0.4.1-0.20220621161143-b0104c826a24 h1:liMMTbpW34dhU4az1GN0pTPADwNmvoRSeoZ6PItiqnY= +github.com/jmespath/go-jmespath v0.4.1-0.20220621161143-b0104c826a24/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jmhodges/clock v1.2.0 h1:eq4kys+NI0PLngzaHEe7AmPT90XMGIEySD1JfV1PDIs= @@ -1389,6 +1415,8 @@ github.com/kyma-project/istio/operator v0.0.0-20230228134142-81d1f5a49e44 h1:o9x github.com/kyma-project/istio/operator v0.0.0-20230228134142-81d1f5a49e44/go.mod h1:AGCG2FqIIn2ANZe0qCm71PUwDZszSQDSReoLTekY/bs= github.com/kyma-project/lifecycle-manager v0.0.0-20230911065458-6926c58bcd43 h1:9/rYJzKGq0oiG5bqP7brI0cq1wuzCpubf4ScB8y8xbE= github.com/kyma-project/lifecycle-manager v0.0.0-20230911065458-6926c58bcd43/go.mod h1:touvUNucIOGaETyoaqyGaPfeZEuK8cdVwa2Psm+6qfI= +github.com/kyma-project/lifecycle-manager v0.0.0-20231124135553-fdda00209549 h1:/BSYeKKe7Vhh5/4m7+kdB6Mymdr43w3G7PYyeRkAZO4= +github.com/kyma-project/lifecycle-manager v0.0.0-20231124135553-fdda00209549/go.mod h1:HD/xQw+CM22LKBAz13kp2HneN+WOOvSJwYzUFazz9q0= github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 h1:SOEGU9fKiNWd/HOJuq6+3iTQz8KNCLtVX6idSoTLdUw= github.com/lann/builder v0.0.0-20180802200727-47ae307949d0/go.mod h1:dXGbAdH5GtBTC4WfIxhKZfyBF/HBFgRZSWwZ9g/He9o= github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 h1:P6pPBnrTSX3DEVR4fDembhRWSsG5rVo6hYhAB/ADZrk= @@ -2535,6 +2563,8 @@ golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.4.0 h1:Z81tqI5ddIoXDPvVQ7/7CC9TnLM7ubaFG2qXYd5BbYY= +golang.org/x/time v0.4.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -2881,6 +2911,8 @@ inet.af/netaddr v0.0.0-20230525184311-b8eac61e914a h1:1XCVEdxrvL6c0TGOhecLuB7U9z inet.af/netaddr v0.0.0-20230525184311-b8eac61e914a/go.mod h1:e83i32mAQOW1LAqEIweALsuK2Uw4mhQadA5r7b0Wobo= istio.io/api v1.20.0-beta.0.0.20231031143729-871b2914253f h1:tsD3dRCPpcATJmW/ymGBdi5+PgIAd9eEEO2tyyutkPs= istio.io/api v1.20.0-beta.0.0.20231031143729-871b2914253f/go.mod h1:hm1PE/mGdIAsjCDkTIAplP53H7TjO5LUQCiVvF26SVg= +istio.io/api v1.20.0 h1:heE1eQoMsuZlwWOf7Xm8TKqKLNKVs11G/zMe5QyR1u4= +istio.io/api v1.20.0/go.mod h1:hm1PE/mGdIAsjCDkTIAplP53H7TjO5LUQCiVvF26SVg= istio.io/client-go v1.20.0 h1:TSSv6A4sYvuBtoKOwyuRmBmPwSb4s++lWlh7RB7+7gY= istio.io/client-go v1.20.0/go.mod h1:6D76gZsdjz8JtVeIarUYdOn3WA8Zh+j8fIv2+2K3M+Q= istio.io/istio v0.0.0-20230828165045-9fdfe780e1fc h1:PcVx93X9JuCp6OQ1RZ4li78/mpqNkvi970YTSoMl81w= @@ -2893,6 +2925,8 @@ k8s.io/api v0.28.4 h1:8ZBrLjwosLl/NYgv1P7EQLqoO8MGQApnbgH8tu3BMzY= k8s.io/api v0.28.4/go.mod h1:axWTGrY88s/5YE+JSt4uUi6NMM+gur1en2REMR7IRj0= k8s.io/apiextensions-apiserver v0.28.3 h1:Od7DEnhXHnHPZG+W9I97/fSQkVpVPQx2diy+2EtmY08= k8s.io/apiextensions-apiserver v0.28.3/go.mod h1:NE1XJZ4On0hS11aWWJUTNkmVB03j9LM7gJSisbRt8Lc= +k8s.io/apiextensions-apiserver v0.28.4 h1:AZpKY/7wQ8n+ZYDtNHbAJBb+N4AXXJvyZx6ww6yAJvU= +k8s.io/apiextensions-apiserver v0.28.4/go.mod h1:pgQIZ1U8eJSMQcENew/0ShUTlePcSGFq6dxSxf2mwPM= k8s.io/apimachinery v0.20.1/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= k8s.io/apimachinery v0.20.4/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= k8s.io/apimachinery v0.20.6/go.mod h1:ejZXtW1Ra6V1O5H8xPBGz+T3+4gfkTCeExAHKU57MAc= @@ -2906,8 +2940,12 @@ k8s.io/apiserver v0.20.6/go.mod h1:QIJXNt6i6JB+0YQRNcS0hdRHJlMhflFmsBDeSgT1r8Q= k8s.io/apiserver v0.22.5/go.mod h1:s2WbtgZAkTKt679sYtSudEQrTGWUSQAPe6MupLnlmaQ= k8s.io/apiserver v0.28.3 h1:8Ov47O1cMyeDzTXz0rwcfIIGAP/dP7L8rWbEljRcg5w= k8s.io/apiserver v0.28.3/go.mod h1:YIpM+9wngNAv8Ctt0rHG4vQuX/I5rvkEMtZtsxW2rNM= +k8s.io/apiserver v0.28.4 h1:BJXlaQbAU/RXYX2lRz+E1oPe3G3TKlozMMCZWu5GMgg= +k8s.io/apiserver v0.28.4/go.mod h1:Idq71oXugKZoVGUUL2wgBCTHbUR+FYTWa4rq9j4n23w= k8s.io/cli-runtime v0.28.3 h1:lvuJYVkwCqHEvpS6KuTZsUVwPePFjBfSGvuaLl2SxzA= k8s.io/cli-runtime v0.28.3/go.mod h1:jeX37ZPjIcENVuXDDTskG3+FnVuZms5D9omDXS/2Jjc= +k8s.io/cli-runtime v0.28.4 h1:IW3aqSNFXiGDllJF4KVYM90YX4cXPGxuCxCVqCD8X+Q= +k8s.io/cli-runtime v0.28.4/go.mod h1:MLGRB7LWTIYyYR3d/DOgtUC8ihsAPA3P8K8FDNIqJ0k= k8s.io/client-go v0.20.1/go.mod h1:/zcHdt1TeWSd5HoUe6elJmHSQ6uLLgp4bIJHVEuy+/Y= k8s.io/client-go v0.20.4/go.mod h1:LiMv25ND1gLUdBeYxBIwKpkSC5IsozMMmOOeSJboP+k= k8s.io/client-go v0.20.6/go.mod h1:nNQMnOvEUEsOzRRFIIkdmYOjAZrC8bgq0ExboWSU1I0= @@ -2921,6 +2959,8 @@ k8s.io/component-base v0.20.6/go.mod h1:6f1MPBAeI+mvuts3sIdtpjljHWBQ2cIy38oBIWMY k8s.io/component-base v0.22.5/go.mod h1:VK3I+TjuF9eaa+Ln67dKxhGar5ynVbwnGrUiNF4MqCI= k8s.io/component-base v0.28.3 h1:rDy68eHKxq/80RiMb2Ld/tbH8uAE75JdCqJyi6lXMzI= k8s.io/component-base v0.28.3/go.mod h1:fDJ6vpVNSk6cRo5wmDa6eKIG7UlIQkaFmZN2fYgIUD8= +k8s.io/component-base v0.28.4 h1:c/iQLWPdUgI90O+T9TeECg8o7N3YJTiuz2sKxILYcYo= +k8s.io/component-base v0.28.4/go.mod h1:m9hR0uvqXDybiGL2nf/3Lf0MerAfQXzkfWhUY58JUbU= k8s.io/cri-api v0.17.3/go.mod h1:X1sbHmuXhwaHs9xxYffLqJogVsnI+f6cPRcgPel7ywM= k8s.io/cri-api v0.20.1/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= k8s.io/cri-api v0.20.4/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= @@ -2944,6 +2984,8 @@ k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/A k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= k8s.io/kubectl v0.28.2 h1:fOWOtU6S0smdNjG1PB9WFbqEIMlkzU5ahyHkc7ESHgM= k8s.io/kubectl v0.28.2/go.mod h1:6EQWTPySF1fn7yKoQZHYf9TPwIl2AygHEcJoxFekr64= +k8s.io/kubectl v0.28.4 h1:gWpUXW/T7aFne+rchYeHkyB8eVDl5UZce8G4X//kjUQ= +k8s.io/kubectl v0.28.4/go.mod h1:CKOccVx3l+3MmDbkXtIUtibq93nN2hkDR99XDCn7c/c= k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= @@ -2989,6 +3031,8 @@ sigs.k8s.io/controller-runtime v0.16.3 h1:2TuvuokmfXvDUamSx1SuAOO3eTyye+47mJCigw sigs.k8s.io/controller-runtime v0.16.3/go.mod h1:j7bialYoSn142nv9sCOJmQgDXQXxnroFU4VnX/brVJ0= sigs.k8s.io/gateway-api v0.8.0-rc2 h1:i1Kw21ygkAgCOciX9P4XoZGWXO7vW+B29Rw3tFQtiAI= sigs.k8s.io/gateway-api v0.8.0-rc2/go.mod h1:tqe6NjoISYTfXctrVWkPhJ4+7mA9ns0/sfT19O1TkSM= +sigs.k8s.io/gateway-api v0.8.0 h1:isQQ3Jx2qFP7vaA3ls0846F0Amp9Eq14P08xbSwVbQg= +sigs.k8s.io/gateway-api v0.8.0/go.mod h1:okOnjPNBFbIS/Rw9kAhuIUaIkLhTKEu+ARIuXk2dgaM= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/kustomize/api v0.15.0 h1:6Ca88kEOBVotHDw+y2IsIMYtg9Pvv7MKpW9JMyF/OH4= diff --git a/tests/e2e/create_module/kyma_create_module_test.go b/tests/e2e/create_module/kyma_create_module_test.go index 1e6d9fd8e..866f7b2d4 100644 --- a/tests/e2e/create_module/kyma_create_module_test.go +++ b/tests/e2e/create_module/kyma_create_module_test.go @@ -1,12 +1,11 @@ package create_module_test import ( - "github.com/open-component-model/ocm/pkg/contexts/ocm/accessmethods/ociartifact" "os" "testing" - "github.com/kyma-project/cli/pkg/module" - "github.com/kyma-project/cli/tests/e2e" + "github.com/open-component-model/ocm/pkg/contexts/ocm/accessmethods/ociartifact" + "github.com/open-component-model/ocm/pkg/contexts/oci/repositories/ocireg" "github.com/open-component-model/ocm/pkg/contexts/ocm" "github.com/open-component-model/ocm/pkg/contexts/ocm/accessmethods/github" @@ -15,6 +14,9 @@ import ( v2 "github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc/versions/v2" ocmOCIReg "github.com/open-component-model/ocm/pkg/contexts/ocm/repositories/ocireg" "github.com/stretchr/testify/assert" + + "github.com/kyma-project/cli/pkg/module" + "github.com/kyma-project/cli/tests/e2e" ) func Test_ModuleTemplate(t *testing.T) { @@ -66,7 +68,8 @@ func Test_ModuleTemplate(t *testing.T) { ociArtifactAccessSpec, ok := resourceAccessSpec.(*ociartifact.AccessSpec) assert.True(t, ok) assert.Equal(t, ociartifact.Type, ociArtifactAccessSpec.GetType()) - assert.Equal(t, "europe-docker.pkg.dev/kyma-project/prod/template-operator:0.1.0", ociArtifactAccessSpec.ImageReference) + assert.Equal(t, "europe-docker.pkg.dev/kyma-project/prod/template-operator:0.1.0", + ociArtifactAccessSpec.ImageReference) }) t.Run("test descriptor.component.resources[1].access", func(t *testing.T) { @@ -89,6 +92,10 @@ func Test_ModuleTemplate(t *testing.T) { assert.Contains(t, testRepoURL, githubAccessSpec.RepoURL) }) + t.Run("test spec.mandatory", func(t *testing.T) { + assert.Equal(t, false, template.Spec.Mandatory) + }) + t.Run("test security scan labels", func(t *testing.T) { secScanLabels := descriptor.Sources[0].Labels flattened := e2e.Flatten(secScanLabels) From 40ffac4a4d147e5e4b156aadd096eb938cf69412 Mon Sep 17 00:00:00 2001 From: jeremyharisch Date: Mon, 27 Nov 2023 08:41:13 +0100 Subject: [PATCH 04/13] Use shared pkg instead of api --- .../alpha/create/module/moduleconfig_test.go | 25 +++++++++++-------- .../enable/module/mock/mock_interactor.go | 1 + internal/cli/alpha/module/module.go | 11 +++++--- internal/deploy/kyma.go | 9 ++++--- pkg/module/custom_state_check.go | 17 +++++++------ 5 files changed, 38 insertions(+), 25 deletions(-) diff --git a/cmd/kyma/alpha/create/module/moduleconfig_test.go b/cmd/kyma/alpha/create/module/moduleconfig_test.go index cb180295f..66365eea2 100644 --- a/cmd/kyma/alpha/create/module/moduleconfig_test.go +++ b/cmd/kyma/alpha/create/module/moduleconfig_test.go @@ -1,8 +1,10 @@ package module import ( - "github.com/kyma-project/lifecycle-manager/api/v1beta2" "testing" + + "github.com/kyma-project/lifecycle-manager/api/shared" + "github.com/kyma-project/lifecycle-manager/api/v1beta2" ) func TestValidateVersion(t *testing.T) { @@ -44,7 +46,8 @@ func TestValidateVersion(t *testing.T) { do() if !tt.isValid && err == nil { - t.Errorf("Version validation failed for input %q: Expected an error but success is reported", tt.version) + t.Errorf("Version validation failed for input %q: Expected an error but success is reported", + tt.version) } if tt.isValid && err != nil { t.Error(err) @@ -162,7 +165,8 @@ func TestValidateNamespace(t *testing.T) { do() if !tt.isValid && err == nil { - t.Errorf("Namespace validation failed for input %q: Expected an error but success is reported", tt.namespace) + t.Errorf("Namespace validation failed for input %q: Expected an error but success is reported", + tt.namespace) } if tt.isValid && err != nil { t.Error(err) @@ -216,7 +220,8 @@ func TestValidateChannel(t *testing.T) { do() if !tt.isValid && err == nil { - t.Errorf("Channel validation failed for input %q: Expected an error but success is reported", tt.channel) + t.Errorf("Channel validation failed for input %q: Expected an error but success is reported", + tt.channel) } if tt.isValid && err != nil { t.Error(err) @@ -259,12 +264,12 @@ func TestValidateCustomStateChecks(t *testing.T) { { JSONPath: "status.health", Value: "red", - MappedState: v1beta2.StateError, + MappedState: shared.StateError, }, { JSONPath: "", Value: "green", - MappedState: v1beta2.StateReady, + MappedState: shared.StateReady, }, }, }, @@ -277,7 +282,7 @@ func TestValidateCustomStateChecks(t *testing.T) { { JSONPath: "status.health", Value: "green", - MappedState: v1beta2.StateReady, + MappedState: shared.StateReady, }, { JSONPath: "status.health", @@ -295,17 +300,17 @@ func TestValidateCustomStateChecks(t *testing.T) { { JSONPath: "status.health", Value: "green", - MappedState: v1beta2.StateReady, + MappedState: shared.StateReady, }, { JSONPath: "status.health", Value: "red", - MappedState: v1beta2.StateError, + MappedState: shared.StateError, }, { JSONPath: "status.health", Value: "yellow", - MappedState: v1beta2.StateWarning, + MappedState: shared.StateWarning, }, }, }, diff --git a/cmd/kyma/alpha/enable/module/mock/mock_interactor.go b/cmd/kyma/alpha/enable/module/mock/mock_interactor.go index 5067b460e..885ab40f1 100644 --- a/cmd/kyma/alpha/enable/module/mock/mock_interactor.go +++ b/cmd/kyma/alpha/enable/module/mock/mock_interactor.go @@ -3,6 +3,7 @@ package mock import ( "context" + "github.com/kyma-project/lifecycle-manager/api/v1beta2" "github.com/stretchr/testify/mock" ) diff --git a/internal/cli/alpha/module/module.go b/internal/cli/alpha/module/module.go index def22837f..cc7da8106 100644 --- a/internal/cli/alpha/module/module.go +++ b/internal/cli/alpha/module/module.go @@ -3,11 +3,12 @@ package module import ( "context" "fmt" - "github.com/kyma-project/cli/pkg/errs" "time" + "github.com/kyma-project/cli/pkg/errs" + "github.com/avast/retry-go" - "github.com/kyma-project/cli/internal/kube" + "github.com/kyma-project/lifecycle-manager/api/shared" "github.com/kyma-project/lifecycle-manager/api/v1beta2" "github.com/pkg/errors" "go.uber.org/zap" @@ -18,6 +19,8 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/watch" "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/kyma-project/cli/internal/kube" ) type Interactor interface { @@ -174,7 +177,7 @@ func IsKymaReady(l *zap.SugaredLogger, obj runtime.Object) error { } l.Info(kyma.Status) switch kyma.Status.State { - case v1beta2.StateReady: + case shared.StateReady: if len(kyma.Status.Modules) != len(kyma.Spec.Modules) { return fmt.Errorf("kyma has status Ready but cannot be up to date "+ "since modules tracked in status differ from modules in desired state/spec (%v in status, %v in spec)", @@ -189,7 +192,7 @@ func IsKymaReady(l *zap.SugaredLogger, obj runtime.Object) error { ) } return nil - case v1beta2.StateWarning: + case shared.StateWarning: return ErrKymaInWarningState default: lastOperation := kyma.Status.LastOperation diff --git a/internal/deploy/kyma.go b/internal/deploy/kyma.go index 5621592c9..7a11f6c45 100644 --- a/internal/deploy/kyma.go +++ b/internal/deploy/kyma.go @@ -3,15 +3,18 @@ package deploy import ( "context" "fmt" - "github.com/kyma-project/cli/pkg/errs" "os" + "github.com/kyma-project/cli/pkg/errs" + "github.com/avast/retry-go" - "github.com/kyma-project/cli/internal/kube" + "github.com/kyma-project/lifecycle-manager/api/shared" "github.com/kyma-project/lifecycle-manager/api/v1beta2" v1 "k8s.io/api/core/v1" ctrlClient "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/yaml" + + "github.com/kyma-project/cli/internal/kube" ) // Kyma deploys the Kyma CR. If no kymaCRPath is provided, it deploys the default CR. @@ -71,7 +74,7 @@ func Kyma( if !ok { return false, errs.ErrTypeAssertKyma } - return string(tKyma.Status.State) == string(v1beta2.StateReady), nil + return string(tKyma.Status.State) == string(shared.StateReady), nil }, ); err != nil { return fmt.Errorf("kyma custom resource did not get ready: %w", err) diff --git a/pkg/module/custom_state_check.go b/pkg/module/custom_state_check.go index 21dee1d05..6eada0475 100644 --- a/pkg/module/custom_state_check.go +++ b/pkg/module/custom_state_check.go @@ -3,16 +3,17 @@ package module import ( "slices" + "github.com/kyma-project/lifecycle-manager/api/shared" "github.com/kyma-project/lifecycle-manager/api/v1beta2" "github.com/pkg/errors" ) -var validStates = []v1beta2.State{ - v1beta2.StateReady, - v1beta2.StateProcessing, - v1beta2.StateError, - v1beta2.StateDeleting, - v1beta2.StateWarning, +var validStates = []shared.State{ + shared.StateReady, + shared.StateProcessing, + shared.StateError, + shared.StateDeleting, + shared.StateWarning, } var ErrCustomStateCheckValidation = errors.New("custom state check validation failed") @@ -28,11 +29,11 @@ func IsValidMappedState(s string) bool { func ContainsAllRequiredStates(checks []v1beta2.CustomStateCheck) bool { containsError := slices.ContainsFunc(checks, func(csc v1beta2.CustomStateCheck) bool { - return csc.MappedState == v1beta2.StateError + return csc.MappedState == shared.StateError }) containsReady := slices.ContainsFunc(checks, func(csc v1beta2.CustomStateCheck) bool { - return csc.MappedState == v1beta2.StateReady + return csc.MappedState == shared.StateReady }) return containsError && containsReady From 4159c63fcb680f1ac8f1a1233661c2e21d48b554 Mon Sep 17 00:00:00 2001 From: jeremyharisch Date: Mon, 27 Nov 2023 08:47:29 +0100 Subject: [PATCH 05/13] Use shared pkg instead of api --- cmd/kyma/alpha/create/module/moduleconfig_test.go | 2 +- internal/cli/alpha/module/module.go | 2 +- tests/e2e/deploy_enable_disable_test.go | 15 ++++++++------- tests/e2e/util.go | 7 ++++--- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/cmd/kyma/alpha/create/module/moduleconfig_test.go b/cmd/kyma/alpha/create/module/moduleconfig_test.go index 66365eea2..88ebae7b9 100644 --- a/cmd/kyma/alpha/create/module/moduleconfig_test.go +++ b/cmd/kyma/alpha/create/module/moduleconfig_test.go @@ -251,7 +251,7 @@ func TestValidateCustomStateChecks(t *testing.T) { { JSONPath: "status.health", Value: "green", - MappedState: v1beta2.StateReady, + MappedState: shared.StateReady, }, }, }, diff --git a/internal/cli/alpha/module/module.go b/internal/cli/alpha/module/module.go index cc7da8106..a8ec96cd6 100644 --- a/internal/cli/alpha/module/module.go +++ b/internal/cli/alpha/module/module.go @@ -168,7 +168,7 @@ func (i *DefaultInteractor) WaitUntilReady(ctx context.Context) error { } // IsKymaReady interprets the status of a Kyma Resource and uses this to determine if it can be considered Ready. -// It checks for v1beta2.StateReady, and if it is set, determines if this state can be trusted by observing +// It checks for shared.StateReady, and if it is set, determines if this state can be trusted by observing // if the status fields match the desired state, and if the lastOperation is filled by the lifecycle-manager. func IsKymaReady(l *zap.SugaredLogger, obj runtime.Object) error { kyma, ok := obj.(*v1beta2.Kyma) diff --git a/tests/e2e/deploy_enable_disable_test.go b/tests/e2e/deploy_enable_disable_test.go index 8fcb7db8b..86a6ae0a4 100644 --- a/tests/e2e/deploy_enable_disable_test.go +++ b/tests/e2e/deploy_enable_disable_test.go @@ -1,11 +1,12 @@ package e2e_test import ( - "github.com/kyma-project/cli/internal/cli" - . "github.com/kyma-project/cli/tests/e2e" - "github.com/kyma-project/lifecycle-manager/api/v1beta2" + "github.com/kyma-project/lifecycle-manager/api/shared" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + + "github.com/kyma-project/cli/internal/cli" + . "github.com/kyma-project/cli/tests/e2e" ) var _ = Describe("Kyma CLI deploy, enable and disable commands usage", Ordered, func() { @@ -46,7 +47,7 @@ var _ = Describe("Kyma CLI deploy, enable and disable commands usage", Ordered, cli.KymaNameDefault, cli.KymaNamespaceDefault, "template-operator", - v1beta2.StateReady). + shared.StateReady). Should(BeTrue()) }) @@ -60,7 +61,7 @@ var _ = Describe("Kyma CLI deploy, enable and disable commands usage", Ordered, It("And the Template Operator's CR state is ready", func() { Eventually(CrIsInExpectedState). WithContext(ctx). - WithArguments("sample", "sample-yaml", "kyma-system", v1beta2.StateReady). + WithArguments("sample", "sample-yaml", "kyma-system", shared.StateReady). Should(BeTrue()) }) }) @@ -99,7 +100,7 @@ var _ = Describe("Kyma CLI deploy, enable and disable commands usage", Ordered, cli.KymaNameDefault, cli.KymaNamespaceDefault, "template-operator", - v1beta2.StateWarning). + shared.StateWarning). Should(BeTrue()) }) @@ -113,7 +114,7 @@ var _ = Describe("Kyma CLI deploy, enable and disable commands usage", Ordered, It("And the Template Operator's CR state is in a warning state", func() { Eventually(CrIsInExpectedState). WithContext(ctx). - WithArguments("sample", "sample-yaml", "kyma-system", v1beta2.StateWarning). + WithArguments("sample", "sample-yaml", "kyma-system", shared.StateWarning). Should(BeTrue()) }) }) diff --git a/tests/e2e/util.go b/tests/e2e/util.go index 875f08ed4..3862cc44f 100644 --- a/tests/e2e/util.go +++ b/tests/e2e/util.go @@ -7,6 +7,7 @@ import ( "os/exec" "strings" + "github.com/kyma-project/lifecycle-manager/api/shared" "github.com/kyma-project/lifecycle-manager/api/v1beta2" . "github.com/onsi/ginkgo/v2" //nolint:stylecheck,revive v1 "github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc/meta/v1" @@ -79,7 +80,7 @@ func KymaCRIsInReadyState(ctx context.Context, Name: kymaName, }, &kyma) - return err == nil && kyma.Status.State == v1beta2.StateReady + return err == nil && kyma.Status.State == shared.StateReady } func ApplyModuleTemplate( @@ -151,7 +152,7 @@ func CRDIsAvailable(ctx context.Context, func CrIsInExpectedState(resourceType string, resourceName string, namespace string, - expectedState v1beta2.State) bool { + expectedState shared.State) bool { cmd := exec.Command("kubectl", "get", resourceType, resourceName, "-n", namespace, "-o", "jsonpath='{.status.state}'") @@ -170,7 +171,7 @@ func KymaContainsModuleInExpectedState(ctx context.Context, kymaName string, namespace string, moduleName string, - expectedState v1beta2.State) bool { + expectedState shared.State) bool { var kyma v1beta2.Kyma err := k8sClient.Get(ctx, client.ObjectKey{ Namespace: namespace, From 1840a46b706fa57562ac8cb7f5cf8616f3fdb19a Mon Sep 17 00:00:00 2001 From: jeremyharisch Date: Wed, 29 Nov 2023 16:24:16 +0100 Subject: [PATCH 06/13] Refactor unit test after upgrading KLM deps --- .../enable/module/mock/mock_interactor.go | 6 +- cmd/kyma/alpha/enable/module/module.go | 37 +----- cmd/kyma/alpha/enable/module/module_test.go | 106 +++++++++++------- internal/cli/alpha/module/module.go | 39 ++++++- 4 files changed, 110 insertions(+), 78 deletions(-) diff --git a/cmd/kyma/alpha/enable/module/mock/mock_interactor.go b/cmd/kyma/alpha/enable/module/mock/mock_interactor.go index 885ab40f1..da368ea73 100644 --- a/cmd/kyma/alpha/enable/module/mock/mock_interactor.go +++ b/cmd/kyma/alpha/enable/module/mock/mock_interactor.go @@ -27,7 +27,9 @@ func (m *Interactor) WaitUntilReady(ctx context.Context) error { return args.Error(0) } -func (m *Interactor) GetAllModuleTemplates(ctx context.Context) (v1beta2.ModuleTemplateList, error) { +// nolint:revive +func (m *Interactor) GetFilteredModuleTemplates(ctx context.Context, moduleIdentifier string) ([]v1beta2.ModuleTemplate, + error) { args := m.Called(ctx) - return args.Get(0).(v1beta2.ModuleTemplateList), args.Error(1) + return args.Get(0).([]v1beta2.ModuleTemplate), args.Error(1) } diff --git a/cmd/kyma/alpha/enable/module/module.go b/cmd/kyma/alpha/enable/module/module.go index f067d5040..398e52321 100644 --- a/cmd/kyma/alpha/enable/module/module.go +++ b/cmd/kyma/alpha/enable/module/module.go @@ -6,14 +6,16 @@ import ( "os" "time" - "github.com/kyma-project/cli/internal/cli/alpha/module" "github.com/kyma-project/lifecycle-manager/api/v1beta2" "go.uber.org/zap" "k8s.io/apimachinery/pkg/types" - "github.com/kyma-project/cli/internal/cli" + "github.com/kyma-project/cli/internal/cli/alpha/module" + "github.com/pkg/errors" "github.com/spf13/cobra" + + "github.com/kyma-project/cli/internal/cli" ) type command struct { @@ -159,15 +161,11 @@ func (cmd *command) run(ctx context.Context, l *zap.SugaredLogger, moduleName st func validateChannel(ctx context.Context, moduleInteractor module.Interactor, moduleIdentifier string, channel string, kymaChannel string) error { - allTemplates, err := moduleInteractor.GetAllModuleTemplates(ctx) + filteredModuleTemplates, err := moduleInteractor.GetFilteredModuleTemplates(ctx, moduleIdentifier) if err != nil { return fmt.Errorf("could not retrieve module templates in cluster to determine valid channels: %v", err) } - filteredModuleTemplates, err := filterModuleTemplates(allTemplates, moduleIdentifier) - if err != nil { - return fmt.Errorf("could not process module templates in the cluster: %v", err) - } if channel == "" { channel = kymaChannel } @@ -179,31 +177,6 @@ func validateChannel(ctx context.Context, moduleInteractor module.Interactor, return nil } -func filterModuleTemplates(allTemplates v1beta2.ModuleTemplateList, - moduleIdentifier string) ([]v1beta2.ModuleTemplate, error) { - var filteredModuleTemplates []v1beta2.ModuleTemplate - - for _, mt := range allTemplates.Items { - if mt.Labels[v1beta2.ModuleName] == moduleIdentifier { - filteredModuleTemplates = append(filteredModuleTemplates, mt) - continue - } - if mt.ObjectMeta.Name == moduleIdentifier { - filteredModuleTemplates = append(filteredModuleTemplates, mt) - continue - } - descriptor, err := mt.GetDescriptor() - if err != nil { - return nil, fmt.Errorf("invalid ModuleTemplate descriptor: %v", err) - } - if descriptor.Name == moduleIdentifier { - filteredModuleTemplates = append(filteredModuleTemplates, mt) - continue - } - } - return filteredModuleTemplates, nil -} - func enableModule(modules []v1beta2.Module, name, channel string, customResourcePolicy string) []v1beta2.Module { for idx := range modules { if modules[idx].Name == name { diff --git a/cmd/kyma/alpha/enable/module/module_test.go b/cmd/kyma/alpha/enable/module/module_test.go index d98cf0a16..ff6d9ff50 100644 --- a/cmd/kyma/alpha/enable/module/module_test.go +++ b/cmd/kyma/alpha/enable/module/module_test.go @@ -2,58 +2,84 @@ package module import ( "context" - "strings" "testing" - "github.com/kyma-project/cli/cmd/kyma/alpha/enable/module/mock" "github.com/kyma-project/lifecycle-manager/api/v1beta2" - "github.com/kyma-project/lifecycle-manager/pkg/testutils" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + + "github.com/kyma-project/cli/cmd/kyma/alpha/enable/module/mock" + "github.com/kyma-project/cli/internal/cli/alpha/module" ) -func TestChannelValidation(t *testing.T) { - // GIVEN +func Test_validateChannel(t *testing.T) { + ctx := context.TODO() - template1, _ := testutils.ModuleTemplateFactory(v1beta2.Module{ - Name: "test", - ControllerName: "-", - Channel: "fast", - CustomResourcePolicy: "-", - }, unstructured.Unstructured{}, false, false, false, false) - template2, _ := testutils.ModuleTemplateFactory(v1beta2.Module{ - Name: "not-test", - ControllerName: "-", - Channel: "alpha", - CustomResourcePolicy: "-", - }, unstructured.Unstructured{}, false, false, false, false) - allTemplates := v1beta2.ModuleTemplateList{ - TypeMeta: metav1.TypeMeta{}, - ListMeta: metav1.ListMeta{}, - Items: []v1beta2.ModuleTemplate{ - *template1, *template2, + filteredTemplates := []v1beta2.ModuleTemplate{ + { + ObjectMeta: metav1.ObjectMeta{Name: "test-module-A"}, + Spec: v1beta2.ModuleTemplateSpec{Channel: "regular"}, + }, + { + ObjectMeta: metav1.ObjectMeta{Name: "test-module-A"}, + Spec: v1beta2.ModuleTemplateSpec{Channel: "fast"}, }, } moduleInteractor := mock.Interactor{} moduleInteractor.Test(t) - moduleInteractor.On("GetAllModuleTemplates", ctx).Return(allTemplates, nil) - - // WHEN 1 - moduleName := "test" - channel := "alpha" - kymaChannel := "regular" - err := validateChannel(ctx, &moduleInteractor, moduleName, channel, kymaChannel) - // THEN 1 - if !strings.Contains(err.Error(), "the channel ["+channel+"] does not exist") { - t.Fatalf("channel validation failed. invalid channel [%s] did not throw error.", channel) + moduleInteractor.On("GetFilteredModuleTemplates", ctx).Return(filteredTemplates, nil) + type args struct { + ctx context.Context + moduleInteractor module.Interactor + moduleIdentifier string + channel string + kymaChannel string } - - // WHEN 2 - channel = "fast" - err = validateChannel(ctx, &moduleInteractor, moduleName, channel, kymaChannel) - // THEN 2 - if err != nil && strings.Contains(err.Error(), "the channel ["+channel+"] does not exist") { - t.Fatalf("channel validation failed. valid channel [%s] threw an error.", channel) + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: "Invalid Channel throws an error.", + args: args{ + ctx: ctx, + moduleInteractor: &moduleInteractor, + moduleIdentifier: "sample-module", + channel: "invalid", + kymaChannel: "regular", + }, + wantErr: true, + }, + { + name: "Valid Module validation with specified channel.", + args: args{ + ctx: ctx, + moduleInteractor: &moduleInteractor, + moduleIdentifier: "sample-module", + channel: "fast", + kymaChannel: "regular", + }, + wantErr: false, + }, + { + name: "Valid Module validation without specified channel, use Kyma channel", + args: args{ + ctx: ctx, + moduleInteractor: &moduleInteractor, + moduleIdentifier: "sample-module", + channel: "", + kymaChannel: "regular", + }, + wantErr: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if err := validateChannel(tt.args.ctx, tt.args.moduleInteractor, tt.args.moduleIdentifier, tt.args.channel, + tt.args.kymaChannel); (err != nil) != tt.wantErr { + t.Errorf("validateChannel() error = %v, wantErr %v", err, tt.wantErr) + } + }) } } diff --git a/internal/cli/alpha/module/module.go b/internal/cli/alpha/module/module.go index a8ec96cd6..bc3422d51 100644 --- a/internal/cli/alpha/module/module.go +++ b/internal/cli/alpha/module/module.go @@ -30,7 +30,7 @@ type Interactor interface { Update(ctx context.Context, modules []v1beta2.Module) error // WaitUntilReady blocks until all Modules are confirmed to be applied and ready WaitUntilReady(ctx context.Context) error - GetAllModuleTemplates(ctx context.Context) (v1beta2.ModuleTemplateList, error) + GetFilteredModuleTemplates(ctx context.Context, moduleIdentifier string) ([]v1beta2.ModuleTemplate, error) } var _ Interactor = &DefaultInteractor{} @@ -68,12 +68,43 @@ func (i *DefaultInteractor) Get(ctx context.Context) ([]v1beta2.Module, string, return kyma.Spec.Modules, kyma.Spec.Channel, nil } -func (i *DefaultInteractor) GetAllModuleTemplates(ctx context.Context) (v1beta2.ModuleTemplateList, error) { +func (i *DefaultInteractor) GetFilteredModuleTemplates(ctx context.Context, + moduleIdentifier string) ([]v1beta2.ModuleTemplate, error) { var allTemplates v1beta2.ModuleTemplateList if err := i.K8s.Ctrl().List(ctx, &allTemplates); err != nil { - return v1beta2.ModuleTemplateList{}, fmt.Errorf("could not get Moduletemplates: %w", err) + return []v1beta2.ModuleTemplate{}, fmt.Errorf("could not get Moduletemplates: %w", err) } - return allTemplates, nil + + filteredModuleTemplates, err := i.filterModuleTemplates(allTemplates, moduleIdentifier) + if err != nil { + return nil, fmt.Errorf("could not filter fetched Moduletemplates: %w", err) + } + return filteredModuleTemplates, nil +} + +func (i *DefaultInteractor) filterModuleTemplates(allTemplates v1beta2.ModuleTemplateList, + moduleIdentifier string) ([]v1beta2.ModuleTemplate, error) { + var filteredModuleTemplates []v1beta2.ModuleTemplate + + for _, mt := range allTemplates.Items { + if mt.Labels[v1beta2.ModuleName] == moduleIdentifier { + filteredModuleTemplates = append(filteredModuleTemplates, mt) + continue + } + if mt.ObjectMeta.Name == moduleIdentifier { + filteredModuleTemplates = append(filteredModuleTemplates, mt) + continue + } + descriptor, err := mt.GetDescriptor() + if err != nil { + return nil, fmt.Errorf("invalid ModuleTemplate descriptor: %v", err) + } + if descriptor.Name == moduleIdentifier { + filteredModuleTemplates = append(filteredModuleTemplates, mt) + continue + } + } + return filteredModuleTemplates, nil } // Update tries to update the modules in the Kyma Instance and retries on failure From 01efabe7a869bc48bba9ac03273ebab21905afd0 Mon Sep 17 00:00:00 2001 From: jeremyharisch Date: Wed, 29 Nov 2023 16:55:52 +0100 Subject: [PATCH 07/13] Use working dir in action --- .github/workflows/test-e2e-create-module.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-e2e-create-module.yml b/.github/workflows/test-e2e-create-module.yml index a53f56960..1b5679492 100644 --- a/.github/workflows/test-e2e-create-module.yml +++ b/.github/workflows/test-e2e-create-module.yml @@ -52,21 +52,22 @@ jobs: k3d registry create oci.localhost --port 5001 - name: Run create module with kubebuilder-project if: ${{ matrix.e2e-test == 'test-kubebuilder-module-creation' }} + working-directory: template-operator run: | kyma alpha create module \ --name kyma-project.io/module/template-operator \ - --path ./template-operator \ + --path . \ --registry http://k3d-oci.localhost:5001 \ --insecure \ --kubebuilder-project \ --version $MODULE_TEMPLATE_VERSION -v \ --output /tmp/kubebuilder-template.yaml \ - --sec-scanners-config ./template-operator/sec-scanners-config.yaml - echo "MODULE_TEMPLATE_PATH=/tmp/kubebuilder-template.yaml" >> "$GITHUB_ENV" + --sec-scanners-config ./sec-scanners-config.yaml + echo "MODULE_TEMPLATE_PATH=/template-operator/tmp/kubebuilder-template.yaml" >> "$GITHUB_ENV" - name: Run create module with module-config if: ${{ matrix.e2e-test == 'test-moduleconfig-module-creation' || matrix.e2e-test == 'test-same-version-module-creation'}} + working-directory: template-operator run: | - cd ./template-operator make build-manifests kyma alpha create module \ --name kyma-project.io/module/template-operator \ @@ -76,7 +77,7 @@ jobs: --module-config-file ./module-config.yaml \ --version $MODULE_TEMPLATE_VERSION -v \ --output /tmp/module-config-template.yaml - echo "MODULE_TEMPLATE_PATH=/tmp/module-config-template.yaml" >> "$GITHUB_ENV" + echo "MODULE_TEMPLATE_PATH=/template-operator/tmp/module-config-template.yaml" >> "$GITHUB_ENV" - name: Verify module template if: ${{ matrix.e2e-test == 'test-moduleconfig-module-creation' || matrix.e2e-test == 'test-kubebuilder-module-creation'}} run: | From ea67094dd9ed4858b5ef81285f485942f278cdc8 Mon Sep 17 00:00:00 2001 From: jeremyharisch Date: Wed, 29 Nov 2023 17:00:23 +0100 Subject: [PATCH 08/13] Use working dir in action --- .github/workflows/test-e2e-create-module.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-e2e-create-module.yml b/.github/workflows/test-e2e-create-module.yml index 1b5679492..226580dbc 100644 --- a/.github/workflows/test-e2e-create-module.yml +++ b/.github/workflows/test-e2e-create-module.yml @@ -42,8 +42,8 @@ jobs: repository: kyma-project/template-operator path: ./template-operator/ - name: export template-operator URL + working-directory: template-operator run: | - cd ./template-operator echo "TEST_REPOSITORY_URL=$(git remote get-url origin)" >> "$GITHUB_ENV" - name: Set up k3d run: wget -qO - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=$K3D_VERSION bash From 87f3041437a7f180490bbeb0dcaafcebc4cc7424 Mon Sep 17 00:00:00 2001 From: jeremyharisch Date: Wed, 29 Nov 2023 17:28:52 +0100 Subject: [PATCH 09/13] Fix nil pointer reference --- cmd/kyma/alpha/create/module/module.go | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/cmd/kyma/alpha/create/module/module.go b/cmd/kyma/alpha/create/module/module.go index e5269dc63..5a50858d6 100644 --- a/cmd/kyma/alpha/create/module/module.go +++ b/cmd/kyma/alpha/create/module/module.go @@ -128,7 +128,8 @@ Build a Kubebuilder module my-domain/modC in version 3.2.1 and push it to a loca "Uses the host filesystem instead of in-memory archiving to build the module.", ) - cmd.Flags().BoolVar(&o.ArchiveVersionOverwrite, "module-archive-version-overwrite", false, "Overwrites existing component's versions of the module. If set to false, the push is a No-Op.") + cmd.Flags().BoolVar(&o.ArchiveVersionOverwrite, "module-archive-version-overwrite", false, + "Overwrites existing component's versions of the module. If set to false, the push is a No-Op.") cmd.Flags().StringVar( &o.GitRemote, "git-remote", "origin", @@ -184,7 +185,8 @@ Build a Kubebuilder module my-domain/modC in version 3.2.1 and push it to a loca &o.PrivateKeyPath, "key", "", "Specifies the path where a private key is used for signing.", ) - cmd.Flags().BoolVar(&o.KubebuilderProject, "kubebuilder-project", false, "Specifies provided module is a Kubebuilder Project.") + cmd.Flags().BoolVar(&o.KubebuilderProject, "kubebuilder-project", false, + "Specifies provided module is a Kubebuilder Project.") configureLegacyFlags(cmd, o) @@ -213,7 +215,8 @@ func configureLegacyFlags(cmd *cobra.Command, o *Options) *cobra.Command { cmd.Flags().StringVar(&o.Channel, "channel", "regular", "Channel to use for the module template.") - cmd.Flags().StringVar(&o.Namespace, "namespace", kcpSystemNamespace, "Specifies the namespace where the ModuleTemplate is deployed.") + cmd.Flags().StringVar(&o.Namespace, "namespace", kcpSystemNamespace, + "Specifies the namespace where the ModuleTemplate is deployed.") return cmd } @@ -389,15 +392,17 @@ func (cmd *command) Run(ctx context.Context) error { } var namespace = cmd.opts.Namespace + mandatoryModule := false if modCnf != nil && modCnf.Namespace != "" { namespace = modCnf.Namespace + mandatoryModule = modCnf.Mandatory } labels := cmd.getModuleTemplateLabels(modCnf) annotations := cmd.getModuleTemplateAnnotations(modCnf, crValidator) template, err := module.Template(componentVersionAccess, resourceName, namespace, - channel, modDef.DefaultCR, labels, annotations, modDef.CustomStateChecks, modCnf.Mandatory) + channel, modDef.DefaultCR, labels, annotations, modDef.CustomStateChecks, mandatoryModule) if err != nil { cmd.CurrentStep.Failure() return err @@ -447,7 +452,8 @@ func (cmd *command) getModuleTemplateAnnotations(modCnf *Config, crValidator val return annotations } -func (cmd *command) validateDefaultCR(ctx context.Context, modDef *module.Definition, l *zap.SugaredLogger) (validator, error) { +func (cmd *command) validateDefaultCR(ctx context.Context, modDef *module.Definition, l *zap.SugaredLogger) (validator, + error) { cmd.NewStep("Validating Default CR") var crValidator validator @@ -509,7 +515,7 @@ func (cmd *command) moduleDefinitionFromOptions() (*module.Definition, *Config, np := nice.Nice{} np.PrintImportant("WARNING: The Kubebuilder support is DEPRECATED. Use the simple mode by providing the \"--module-config-file\" flag instead.") - //legacy approach, flag-based + // legacy approach, flag-based def = &module.Definition{ Name: cmd.opts.Name, Version: cmd.opts.Version, @@ -523,7 +529,7 @@ func (cmd *command) moduleDefinitionFromOptions() (*module.Definition, *Config, return def, cnf, nil } - //new approach, config-file based + // new approach, config-file based moduleConfig, err := ParseConfig(cmd.opts.ModuleConfigFile) if err != nil { return nil, nil, err From 08e086010c8ca1e1e8c75eb37f5961deea727059 Mon Sep 17 00:00:00 2001 From: jeremyharisch Date: Wed, 29 Nov 2023 17:35:25 +0100 Subject: [PATCH 10/13] revert action changes --- .github/workflows/test-e2e-create-module.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-e2e-create-module.yml b/.github/workflows/test-e2e-create-module.yml index 226580dbc..a53f56960 100644 --- a/.github/workflows/test-e2e-create-module.yml +++ b/.github/workflows/test-e2e-create-module.yml @@ -42,8 +42,8 @@ jobs: repository: kyma-project/template-operator path: ./template-operator/ - name: export template-operator URL - working-directory: template-operator run: | + cd ./template-operator echo "TEST_REPOSITORY_URL=$(git remote get-url origin)" >> "$GITHUB_ENV" - name: Set up k3d run: wget -qO - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=$K3D_VERSION bash @@ -52,22 +52,21 @@ jobs: k3d registry create oci.localhost --port 5001 - name: Run create module with kubebuilder-project if: ${{ matrix.e2e-test == 'test-kubebuilder-module-creation' }} - working-directory: template-operator run: | kyma alpha create module \ --name kyma-project.io/module/template-operator \ - --path . \ + --path ./template-operator \ --registry http://k3d-oci.localhost:5001 \ --insecure \ --kubebuilder-project \ --version $MODULE_TEMPLATE_VERSION -v \ --output /tmp/kubebuilder-template.yaml \ - --sec-scanners-config ./sec-scanners-config.yaml - echo "MODULE_TEMPLATE_PATH=/template-operator/tmp/kubebuilder-template.yaml" >> "$GITHUB_ENV" + --sec-scanners-config ./template-operator/sec-scanners-config.yaml + echo "MODULE_TEMPLATE_PATH=/tmp/kubebuilder-template.yaml" >> "$GITHUB_ENV" - name: Run create module with module-config if: ${{ matrix.e2e-test == 'test-moduleconfig-module-creation' || matrix.e2e-test == 'test-same-version-module-creation'}} - working-directory: template-operator run: | + cd ./template-operator make build-manifests kyma alpha create module \ --name kyma-project.io/module/template-operator \ @@ -77,7 +76,7 @@ jobs: --module-config-file ./module-config.yaml \ --version $MODULE_TEMPLATE_VERSION -v \ --output /tmp/module-config-template.yaml - echo "MODULE_TEMPLATE_PATH=/template-operator/tmp/module-config-template.yaml" >> "$GITHUB_ENV" + echo "MODULE_TEMPLATE_PATH=/tmp/module-config-template.yaml" >> "$GITHUB_ENV" - name: Verify module template if: ${{ matrix.e2e-test == 'test-moduleconfig-module-creation' || matrix.e2e-test == 'test-kubebuilder-module-creation'}} run: | From ddf8e30cce620793ed7951c521b7d5e38b7c804b Mon Sep 17 00:00:00 2001 From: jeremyharisch Date: Thu, 30 Nov 2023 14:20:21 +0100 Subject: [PATCH 11/13] fix wrong if condition --- cmd/kyma/alpha/create/module/module.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/cmd/kyma/alpha/create/module/module.go b/cmd/kyma/alpha/create/module/module.go index 5a50858d6..308029dc1 100644 --- a/cmd/kyma/alpha/create/module/module.go +++ b/cmd/kyma/alpha/create/module/module.go @@ -382,20 +382,18 @@ func (cmd *command) Run(ctx context.Context) error { cmd.NewStep("Generating module template...") var resourceName = "" - if modCnf != nil { - resourceName = modCnf.ResourceName - } - + mandatoryModule := false var channel = cmd.opts.Channel if modCnf != nil { + resourceName = modCnf.ResourceName channel = modCnf.Channel + mandatoryModule = modCnf.Mandatory } var namespace = cmd.opts.Namespace - mandatoryModule := false if modCnf != nil && modCnf.Namespace != "" { namespace = modCnf.Namespace - mandatoryModule = modCnf.Mandatory + } labels := cmd.getModuleTemplateLabels(modCnf) From 9eef241e155a0b8b52bed14b8cb262b6b0f73684 Mon Sep 17 00:00:00 2001 From: jeremyharisch Date: Thu, 30 Nov 2023 14:35:03 +0100 Subject: [PATCH 12/13] set mandatory to optional --- cmd/kyma/alpha/create/module/moduleconfig.go | 49 +++++++++++--------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/cmd/kyma/alpha/create/module/moduleconfig.go b/cmd/kyma/alpha/create/module/moduleconfig.go index 49979ebb1..6ae8a0c0d 100644 --- a/cmd/kyma/alpha/create/module/moduleconfig.go +++ b/cmd/kyma/alpha/create/module/moduleconfig.go @@ -2,35 +2,37 @@ package module import ( "fmt" - "github.com/kyma-project/cli/pkg/module" - "github.com/kyma-project/lifecycle-manager/api/v1beta2" "os" "regexp" "strings" + "github.com/kyma-project/lifecycle-manager/api/v1beta2" + + "github.com/kyma-project/cli/pkg/module" + "github.com/blang/semver/v4" "gopkg.in/yaml.v3" ) type Config struct { - Name string `yaml:"name"` //required, the name of the Module - Version string `yaml:"version"` //required, the version of the Module - Channel string `yaml:"channel"` //required, channel that should be used in the ModuleTemplate - ManifestPath string `yaml:"manifest"` //required, reference to the manifests, must be a relative file name. - Mandatory bool `yaml:"mandatory"` //required, indicates whether the module is mandatory to be installed on all clusters. - DefaultCRPath string `yaml:"defaultCR"` //optional, reference to a YAML file containing the default CR for the module, must be a relative file name. - ResourceName string `yaml:"resourceName"` //optional, default={NAME}-{CHANNEL}, the name for the ModuleTemplate that will be created - Namespace string `yaml:"namespace"` //optional, default=kcp-system, the namespace where the ModuleTemplate will be deployed - Security string `yaml:"security"` //optional, name of the security scanners config file - Internal bool `yaml:"internal"` //optional, default=false, determines whether the ModuleTemplate should have the internal flag or not - Beta bool `yaml:"beta"` //optional, default=false, determines whether the ModuleTemplate should have the beta flag or not - Labels map[string]string `yaml:"labels"` //optional, additional labels for the ModuleTemplate - Annotations map[string]string `yaml:"annotations"` //optional, additional annotations for the ModuleTemplate - CustomStateChecks []v1beta2.CustomStateCheck `yaml:"customStateCheck"` //optional, specifies custom state check for module + Name string `yaml:"name"` // required, the name of the Module + Version string `yaml:"version"` // required, the version of the Module + Channel string `yaml:"channel"` // required, channel that should be used in the ModuleTemplate + ManifestPath string `yaml:"manifest"` // required, reference to the manifests, must be a relative file name. + Mandatory bool `yaml:"mandatory"` // optional, default=false, indicates whether the module is mandatory to be installed on all clusters. + DefaultCRPath string `yaml:"defaultCR"` // optional, reference to a YAML file containing the default CR for the module, must be a relative file name. + ResourceName string `yaml:"resourceName"` // optional, default={NAME}-{CHANNEL}, the name for the ModuleTemplate that will be created + Namespace string `yaml:"namespace"` // optional, default=kcp-system, the namespace where the ModuleTemplate will be deployed + Security string `yaml:"security"` // optional, name of the security scanners config file + Internal bool `yaml:"internal"` // optional, default=false, determines whether the ModuleTemplate should have the internal flag or not + Beta bool `yaml:"beta"` // optional, default=false, determines whether the ModuleTemplate should have the beta flag or not + Labels map[string]string `yaml:"labels"` // optional, additional labels for the ModuleTemplate + Annotations map[string]string `yaml:"annotations"` // optional, additional annotations for the ModuleTemplate + CustomStateChecks []v1beta2.CustomStateCheck `yaml:"customStateCheck"` // optional, specifies custom state check for module } const ( - //taken from "github.com/open-component-model/ocm/resources/component-descriptor-v2-schema.yaml" + // taken from "github.com/open-component-model/ocm/resources/component-descriptor-v2-schema.yaml" moduleNamePattern = "^[a-z][-a-z0-9]*([.][a-z][-a-z0-9]*)*[.][a-z]{2,}(/[a-z][-a-z0-9_]*([.][a-z][-a-z0-9_]*)*)+$" namespacePattern = "^[a-z0-9]+(?:-[a-z0-9]+)*$" moduleNameMaxLen = 255 @@ -95,7 +97,8 @@ func (cv *configValidator) validateName() *configValidator { return fmt.Errorf("failed to evaluate regex for module name pattern: %w", err) } if !matched { - return fmt.Errorf("%w for input %q, name must match the required pattern, e.g: 'github.com/path-to/your-repo'", ErrNameValidation, cv.config.Name) + return fmt.Errorf("%w for input %q, name must match the required pattern, e.g: 'github.com/path-to/your-repo'", + ErrNameValidation, cv.config.Name) } return nil @@ -117,7 +120,8 @@ func (cv *configValidator) validateNamespace() *configValidator { return fmt.Errorf("failed to evaluate regex for module namespace pattern: %w", err) } if !matched { - return fmt.Errorf("%w for input %q, namespace must contain only small alphanumeric characters and hyphens", ErrNamespaceValidation, cv.config.Namespace) + return fmt.Errorf("%w for input %q, namespace must contain only small alphanumeric characters and hyphens", + ErrNamespaceValidation, cv.config.Namespace) } return nil @@ -132,7 +136,7 @@ func (cv *configValidator) validateVersion() *configValidator { prefix := "" val := strings.TrimSpace(cv.config.Version) - //strip the leading "v", if any, because it's not part of a proper semver + // strip the leading "v", if any, because it's not part of a proper semver if strings.HasPrefix(val, "v") { prefix = "v" val = val[1:] @@ -143,7 +147,7 @@ func (cv *configValidator) validateVersion() *configValidator { return fmt.Errorf("%w for input %q, %w", ErrVersionValidation, cv.config.Version, err) } - //restore "v" prefix, if any + // restore "v" prefix, if any correct := prefix + sv.String() if correct != cv.config.Version { @@ -167,7 +171,8 @@ func (cv *configValidator) validateChannel() *configValidator { return fmt.Errorf("failed to evaluate regex for channel: %w", err) } if !matched { - return fmt.Errorf("%w for input %q, invalid channel format, only allow characters from a-z", ErrChannelValidation, cv.config.Channel) + return fmt.Errorf("%w for input %q, invalid channel format, only allow characters from a-z", + ErrChannelValidation, cv.config.Channel) } return nil From c542e9a9b220998f3f3d413290f8acde8494553e Mon Sep 17 00:00:00 2001 From: jeremyharisch Date: Thu, 30 Nov 2023 15:44:53 +0100 Subject: [PATCH 13/13] Move mandatory to higher place --- pkg/module/template.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/module/template.go b/pkg/module/template.go index d33ead417..d7d307850 100644 --- a/pkg/module/template.go +++ b/pkg/module/template.go @@ -35,6 +35,7 @@ metadata: {{- end}} spec: channel: {{.Channel}} + mandatory: {{.Mandatory}} {{- with .CustomStateChecks}} customStateCheck: {{- range .}} @@ -49,7 +50,6 @@ spec: {{- end}} descriptor: {{yaml .Descriptor | printf "%s" | indent 4}} - mandatory: {{.Mandatory}} ` )