From 9c90d3ad343a56a04dcf94e40754f91266c13a3d Mon Sep 17 00:00:00 2001 From: Casey Davenport Date: Tue, 5 Nov 2024 11:19:48 -0800 Subject: [PATCH] Fix API group in autogeneration (#3588) * Fix group in PROJECT * Fix group in PROJECT --- PROJECT | 42 +++++++++++++++---------------- cmd/main.go | 14 +++++------ internal/controller/suite_test.go | 4 +-- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/PROJECT b/PROJECT index b0568af20b..6253f9e213 100644 --- a/PROJECT +++ b/PROJECT @@ -15,7 +15,7 @@ resources: crdVersion: v1 controller: true domain: tigera.io - group: operator + group: operator.tigera.io kind: Installation path: github.com/tigera/operator/api/v1 version: v1 @@ -23,7 +23,7 @@ resources: crdVersion: v1 controller: true domain: tigera.io - group: operator + group: operator.tigera.io kind: APIServer path: github.com/tigera/operator/api/v1 version: v1 @@ -31,7 +31,7 @@ resources: crdVersion: v1 controller: true domain: tigera.io - group: operator + group: operator.tigera.io kind: Monitor path: github.com/tigera/operator/api/v1 version: v1 @@ -39,7 +39,7 @@ resources: crdVersion: v1 controller: true domain: tigera.io - group: operator + group: operator.tigera.io kind: LogCollector path: github.com/tigera/operator/api/v1 version: v1 @@ -47,7 +47,7 @@ resources: crdVersion: v1 controller: true domain: tigera.io - group: operator + group: operator.tigera.io kind: TigeraStatus path: github.com/tigera/operator/api/v1 version: v1 @@ -56,7 +56,7 @@ resources: namespaced: true controller: true domain: tigera.io - group: operator + group: operator.tigera.io kind: EgressGateway path: github.com/tigera/operator/api/v1 version: v1 @@ -64,7 +64,7 @@ resources: crdVersion: v1 controller: true domain: tigera.io - group: operator + group: operator.tigera.io kind: ImageSet path: github.com/tigera/operator/api/v1 version: v1 @@ -72,7 +72,7 @@ resources: crdVersion: v1 controller: true domain: tigera.io - group: operator + group: operator.tigera.io kind: IntrusionDetection path: github.com/tigera/operator/api/v1 version: v1 @@ -80,7 +80,7 @@ resources: crdVersion: v1 controller: true domain: tigera.io - group: operator + group: operator.tigera.io kind: PacketCaptureAPI path: github.com/tigera/operator/api/v1 version: v1 @@ -88,7 +88,7 @@ resources: crdVersion: v1 controller: true domain: tigera.io - group: operator + group: operator.tigera.io kind: LogStorage path: github.com/tigera/operator/api/v1 version: v1 @@ -96,7 +96,7 @@ resources: crdVersion: v1 controller: true domain: tigera.io - group: operator + group: operator.tigera.io kind: Authentication path: github.com/tigera/operator/api/v1 version: v1 @@ -104,7 +104,7 @@ resources: crdVersion: v1 controller: true domain: tigera.io - group: operator + group: operator.tigera.io kind: ManagementCluster path: github.com/tigera/operator/api/v1 version: v1 @@ -112,7 +112,7 @@ resources: crdVersion: v1 controller: true domain: tigera.io - group: operator + group: operator.tigera.io kind: ApplicationLayer path: github.com/tigera/operator/api/v1 version: v1 @@ -120,7 +120,7 @@ resources: crdVersion: v1 controller: true domain: tigera.io - group: operator + group: operator.tigera.io kind: Manager path: github.com/tigera/operator/api/v1 version: v1 @@ -128,7 +128,7 @@ resources: crdVersion: v1 namespaced: true domain: tigera.io - group: operator + group: operator.tigera.io kind: Tenant path: github.com/tigera/operator/api/v1 version: v1 @@ -136,7 +136,7 @@ resources: crdVersion: v1 controller: true domain: tigera.io - group: operator + group: operator.tigera.io kind: ManagementClusterConnection path: github.com/tigera/operator/api/v1 version: v1 @@ -144,7 +144,7 @@ resources: crdVersion: v1 controller: true domain: tigera.io - group: operator + group: operator.tigera.io kind: NonClusterHost path: github.com/tigera/operator/api/v1 version: v1 @@ -152,7 +152,7 @@ resources: crdVersion: v1 controller: true domain: tigera.io - group: operator + group: operator.tigera.io kind: PolicyRecommendation path: github.com/tigera/operator/api/v1 version: v1 @@ -160,21 +160,21 @@ resources: crdVersion: v1 controller: true domain: tigera.io - group: operator + group: operator.tigera.io kind: Compliance path: github.com/tigera/operator/api/v1 version: v1 - api: crdVersion: v1 domain: tigera.io - group: operator + group: operator.tigera.io kind: TLSTerminatedRoute path: github.com/tigera/operator/api/v1 version: v1 - api: crdVersion: v1 domain: tigera.io - group: operator + group: operator.tigera.io kind: TLSPassthroughRoute path: github.com/tigera/operator/api/v1 version: v1 diff --git a/cmd/main.go b/cmd/main.go index ccebbc12a8..c13c18c932 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -28,7 +28,6 @@ import ( v3 "github.com/tigera/api/pkg/apis/projectcalico/v3" - operatorv1 "github.com/tigera/operator/api/v1" v1 "github.com/tigera/operator/api/v1" "github.com/tigera/operator/internal/controller" "github.com/tigera/operator/pkg/active" @@ -46,6 +45,7 @@ import ( "github.com/tigera/operator/pkg/render/logstorage/eck" "github.com/tigera/operator/version" + operatortigeraiov1 "github.com/tigera/operator/api/v1" "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -80,7 +80,7 @@ func init() { // +kubebuilder:scaffold:scheme utilruntime.Must(clientgoscheme.AddToScheme(scheme)) utilruntime.Must(apiextensions.AddToScheme(scheme)) - utilruntime.Must(operatorv1.AddToScheme(scheme)) + utilruntime.Must(operatortigeraiov1.AddToScheme(scheme)) utilruntime.Must(apis.AddToScheme(scheme)) } @@ -159,7 +159,7 @@ func main() { os.Exit(0) } if printCalicoCRDs != "" { - if err := showCRDs(operatorv1.Calico, printCalicoCRDs); err != nil { + if err := showCRDs(operatortigeraiov1.Calico, printCalicoCRDs); err != nil { fmt.Println(err) os.Exit(1) } @@ -167,7 +167,7 @@ func main() { } if printEnterpriseCRDs != "" { - if err := showCRDs(operatorv1.TigeraSecureEnterprise, printEnterpriseCRDs); err != nil { + if err := showCRDs(operatortigeraiov1.TigeraSecureEnterprise, printEnterpriseCRDs); err != nil { fmt.Println(err) os.Exit(1) } @@ -488,7 +488,7 @@ func metricsAddr() string { return fmt.Sprintf("%s:%s", metricsHost, metricsPort) } -func showCRDs(variant operatorv1.ProductVariant, outputType string) error { +func showCRDs(variant operatortigeraiov1.ProductVariant, outputType string) error { first := true for _, v := range crds.GetCRDs(variant) { if outputType != "all" { @@ -521,9 +521,9 @@ func executePreDeleteHook(ctx context.Context, c client.Client) error { // Clean up any custom-resources first - this will trigger teardown of pods deloyed // by the operator, and give the operator a chance to clean up gracefully. - installation := &operatorv1.Installation{} + installation := &operatortigeraiov1.Installation{} installation.Name = utils.DefaultInstanceKey.Name - apiserver := &operatorv1.APIServer{} + apiserver := &operatortigeraiov1.APIServer{} apiserver.Name = utils.DefaultInstanceKey.Name for _, o := range []client.Object{installation, apiserver} { if err := c.Delete(ctx, o); err != nil { diff --git a/internal/controller/suite_test.go b/internal/controller/suite_test.go index 15f471e598..7d9f8a3414 100644 --- a/internal/controller/suite_test.go +++ b/internal/controller/suite_test.go @@ -32,7 +32,7 @@ import ( logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log/zap" - operatorv1 "github.com/tigera/operator/api/v1" + operatortigeraiov1 "github.com/tigera/operator/api/v1" //+kubebuilder:scaffold:imports ) @@ -74,7 +74,7 @@ var _ = BeforeSuite(func() { Expect(err).NotTo(HaveOccurred()) Expect(cfg).NotTo(BeNil()) - err = operatorv1.AddToScheme(scheme.Scheme) + err = operatortigeraiov1.AddToScheme(scheme.Scheme) Expect(err).NotTo(HaveOccurred()) //+kubebuilder:scaffold:scheme