From e0a760f4182060eb7750dfc0a5fdc2c06b44b861 Mon Sep 17 00:00:00 2001 From: Jakub Warczarek Date: Mon, 25 Nov 2024 17:00:13 +0100 Subject: [PATCH] chore(generators): make file naming uniform zz_generated.* (#882) --- .gitattributes | 2 +- Makefile | 2 +- hack/generators/kic/role-generator/main.go | 6 +- .../kic/role-generator/templates.go | 4 +- .../kic/webhook-config-generator/main.go | 4 +- .../generators/testcases-registration/main.go | 2 +- .../kubernetes/resources/clusterroles/doc.go | 4 +- ...d.controlplane_clusterrole_ge3_1_lt3_2.go} | 0 ...d.controlplane_clusterrole_ge3_2_lt3_3.go} | 0 ...nerated.controlplane_clusterrole_ge3_3.go} | 0 ...ng_ingress_controller_rbac_ge3_1_lt3_2.go} | 0 ...ng_ingress_controller_rbac_ge3_2_lt3_3.go} | 0 ...ted.kong_ingress_controller_rbac_ge3_3.go} | 0 ...3_2.go => zz_generated.kic_ge3_1_lt3_2.go} | 0 ...3_3.go => zz_generated.kic_ge3_2_lt3_3.go} | 0 ...kic_ge3_3.go => zz_generated.kic_ge3_3.go} | 0 .../zz_generated_kic_ge3_1.go | 341 --------------- .../zz_generated_kic_ge3_2.go | 405 ------------------ ...go => zz_generated.clusterrole_helpers.go} | 0 ..._generated.kic_validatingwebhookconfig.go} | 0 ...way_api.go => zz_generated.gateway_api.go} | 0 ...o => zz_generated.registered_testcases.go} | 0 22 files changed, 12 insertions(+), 758 deletions(-) rename pkg/utils/kubernetes/resources/clusterroles/{zz_generated_controlplane_clusterrole_ge3_1_lt3_2.go => zz_generated.controlplane_clusterrole_ge3_1_lt3_2.go} (100%) rename pkg/utils/kubernetes/resources/clusterroles/{zz_generated_controlplane_clusterrole_ge3_2_lt3_3.go => zz_generated.controlplane_clusterrole_ge3_2_lt3_3.go} (100%) rename pkg/utils/kubernetes/resources/clusterroles/{zz_generated_controlplane_clusterrole_ge3_3.go => zz_generated.controlplane_clusterrole_ge3_3.go} (100%) rename pkg/utils/kubernetes/resources/clusterroles/{zz_generated_kong_ingress_controller_rbac_ge3_1_lt3_2.go => zz_generated.kong_ingress_controller_rbac_ge3_1_lt3_2.go} (100%) rename pkg/utils/kubernetes/resources/clusterroles/{zz_generated_kong_ingress_controller_rbac_ge3_2_lt3_3.go => zz_generated.kong_ingress_controller_rbac_ge3_2_lt3_3.go} (100%) rename pkg/utils/kubernetes/resources/clusterroles/{zz_generated_kong_ingress_controller_rbac_ge3_3.go => zz_generated.kong_ingress_controller_rbac_ge3_3.go} (100%) rename pkg/utils/kubernetes/resources/validatingwebhookconfig/{zz_generated_kic_ge3_1_lt3_2.go => zz_generated.kic_ge3_1_lt3_2.go} (100%) rename pkg/utils/kubernetes/resources/validatingwebhookconfig/{zz_generated_kic_ge3_2_lt3_3.go => zz_generated.kic_ge3_2_lt3_3.go} (100%) rename pkg/utils/kubernetes/resources/validatingwebhookconfig/{zz_generated_kic_ge3_3.go => zz_generated.kic_ge3_3.go} (100%) delete mode 100644 pkg/utils/kubernetes/resources/validatingwebhookconfig/zz_generated_kic_ge3_1.go delete mode 100644 pkg/utils/kubernetes/resources/validatingwebhookconfig/zz_generated_kic_ge3_2.go rename pkg/utils/kubernetes/resources/{zz_generated_clusterrole_helpers.go => zz_generated.clusterrole_helpers.go} (100%) rename pkg/utils/kubernetes/resources/{zz_generated_kic_validatingwebhookconfig.go => zz_generated.kic_validatingwebhookconfig.go} (100%) rename pkg/utils/test/{zz_generated_gateway_api.go => zz_generated.gateway_api.go} (100%) rename test/integration/{zz_generated_registered_testcases.go => zz_generated.registered_testcases.go} (100%) diff --git a/.gitattributes b/.gitattributes index 5a81cdb4f..079cdddac 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,3 @@ -**/zz_generated*.go linguist-generated=true +**/zz_generated.*.go linguist-generated=true pkg/clientset/** linguist-generated=true controller/konnect/ops/*_mock_test.go linguist-generated=true diff --git a/Makefile b/Makefile index 608892e5f..8fb86fddb 100644 --- a/Makefile +++ b/Makefile @@ -466,7 +466,7 @@ generate.gateway-api-urls: CRDS_EXPERIMENTAL_URL="$(GATEWAY_API_CRDS_EXPERIMENTAL_URL)" \ RAW_REPO_URL="$(GATEWAY_API_RAW_REPO_URL)" \ INPUT=$(shell pwd)/internal/utils/cmd/generate-gateway-api-urls/gateway_consts.tmpl \ - OUTPUT=$(shell pwd)/pkg/utils/test/zz_generated_gateway_api.go \ + OUTPUT=$(shell pwd)/pkg/utils/test/zz_generated.gateway_api.go \ go generate -tags=generate_gateway_api_urls ./internal/utils/cmd/generate-gateway-api-urls .PHONY: go-mod-download-gateway-api diff --git a/hack/generators/kic/role-generator/main.go b/hack/generators/kic/role-generator/main.go index 1d3615b5e..97809769f 100644 --- a/hack/generators/kic/role-generator/main.go +++ b/hack/generators/kic/role-generator/main.go @@ -25,12 +25,12 @@ var clusterRoleRelativePaths = []string{ const ( controllerRBACPath = "./pkg/utils/kubernetes/resources/clusterroles/" - controllerRBACFilePrefix = "zz_generated_kong_ingress_controller_rbac" + controllerRBACFilePrefix = "zz_generated.kong_ingress_controller_rbac" kicRBACPath = "./pkg/utils/kubernetes/resources/clusterroles" - kicRBACFIlePrefix = "zz_generated_controlplane_clusterrole" + kicRBACFIlePrefix = "zz_generated.controlplane_clusterrole" - kicRBACHelperFileName = "./pkg/utils/kubernetes/resources/zz_generated_clusterrole_helpers.go" + kicRBACHelperFileName = "./pkg/utils/kubernetes/resources/zz_generated.clusterrole_helpers.go" docFileName = controllerRBACPath + "doc.go" ) diff --git a/hack/generators/kic/role-generator/templates.go b/hack/generators/kic/role-generator/templates.go index f71ef81d0..3bfe423b3 100644 --- a/hack/generators/kic/role-generator/templates.go +++ b/hack/generators/kic/role-generator/templates.go @@ -24,10 +24,10 @@ const ( // Controller) ClusterRoles. // // It contains 2 types of files: -// - zz_generated_kong_ingress_controller_rbac_*.go: contains kubebuilder code +// - zz_generated.kong_ingress_controller_rbac_*.go: contains kubebuilder code // markers for Kong Ingress Controller's ClusterRoles. Those are retrieved from // Kong Ingress Controller's repository for each supported version. -// - zz_generated_controlplane_clusterrole_*.go: contains the generated Go code with +// - zz_generated.controlplane_clusterrole_*.go: contains the generated Go code with // ClusterRoles for each supported version of Kong Ingress Controller. // package clusterroles diff --git a/hack/generators/kic/webhook-config-generator/main.go b/hack/generators/kic/webhook-config-generator/main.go index 8f0c12e6f..9dd96b7be 100644 --- a/hack/generators/kic/webhook-config-generator/main.go +++ b/hack/generators/kic/webhook-config-generator/main.go @@ -21,8 +21,8 @@ import ( const ( validatingWebhookConfigurationPath = "config/webhook/manifests.yaml" validatingWebhookConfigurationKustomizeURL = "https://github.com/kong/kubernetes-ingress-controller/config/webhook" - validatingWebhookConfigurationGeneratorForVersionOutputPath = "pkg/utils/kubernetes/resources/validatingwebhookconfig/zz_generated_kic_%s.go" - validatingWebhookConfigurationGeneratorMasterOutputPath = "pkg/utils/kubernetes/resources/zz_generated_kic_validatingwebhookconfig.go" + validatingWebhookConfigurationGeneratorForVersionOutputPath = "pkg/utils/kubernetes/resources/validatingwebhookconfig/zz_generated.kic_%s.go" + validatingWebhookConfigurationGeneratorMasterOutputPath = "pkg/utils/kubernetes/resources/zz_generated.kic_validatingwebhookconfig.go" ) func main() { diff --git a/hack/generators/testcases-registration/main.go b/hack/generators/testcases-registration/main.go index 167dc8f8e..570d7afaf 100644 --- a/hack/generators/testcases-registration/main.go +++ b/hack/generators/testcases-registration/main.go @@ -15,7 +15,7 @@ import ( const ( integrationTestsPackage = "test/integration" - generatedRegistrationFile = "test/integration/zz_generated_registered_testcases.go" + generatedRegistrationFile = "test/integration/zz_generated.registered_testcases.go" ) func main() { diff --git a/pkg/utils/kubernetes/resources/clusterroles/doc.go b/pkg/utils/kubernetes/resources/clusterroles/doc.go index 6fb3f4e75..6d78e1fff 100644 --- a/pkg/utils/kubernetes/resources/clusterroles/doc.go +++ b/pkg/utils/kubernetes/resources/clusterroles/doc.go @@ -3,10 +3,10 @@ // Controller) ClusterRoles. // // It contains 2 types of files: -// - zz_generated_kong_ingress_controller_rbac_*.go: contains kubebuilder code +// - zz_generated.kong_ingress_controller_rbac_*.go: contains kubebuilder code // markers for Kong Ingress Controller's ClusterRoles. Those are retrieved from // Kong Ingress Controller's repository for each supported version. -// - zz_generated_controlplane_clusterrole_*.go: contains the generated Go code with +// - zz_generated.controlplane_clusterrole_*.go: contains the generated Go code with // ClusterRoles for each supported version of Kong Ingress Controller. // package clusterroles diff --git a/pkg/utils/kubernetes/resources/clusterroles/zz_generated_controlplane_clusterrole_ge3_1_lt3_2.go b/pkg/utils/kubernetes/resources/clusterroles/zz_generated.controlplane_clusterrole_ge3_1_lt3_2.go similarity index 100% rename from pkg/utils/kubernetes/resources/clusterroles/zz_generated_controlplane_clusterrole_ge3_1_lt3_2.go rename to pkg/utils/kubernetes/resources/clusterroles/zz_generated.controlplane_clusterrole_ge3_1_lt3_2.go diff --git a/pkg/utils/kubernetes/resources/clusterroles/zz_generated_controlplane_clusterrole_ge3_2_lt3_3.go b/pkg/utils/kubernetes/resources/clusterroles/zz_generated.controlplane_clusterrole_ge3_2_lt3_3.go similarity index 100% rename from pkg/utils/kubernetes/resources/clusterroles/zz_generated_controlplane_clusterrole_ge3_2_lt3_3.go rename to pkg/utils/kubernetes/resources/clusterroles/zz_generated.controlplane_clusterrole_ge3_2_lt3_3.go diff --git a/pkg/utils/kubernetes/resources/clusterroles/zz_generated_controlplane_clusterrole_ge3_3.go b/pkg/utils/kubernetes/resources/clusterroles/zz_generated.controlplane_clusterrole_ge3_3.go similarity index 100% rename from pkg/utils/kubernetes/resources/clusterroles/zz_generated_controlplane_clusterrole_ge3_3.go rename to pkg/utils/kubernetes/resources/clusterroles/zz_generated.controlplane_clusterrole_ge3_3.go diff --git a/pkg/utils/kubernetes/resources/clusterroles/zz_generated_kong_ingress_controller_rbac_ge3_1_lt3_2.go b/pkg/utils/kubernetes/resources/clusterroles/zz_generated.kong_ingress_controller_rbac_ge3_1_lt3_2.go similarity index 100% rename from pkg/utils/kubernetes/resources/clusterroles/zz_generated_kong_ingress_controller_rbac_ge3_1_lt3_2.go rename to pkg/utils/kubernetes/resources/clusterroles/zz_generated.kong_ingress_controller_rbac_ge3_1_lt3_2.go diff --git a/pkg/utils/kubernetes/resources/clusterroles/zz_generated_kong_ingress_controller_rbac_ge3_2_lt3_3.go b/pkg/utils/kubernetes/resources/clusterroles/zz_generated.kong_ingress_controller_rbac_ge3_2_lt3_3.go similarity index 100% rename from pkg/utils/kubernetes/resources/clusterroles/zz_generated_kong_ingress_controller_rbac_ge3_2_lt3_3.go rename to pkg/utils/kubernetes/resources/clusterroles/zz_generated.kong_ingress_controller_rbac_ge3_2_lt3_3.go diff --git a/pkg/utils/kubernetes/resources/clusterroles/zz_generated_kong_ingress_controller_rbac_ge3_3.go b/pkg/utils/kubernetes/resources/clusterroles/zz_generated.kong_ingress_controller_rbac_ge3_3.go similarity index 100% rename from pkg/utils/kubernetes/resources/clusterroles/zz_generated_kong_ingress_controller_rbac_ge3_3.go rename to pkg/utils/kubernetes/resources/clusterroles/zz_generated.kong_ingress_controller_rbac_ge3_3.go diff --git a/pkg/utils/kubernetes/resources/validatingwebhookconfig/zz_generated_kic_ge3_1_lt3_2.go b/pkg/utils/kubernetes/resources/validatingwebhookconfig/zz_generated.kic_ge3_1_lt3_2.go similarity index 100% rename from pkg/utils/kubernetes/resources/validatingwebhookconfig/zz_generated_kic_ge3_1_lt3_2.go rename to pkg/utils/kubernetes/resources/validatingwebhookconfig/zz_generated.kic_ge3_1_lt3_2.go diff --git a/pkg/utils/kubernetes/resources/validatingwebhookconfig/zz_generated_kic_ge3_2_lt3_3.go b/pkg/utils/kubernetes/resources/validatingwebhookconfig/zz_generated.kic_ge3_2_lt3_3.go similarity index 100% rename from pkg/utils/kubernetes/resources/validatingwebhookconfig/zz_generated_kic_ge3_2_lt3_3.go rename to pkg/utils/kubernetes/resources/validatingwebhookconfig/zz_generated.kic_ge3_2_lt3_3.go diff --git a/pkg/utils/kubernetes/resources/validatingwebhookconfig/zz_generated_kic_ge3_3.go b/pkg/utils/kubernetes/resources/validatingwebhookconfig/zz_generated.kic_ge3_3.go similarity index 100% rename from pkg/utils/kubernetes/resources/validatingwebhookconfig/zz_generated_kic_ge3_3.go rename to pkg/utils/kubernetes/resources/validatingwebhookconfig/zz_generated.kic_ge3_3.go diff --git a/pkg/utils/kubernetes/resources/validatingwebhookconfig/zz_generated_kic_ge3_1.go b/pkg/utils/kubernetes/resources/validatingwebhookconfig/zz_generated_kic_ge3_1.go deleted file mode 100644 index 1149bfac3..000000000 --- a/pkg/utils/kubernetes/resources/validatingwebhookconfig/zz_generated_kic_ge3_1.go +++ /dev/null @@ -1,341 +0,0 @@ -// This file is generated by /hack/generators/kic/webhook-config-generator. DO NOT EDIT. - -package validatingwebhookconfig - -import ( - "github.com/samber/lo" - admregv1 "k8s.io/api/admissionregistration/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// GenerateValidatingWebhookConfigurationForKIC_ge3_1 generates a ValidatingWebhookConfiguration for KIC >=3.1. -func GenerateValidatingWebhookConfigurationForKIC_ge3_1(name string, clientConfig admregv1.WebhookClientConfig) *admregv1.ValidatingWebhookConfiguration { - return &admregv1.ValidatingWebhookConfiguration{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - }, - Webhooks: []admregv1.ValidatingWebhook{ - { - Name: "httproutes.validation.ingress-controller.konghq.com", - ClientConfig: clientConfig, - // We're using 'Ignore' failure policy to avoid issues with modifying resources when webhook-backing - // Deployments (ControlPlane and DataPlane) are not available. - // See https://github.com/Kong/gateway-operator/issues/1564 for more details. - FailurePolicy: lo.ToPtr(admregv1.Ignore), - MatchPolicy: lo.ToPtr(admregv1.MatchPolicyType("Equivalent")), - SideEffects: lo.ToPtr(admregv1.SideEffectClass("None")), - AdmissionReviewVersions: []string{ - "v1", - }, - Rules: []admregv1.RuleWithOperations{ - { - Rule: admregv1.Rule{ - APIGroups: []string{ - "gateway.networking.k8s.io", - }, - APIVersions: []string{ - "v1", - "v1beta1", - }, - Resources: []string{ - "httproutes", - }, - }, - Operations: []admregv1.OperationType{ - "CREATE", - "UPDATE", - }, - }, - }, - }, - { - Name: "ingresses.validation.ingress-controller.konghq.com", - ClientConfig: clientConfig, - // We're using 'Ignore' failure policy to avoid issues with modifying resources when webhook-backing - // Deployments (ControlPlane and DataPlane) are not available. - // See https://github.com/Kong/gateway-operator/issues/1564 for more details. - FailurePolicy: lo.ToPtr(admregv1.Ignore), - MatchPolicy: lo.ToPtr(admregv1.MatchPolicyType("Equivalent")), - SideEffects: lo.ToPtr(admregv1.SideEffectClass("None")), - AdmissionReviewVersions: []string{ - "v1", - }, - Rules: []admregv1.RuleWithOperations{ - { - Rule: admregv1.Rule{ - APIGroups: []string{ - "networking.k8s.io", - }, - APIVersions: []string{ - "v1", - }, - Resources: []string{ - "ingresses", - }, - }, - Operations: []admregv1.OperationType{ - "CREATE", - "UPDATE", - }, - }, - }, - }, - { - Name: "kongclusterplugins.validation.ingress-controller.konghq.com", - ClientConfig: clientConfig, - // We're using 'Ignore' failure policy to avoid issues with modifying resources when webhook-backing - // Deployments (ControlPlane and DataPlane) are not available. - // See https://github.com/Kong/gateway-operator/issues/1564 for more details. - FailurePolicy: lo.ToPtr(admregv1.Ignore), - MatchPolicy: lo.ToPtr(admregv1.MatchPolicyType("Equivalent")), - SideEffects: lo.ToPtr(admregv1.SideEffectClass("None")), - AdmissionReviewVersions: []string{ - "v1", - }, - Rules: []admregv1.RuleWithOperations{ - { - Rule: admregv1.Rule{ - APIGroups: []string{ - "configuration.konghq.com", - }, - APIVersions: []string{ - "v1", - }, - Resources: []string{ - "kongclusterplugins", - }, - }, - Operations: []admregv1.OperationType{ - "CREATE", - "UPDATE", - }, - }, - }, - }, - { - Name: "kongconsumergroups.validation.ingress-controller.konghq.com", - ClientConfig: clientConfig, - // We're using 'Ignore' failure policy to avoid issues with modifying resources when webhook-backing - // Deployments (ControlPlane and DataPlane) are not available. - // See https://github.com/Kong/gateway-operator/issues/1564 for more details. - FailurePolicy: lo.ToPtr(admregv1.Ignore), - MatchPolicy: lo.ToPtr(admregv1.MatchPolicyType("Equivalent")), - SideEffects: lo.ToPtr(admregv1.SideEffectClass("None")), - AdmissionReviewVersions: []string{ - "v1", - }, - Rules: []admregv1.RuleWithOperations{ - { - Rule: admregv1.Rule{ - APIGroups: []string{ - "configuration.konghq.com", - }, - APIVersions: []string{ - "v1beta1", - }, - Resources: []string{ - "kongconsumergroups", - }, - }, - Operations: []admregv1.OperationType{ - "CREATE", - "UPDATE", - }, - }, - }, - }, - { - Name: "kongconsumers.validation.ingress-controller.konghq.com", - ClientConfig: clientConfig, - // We're using 'Ignore' failure policy to avoid issues with modifying resources when webhook-backing - // Deployments (ControlPlane and DataPlane) are not available. - // See https://github.com/Kong/gateway-operator/issues/1564 for more details. - FailurePolicy: lo.ToPtr(admregv1.Ignore), - MatchPolicy: lo.ToPtr(admregv1.MatchPolicyType("Equivalent")), - SideEffects: lo.ToPtr(admregv1.SideEffectClass("None")), - AdmissionReviewVersions: []string{ - "v1", - }, - Rules: []admregv1.RuleWithOperations{ - { - Rule: admregv1.Rule{ - APIGroups: []string{ - "configuration.konghq.com", - }, - APIVersions: []string{ - "v1", - }, - Resources: []string{ - "kongconsumers", - }, - }, - Operations: []admregv1.OperationType{ - "CREATE", - "UPDATE", - }, - }, - }, - }, - { - Name: "kongingresses.validation.ingress-controller.konghq.com", - ClientConfig: clientConfig, - // We're using 'Ignore' failure policy to avoid issues with modifying resources when webhook-backing - // Deployments (ControlPlane and DataPlane) are not available. - // See https://github.com/Kong/gateway-operator/issues/1564 for more details. - FailurePolicy: lo.ToPtr(admregv1.Ignore), - MatchPolicy: lo.ToPtr(admregv1.MatchPolicyType("Equivalent")), - SideEffects: lo.ToPtr(admregv1.SideEffectClass("None")), - AdmissionReviewVersions: []string{ - "v1", - }, - Rules: []admregv1.RuleWithOperations{ - { - Rule: admregv1.Rule{ - APIGroups: []string{ - "configuration.konghq.com", - }, - APIVersions: []string{ - "v1", - }, - Resources: []string{ - "kongingresses", - }, - }, - Operations: []admregv1.OperationType{ - "CREATE", - "UPDATE", - }, - }, - }, - }, - { - Name: "kongplugins.validation.ingress-controller.konghq.com", - ClientConfig: clientConfig, - // We're using 'Ignore' failure policy to avoid issues with modifying resources when webhook-backing - // Deployments (ControlPlane and DataPlane) are not available. - // See https://github.com/Kong/gateway-operator/issues/1564 for more details. - FailurePolicy: lo.ToPtr(admregv1.Ignore), - MatchPolicy: lo.ToPtr(admregv1.MatchPolicyType("Equivalent")), - SideEffects: lo.ToPtr(admregv1.SideEffectClass("None")), - AdmissionReviewVersions: []string{ - "v1", - }, - Rules: []admregv1.RuleWithOperations{ - { - Rule: admregv1.Rule{ - APIGroups: []string{ - "configuration.konghq.com", - }, - APIVersions: []string{ - "v1", - }, - Resources: []string{ - "kongplugins", - }, - }, - Operations: []admregv1.OperationType{ - "CREATE", - "UPDATE", - }, - }, - }, - }, - { - Name: "kongvaults.validation.ingress-controller.konghq.com", - ClientConfig: clientConfig, - // We're using 'Ignore' failure policy to avoid issues with modifying resources when webhook-backing - // Deployments (ControlPlane and DataPlane) are not available. - // See https://github.com/Kong/gateway-operator/issues/1564 for more details. - FailurePolicy: lo.ToPtr(admregv1.Ignore), - MatchPolicy: lo.ToPtr(admregv1.MatchPolicyType("Equivalent")), - SideEffects: lo.ToPtr(admregv1.SideEffectClass("None")), - AdmissionReviewVersions: []string{ - "v1", - }, - Rules: []admregv1.RuleWithOperations{ - { - Rule: admregv1.Rule{ - APIGroups: []string{ - "configuration.konghq.com", - }, - APIVersions: []string{ - "v1alpha1", - }, - Resources: []string{ - "kongvaults", - }, - }, - Operations: []admregv1.OperationType{ - "CREATE", - "UPDATE", - }, - }, - }, - }, - { - Name: "secrets.validation.ingress-controller.konghq.com", - ClientConfig: clientConfig, - // We're using 'Ignore' failure policy to avoid issues with modifying resources when webhook-backing - // Deployments (ControlPlane and DataPlane) are not available. - // See https://github.com/Kong/gateway-operator/issues/1564 for more details. - FailurePolicy: lo.ToPtr(admregv1.Ignore), - MatchPolicy: lo.ToPtr(admregv1.MatchPolicyType("Equivalent")), - SideEffects: lo.ToPtr(admregv1.SideEffectClass("None")), - AdmissionReviewVersions: []string{ - "v1", - }, - Rules: []admregv1.RuleWithOperations{ - { - Rule: admregv1.Rule{ - APIGroups: []string{ - "", - }, - APIVersions: []string{ - "v1", - }, - Resources: []string{ - "secrets", - }, - }, - Operations: []admregv1.OperationType{ - "CREATE", - "UPDATE", - }, - }, - }, - }, - { - Name: "services.validation.ingress-controller.konghq.com", - ClientConfig: clientConfig, - // We're using 'Ignore' failure policy to avoid issues with modifying resources when webhook-backing - // Deployments (ControlPlane and DataPlane) are not available. - // See https://github.com/Kong/gateway-operator/issues/1564 for more details. - FailurePolicy: lo.ToPtr(admregv1.Ignore), - MatchPolicy: lo.ToPtr(admregv1.MatchPolicyType("Equivalent")), - SideEffects: lo.ToPtr(admregv1.SideEffectClass("None")), - AdmissionReviewVersions: []string{ - "v1", - }, - Rules: []admregv1.RuleWithOperations{ - { - Rule: admregv1.Rule{ - APIGroups: []string{ - "", - }, - APIVersions: []string{ - "v1", - }, - Resources: []string{ - "services", - }, - }, - Operations: []admregv1.OperationType{ - "CREATE", - "UPDATE", - }, - }, - }, - }, - }, - } -} diff --git a/pkg/utils/kubernetes/resources/validatingwebhookconfig/zz_generated_kic_ge3_2.go b/pkg/utils/kubernetes/resources/validatingwebhookconfig/zz_generated_kic_ge3_2.go deleted file mode 100644 index f588a0567..000000000 --- a/pkg/utils/kubernetes/resources/validatingwebhookconfig/zz_generated_kic_ge3_2.go +++ /dev/null @@ -1,405 +0,0 @@ -// This file is generated by /hack/generators/kic/webhook-config-generator. DO NOT EDIT. - -package validatingwebhookconfig - -import ( - "github.com/samber/lo" - admregv1 "k8s.io/api/admissionregistration/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// GenerateValidatingWebhookConfigurationForKIC_ge3_2 generates a ValidatingWebhookConfiguration for KIC >=3.2. -func GenerateValidatingWebhookConfigurationForKIC_ge3_2(name string, clientConfig admregv1.WebhookClientConfig) *admregv1.ValidatingWebhookConfiguration { - return &admregv1.ValidatingWebhookConfiguration{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - }, - Webhooks: []admregv1.ValidatingWebhook{ - { - Name: "secrets.credentials.validation.ingress-controller.konghq.com", - ClientConfig: clientConfig, - // We're using 'Ignore' failure policy to avoid issues with modifying resources when webhook-backing - // Deployments (ControlPlane and DataPlane) are not available. - // See https://github.com/Kong/gateway-operator/issues/1564 for more details. - FailurePolicy: lo.ToPtr(admregv1.Ignore), - MatchPolicy: lo.ToPtr(admregv1.MatchPolicyType("Equivalent")), - SideEffects: lo.ToPtr(admregv1.SideEffectClass("None")), - AdmissionReviewVersions: []string{ - "v1", - }, - Rules: []admregv1.RuleWithOperations{ - { - Rule: admregv1.Rule{ - APIGroups: []string{ - "", - }, - APIVersions: []string{ - "v1", - }, - Resources: []string{ - "secrets", - }, - }, - Operations: []admregv1.OperationType{ - "CREATE", - "UPDATE", - }, - }, - }, - }, - { - Name: "secrets.plugins.validation.ingress-controller.konghq.com", - ClientConfig: clientConfig, - // We're using 'Ignore' failure policy to avoid issues with modifying resources when webhook-backing - // Deployments (ControlPlane and DataPlane) are not available. - // See https://github.com/Kong/gateway-operator/issues/1564 for more details. - FailurePolicy: lo.ToPtr(admregv1.Ignore), - MatchPolicy: lo.ToPtr(admregv1.MatchPolicyType("Equivalent")), - SideEffects: lo.ToPtr(admregv1.SideEffectClass("None")), - AdmissionReviewVersions: []string{ - "v1", - }, - Rules: []admregv1.RuleWithOperations{ - { - Rule: admregv1.Rule{ - APIGroups: []string{ - "", - }, - APIVersions: []string{ - "v1", - }, - Resources: []string{ - "secrets", - }, - }, - Operations: []admregv1.OperationType{ - "CREATE", - "UPDATE", - }, - }, - }, - }, - { - Name: "httproutes.validation.ingress-controller.konghq.com", - ClientConfig: clientConfig, - // We're using 'Ignore' failure policy to avoid issues with modifying resources when webhook-backing - // Deployments (ControlPlane and DataPlane) are not available. - // See https://github.com/Kong/gateway-operator/issues/1564 for more details. - FailurePolicy: lo.ToPtr(admregv1.Ignore), - MatchPolicy: lo.ToPtr(admregv1.MatchPolicyType("Equivalent")), - SideEffects: lo.ToPtr(admregv1.SideEffectClass("None")), - AdmissionReviewVersions: []string{ - "v1", - }, - Rules: []admregv1.RuleWithOperations{ - { - Rule: admregv1.Rule{ - APIGroups: []string{ - "gateway.networking.k8s.io", - }, - APIVersions: []string{ - "v1", - "v1beta1", - }, - Resources: []string{ - "httproutes", - }, - }, - Operations: []admregv1.OperationType{ - "CREATE", - "UPDATE", - }, - }, - }, - }, - { - Name: "ingresses.validation.ingress-controller.konghq.com", - ClientConfig: clientConfig, - // We're using 'Ignore' failure policy to avoid issues with modifying resources when webhook-backing - // Deployments (ControlPlane and DataPlane) are not available. - // See https://github.com/Kong/gateway-operator/issues/1564 for more details. - FailurePolicy: lo.ToPtr(admregv1.Ignore), - MatchPolicy: lo.ToPtr(admregv1.MatchPolicyType("Equivalent")), - SideEffects: lo.ToPtr(admregv1.SideEffectClass("None")), - AdmissionReviewVersions: []string{ - "v1", - }, - Rules: []admregv1.RuleWithOperations{ - { - Rule: admregv1.Rule{ - APIGroups: []string{ - "networking.k8s.io", - }, - APIVersions: []string{ - "v1", - }, - Resources: []string{ - "ingresses", - }, - }, - Operations: []admregv1.OperationType{ - "CREATE", - "UPDATE", - }, - }, - }, - }, - { - Name: "kongclusterplugins.validation.ingress-controller.konghq.com", - ClientConfig: clientConfig, - // We're using 'Ignore' failure policy to avoid issues with modifying resources when webhook-backing - // Deployments (ControlPlane and DataPlane) are not available. - // See https://github.com/Kong/gateway-operator/issues/1564 for more details. - FailurePolicy: lo.ToPtr(admregv1.Ignore), - MatchPolicy: lo.ToPtr(admregv1.MatchPolicyType("Equivalent")), - SideEffects: lo.ToPtr(admregv1.SideEffectClass("None")), - AdmissionReviewVersions: []string{ - "v1", - }, - Rules: []admregv1.RuleWithOperations{ - { - Rule: admregv1.Rule{ - APIGroups: []string{ - "configuration.konghq.com", - }, - APIVersions: []string{ - "v1", - }, - Resources: []string{ - "kongclusterplugins", - }, - }, - Operations: []admregv1.OperationType{ - "CREATE", - "UPDATE", - }, - }, - }, - }, - { - Name: "kongconsumergroups.validation.ingress-controller.konghq.com", - ClientConfig: clientConfig, - // We're using 'Ignore' failure policy to avoid issues with modifying resources when webhook-backing - // Deployments (ControlPlane and DataPlane) are not available. - // See https://github.com/Kong/gateway-operator/issues/1564 for more details. - FailurePolicy: lo.ToPtr(admregv1.Ignore), - MatchPolicy: lo.ToPtr(admregv1.MatchPolicyType("Equivalent")), - SideEffects: lo.ToPtr(admregv1.SideEffectClass("None")), - AdmissionReviewVersions: []string{ - "v1", - }, - Rules: []admregv1.RuleWithOperations{ - { - Rule: admregv1.Rule{ - APIGroups: []string{ - "configuration.konghq.com", - }, - APIVersions: []string{ - "v1beta1", - }, - Resources: []string{ - "kongconsumergroups", - }, - }, - Operations: []admregv1.OperationType{ - "CREATE", - "UPDATE", - }, - }, - }, - }, - { - Name: "kongconsumers.validation.ingress-controller.konghq.com", - ClientConfig: clientConfig, - // We're using 'Ignore' failure policy to avoid issues with modifying resources when webhook-backing - // Deployments (ControlPlane and DataPlane) are not available. - // See https://github.com/Kong/gateway-operator/issues/1564 for more details. - FailurePolicy: lo.ToPtr(admregv1.Ignore), - MatchPolicy: lo.ToPtr(admregv1.MatchPolicyType("Equivalent")), - SideEffects: lo.ToPtr(admregv1.SideEffectClass("None")), - AdmissionReviewVersions: []string{ - "v1", - }, - Rules: []admregv1.RuleWithOperations{ - { - Rule: admregv1.Rule{ - APIGroups: []string{ - "configuration.konghq.com", - }, - APIVersions: []string{ - "v1", - }, - Resources: []string{ - "kongconsumers", - }, - }, - Operations: []admregv1.OperationType{ - "CREATE", - "UPDATE", - }, - }, - }, - }, - { - Name: "kongcustomentities.validation.ingress-controller.konghq.com", - ClientConfig: clientConfig, - // We're using 'Ignore' failure policy to avoid issues with modifying resources when webhook-backing - // Deployments (ControlPlane and DataPlane) are not available. - // See https://github.com/Kong/gateway-operator/issues/1564 for more details. - FailurePolicy: lo.ToPtr(admregv1.Ignore), - MatchPolicy: lo.ToPtr(admregv1.MatchPolicyType("Equivalent")), - SideEffects: lo.ToPtr(admregv1.SideEffectClass("None")), - AdmissionReviewVersions: []string{ - "v1", - }, - Rules: []admregv1.RuleWithOperations{ - { - Rule: admregv1.Rule{ - APIGroups: []string{ - "configuration.konghq.com", - }, - APIVersions: []string{ - "v1alpha1", - }, - Resources: []string{ - "kongcustomentities", - }, - }, - Operations: []admregv1.OperationType{ - "CREATE", - "UPDATE", - }, - }, - }, - }, - { - Name: "kongingresses.validation.ingress-controller.konghq.com", - ClientConfig: clientConfig, - // We're using 'Ignore' failure policy to avoid issues with modifying resources when webhook-backing - // Deployments (ControlPlane and DataPlane) are not available. - // See https://github.com/Kong/gateway-operator/issues/1564 for more details. - FailurePolicy: lo.ToPtr(admregv1.Ignore), - MatchPolicy: lo.ToPtr(admregv1.MatchPolicyType("Equivalent")), - SideEffects: lo.ToPtr(admregv1.SideEffectClass("None")), - AdmissionReviewVersions: []string{ - "v1", - }, - Rules: []admregv1.RuleWithOperations{ - { - Rule: admregv1.Rule{ - APIGroups: []string{ - "configuration.konghq.com", - }, - APIVersions: []string{ - "v1", - }, - Resources: []string{ - "kongingresses", - }, - }, - Operations: []admregv1.OperationType{ - "CREATE", - "UPDATE", - }, - }, - }, - }, - { - Name: "kongplugins.validation.ingress-controller.konghq.com", - ClientConfig: clientConfig, - // We're using 'Ignore' failure policy to avoid issues with modifying resources when webhook-backing - // Deployments (ControlPlane and DataPlane) are not available. - // See https://github.com/Kong/gateway-operator/issues/1564 for more details. - FailurePolicy: lo.ToPtr(admregv1.Ignore), - MatchPolicy: lo.ToPtr(admregv1.MatchPolicyType("Equivalent")), - SideEffects: lo.ToPtr(admregv1.SideEffectClass("None")), - AdmissionReviewVersions: []string{ - "v1", - }, - Rules: []admregv1.RuleWithOperations{ - { - Rule: admregv1.Rule{ - APIGroups: []string{ - "configuration.konghq.com", - }, - APIVersions: []string{ - "v1", - }, - Resources: []string{ - "kongplugins", - }, - }, - Operations: []admregv1.OperationType{ - "CREATE", - "UPDATE", - }, - }, - }, - }, - { - Name: "kongvaults.validation.ingress-controller.konghq.com", - ClientConfig: clientConfig, - // We're using 'Ignore' failure policy to avoid issues with modifying resources when webhook-backing - // Deployments (ControlPlane and DataPlane) are not available. - // See https://github.com/Kong/gateway-operator/issues/1564 for more details. - FailurePolicy: lo.ToPtr(admregv1.Ignore), - MatchPolicy: lo.ToPtr(admregv1.MatchPolicyType("Equivalent")), - SideEffects: lo.ToPtr(admregv1.SideEffectClass("None")), - AdmissionReviewVersions: []string{ - "v1", - }, - Rules: []admregv1.RuleWithOperations{ - { - Rule: admregv1.Rule{ - APIGroups: []string{ - "configuration.konghq.com", - }, - APIVersions: []string{ - "v1alpha1", - }, - Resources: []string{ - "kongvaults", - }, - }, - Operations: []admregv1.OperationType{ - "CREATE", - "UPDATE", - }, - }, - }, - }, - { - Name: "services.validation.ingress-controller.konghq.com", - ClientConfig: clientConfig, - // We're using 'Ignore' failure policy to avoid issues with modifying resources when webhook-backing - // Deployments (ControlPlane and DataPlane) are not available. - // See https://github.com/Kong/gateway-operator/issues/1564 for more details. - FailurePolicy: lo.ToPtr(admregv1.Ignore), - MatchPolicy: lo.ToPtr(admregv1.MatchPolicyType("Equivalent")), - SideEffects: lo.ToPtr(admregv1.SideEffectClass("None")), - AdmissionReviewVersions: []string{ - "v1", - }, - Rules: []admregv1.RuleWithOperations{ - { - Rule: admregv1.Rule{ - APIGroups: []string{ - "", - }, - APIVersions: []string{ - "v1", - }, - Resources: []string{ - "services", - }, - }, - Operations: []admregv1.OperationType{ - "CREATE", - "UPDATE", - }, - }, - }, - }, - }, - } -} diff --git a/pkg/utils/kubernetes/resources/zz_generated_clusterrole_helpers.go b/pkg/utils/kubernetes/resources/zz_generated.clusterrole_helpers.go similarity index 100% rename from pkg/utils/kubernetes/resources/zz_generated_clusterrole_helpers.go rename to pkg/utils/kubernetes/resources/zz_generated.clusterrole_helpers.go diff --git a/pkg/utils/kubernetes/resources/zz_generated_kic_validatingwebhookconfig.go b/pkg/utils/kubernetes/resources/zz_generated.kic_validatingwebhookconfig.go similarity index 100% rename from pkg/utils/kubernetes/resources/zz_generated_kic_validatingwebhookconfig.go rename to pkg/utils/kubernetes/resources/zz_generated.kic_validatingwebhookconfig.go diff --git a/pkg/utils/test/zz_generated_gateway_api.go b/pkg/utils/test/zz_generated.gateway_api.go similarity index 100% rename from pkg/utils/test/zz_generated_gateway_api.go rename to pkg/utils/test/zz_generated.gateway_api.go diff --git a/test/integration/zz_generated_registered_testcases.go b/test/integration/zz_generated.registered_testcases.go similarity index 100% rename from test/integration/zz_generated_registered_testcases.go rename to test/integration/zz_generated.registered_testcases.go