From 22e6f2c0cc9524fd3056b4b1852d9a91cd08b860 Mon Sep 17 00:00:00 2001 From: "Ariana W." Date: Mon, 18 Nov 2024 15:29:02 -0500 Subject: [PATCH] Add categories to GG CRDs (#5006) Co-authored-by: soloio-bulldozer[bot] <48420018+soloio-bulldozer[bot]@users.noreply.github.com> Co-authored-by: Jenny Shu <28537278+jenshu@users.noreply.github.com> --- .github/workflows/pr-kubernetes-tests.yaml | 16 +++--- .../v1.18.0-beta35/GG-CRD-categories.yaml | 5 ++ devel/testing/kube-e2e-tests.md | 4 +- install/helm/gloo/.helmignore | 3 ++ install/helm/gloo/crds/README.md | 10 ++++ ...enterprise.gloo.solo.io_v1_AuthConfig.yaml | 3 ++ .../gloo/crds/gateway.solo.io_v1_Gateway.yaml | 2 + ...gateway.solo.io_v1_HttpListenerOption.yaml | 2 + .../gateway.solo.io_v1_ListenerOption.yaml | 2 + ...teway.solo.io_v1_MatchableHttpGateway.yaml | 2 + ...ateway.solo.io_v1_MatchableTcpGateway.yaml | 2 + .../crds/gateway.solo.io_v1_RouteOption.yaml | 2 + .../crds/gateway.solo.io_v1_RouteTable.yaml | 2 + .../gateway.solo.io_v1_VirtualHostOption.yaml | 2 + .../gateway.solo.io_v1_VirtualService.yaml | 2 + .../helm/gloo/crds/gloo.solo.io_v1_Proxy.yaml | 2 + .../gloo/crds/gloo.solo.io_v1_Settings.yaml | 2 + .../gloo/crds/gloo.solo.io_v1_Upstream.yaml | 2 + .../crds/gloo.solo.io_v1_UpstreamGroup.yaml | 2 + ...aphql.gloo.solo.io_v1beta1_GraphQLApi.yaml | 3 ++ install/helm/gloo/crds/ratelimit_config.yaml | 3 ++ test/kube2e/README.md | 3 ++ .../e2e/features/crd_categories/suite.go | 54 +++++++++++++++++++ .../manifests/empty-virtualservice.yaml | 5 ++ .../e2e/features/crd_categories/types.go | 13 +++++ test/kubernetes/e2e/features/helm/suite.go | 26 +++++++-- test/kubernetes/e2e/features/helm/types.go | 9 ++++ test/kubernetes/e2e/tests/k8s_gw_tests.go | 2 + 28 files changed, 171 insertions(+), 14 deletions(-) create mode 100644 changelog/v1.18.0-beta35/GG-CRD-categories.yaml create mode 100644 install/helm/gloo/crds/README.md create mode 100644 test/kubernetes/e2e/features/crd_categories/suite.go create mode 100644 test/kubernetes/e2e/features/crd_categories/testdata/manifests/empty-virtualservice.yaml create mode 100644 test/kubernetes/e2e/features/crd_categories/types.go diff --git a/.github/workflows/pr-kubernetes-tests.yaml b/.github/workflows/pr-kubernetes-tests.yaml index d4af78516fd..426de0971ab 100644 --- a/.github/workflows/pr-kubernetes-tests.yaml +++ b/.github/workflows/pr-kubernetes-tests.yaml @@ -55,36 +55,36 @@ jobs: # NOTE: We use the GitHub action step time (as opposed to the `go test` time), because it is easier to capture test: - # Oct 3, 2024: 24 minutes + # Nov 14, 2024: 22 minutes - cluster-name: 'cluster-one' go-test-args: '-v -timeout=25m' - go-test-run-regex: '^TestK8sGateway$$/^RouteDelegation$$|^TestK8sGateway$$/^Services$$|^TestGlooctlGlooGatewayEdgeGateway$$|^TestGlooctlK8sGateway$$' + go-test-run-regex: '^TestK8sGateway$$/^RouteDelegation$$|^TestGlooctlGlooGatewayEdgeGateway$$|^TestGlooctlK8sGateway$$' - # Oct 10, 2024: 24 minutes + # Nov 14, 2024: 22 minutes - cluster-name: 'cluster-two' go-test-args: '-v -timeout=25m' go-test-run-regex: '^TestK8sGatewayIstioRevision$$|^TestRevisionIstioRegression$$|^TestK8sGateway$$/^Deployer$$|^TestK8sGateway$$/^RouteOptions$$|^TestK8sGateway$$/^VirtualHostOptions$$|^TestK8sGateway$$/^Upstreams$$|^TestK8sGateway$$/^HeadlessSvc$$|^TestK8sGateway$$/^PortRouting$$|^TestK8sGatewayMinimalDefaultGatewayParameters$$|^TestK8sGateway$$/^DirectResponse$$|^TestK8sGateway$$/^HttpListenerOptions$$|^TestK8sGateway$$/^ListenerOptions$$|^TestK8sGateway$$/^GlooAdminServer$$' - # Oct 3, 2024: 25 minutes + # Nov 14, 2024: 23 minutes - cluster-name: 'cluster-three' go-test-args: '-v -timeout=30m' go-test-run-regex: '(^TestK8sGatewayIstioAutoMtls$$|^TestAutomtlsIstioEdgeApisGateway$$|^TestIstioEdgeApiGateway$$|^TestIstioRegression$$)' - # Oct 10, 2024: 20 minutes + # Nov 14, 2024: 21 minutes - cluster-name: 'cluster-four' go-test-args: '-v -timeout=30m' go-test-run-regex: '(^TestK8sGatewayIstio$$|^TestGlooGatewayEdgeGateway$$|^TestGlooctlIstioInjectEdgeApiGateway$$)' - # October 10, 2024: 22 minutes + # Nov 14, 2024: 30 minutes # TODO (sheidkamp) rebalance tests - cluster-name: 'cluster-five' go-test-args: '-v -timeout=35m' go-test-run-regex: '^TestFullEnvoyValidation$$|^TestValidationStrict$$|^TestValidationAlwaysAccept$$|^TestTransformationValidationDisabled$$|^TestGloomtlsGatewayEdgeGateway$$|^TestWatchNamespaceSelector$$' - # October 10, 2024: 12 minutes + # Nov 14, 2024: 23 minutes - cluster-name: 'cluster-six' go-test-args: '-v -timeout=25m' - go-test-run-regex: '^TestDiscoveryWatchlabels$$|^TestK8sGatewayNoValidation$$|^TestHelm$$|^TestHelmSettings$$|^TestK8sGatewayAws$$' + go-test-run-regex: '^TestDiscoveryWatchlabels$$|^TestK8sGatewayNoValidation$$|^TestHelm$$|^TestHelmSettings$$|^TestK8sGatewayAws$$|^TestK8sGateway$$/^CRDCategories$$|^TestK8sGateway$$/^HTTPRouteServices$$|^TestK8sGateway$$/^TCPRouteServices$$' # In our PR tests, we run the suite of tests using the upper ends of versions that we claim to support # The versions should mirror: https://docs.solo.io/gloo-edge/latest/reference/support/ diff --git a/changelog/v1.18.0-beta35/GG-CRD-categories.yaml b/changelog/v1.18.0-beta35/GG-CRD-categories.yaml new file mode 100644 index 00000000000..f547031d95b --- /dev/null +++ b/changelog/v1.18.0-beta35/GG-CRD-categories.yaml @@ -0,0 +1,5 @@ +changelog: +- type: NEW_FEATURE + description: Adds a common category to all Gloo Gateway CRDs. `kubectl get gloo-gateway -A` can now be used to list all GG CRs on your cluster. Also adds the "solo-io" category to GG enterprise CRDs. + issueLink: https://github.com/solo-io/solo-projects/issues/6605 + resolvesIssue: false diff --git a/devel/testing/kube-e2e-tests.md b/devel/testing/kube-e2e-tests.md index 2fb06762e70..664f4b972de 100644 --- a/devel/testing/kube-e2e-tests.md +++ b/devel/testing/kube-e2e-tests.md @@ -22,4 +22,6 @@ These tests are run by a [GitHub action](/.github/workflows/regression-tests.yam If a test fails, you can retry it from a [browser window](https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs#reviewing-previous-workflow-runs). If you do this, please make sure to comment on the Pull Request with a link to the failed logs for debugging purposes. ## Local Development -See the [kube2e test README](/test/kube2e/README.md) for more details about running these tests. \ No newline at end of file +See the [kubernetes e2e test README](/test/kubernetes/e2e/README.md) and [debugging guide](/test/kubernetes/e2e/debugging.md) for more details about running these tests. + +See the [kube2e test README](/test/kube2e/README.md) for more details about running the legacy tests. \ No newline at end of file diff --git a/install/helm/gloo/.helmignore b/install/helm/gloo/.helmignore index ede6884aa6b..507179caa13 100644 --- a/install/helm/gloo/.helmignore +++ b/install/helm/gloo/.helmignore @@ -28,3 +28,6 @@ # generator files *.go generate/ + +# READMEs +README.md diff --git a/install/helm/gloo/crds/README.md b/install/helm/gloo/crds/README.md new file mode 100644 index 00000000000..5ebe5bba873 --- /dev/null +++ b/install/helm/gloo/crds/README.md @@ -0,0 +1,10 @@ +The CRDs in this directory are partially generated by solo-kit. +That implementation is explained [here](https://github.com/solo-io/solo-kit/tree/main/pkg/code-generator/schemagen#implementation). + +It is worth noting that solo-kit only generates the schemas for these CRDs. +Other spec fields such as the `categories` can be updated manually. + +Gloo Gateway CRD `categories`: +- All Gloo Gateway CRDs should include the "gloo-gateway" category. +- Any Gloo Gateway CRDs which are only used by enterprise customers should additionally include the "solo-io" category. + - Currently, these are the AuthConfig, RateLimitConfig, and GraphQLApi CRDs. \ No newline at end of file diff --git a/install/helm/gloo/crds/enterprise.gloo.solo.io_v1_AuthConfig.yaml b/install/helm/gloo/crds/enterprise.gloo.solo.io_v1_AuthConfig.yaml index a5a38cd4ff1..0a3fdbbaa1e 100644 --- a/install/helm/gloo/crds/enterprise.gloo.solo.io_v1_AuthConfig.yaml +++ b/install/helm/gloo/crds/enterprise.gloo.solo.io_v1_AuthConfig.yaml @@ -8,6 +8,9 @@ metadata: spec: group: enterprise.gloo.solo.io names: + categories: + - solo-io + - gloo-gateway kind: AuthConfig listKind: AuthConfigList plural: authconfigs diff --git a/install/helm/gloo/crds/gateway.solo.io_v1_Gateway.yaml b/install/helm/gloo/crds/gateway.solo.io_v1_Gateway.yaml index 9f3f3e2bb58..41ae44ae5e9 100644 --- a/install/helm/gloo/crds/gateway.solo.io_v1_Gateway.yaml +++ b/install/helm/gloo/crds/gateway.solo.io_v1_Gateway.yaml @@ -8,6 +8,8 @@ metadata: spec: group: gateway.solo.io names: + categories: + - gloo-gateway kind: Gateway listKind: GatewayList plural: gateways diff --git a/install/helm/gloo/crds/gateway.solo.io_v1_HttpListenerOption.yaml b/install/helm/gloo/crds/gateway.solo.io_v1_HttpListenerOption.yaml index 94a58b8a3f4..bc38900b4fc 100644 --- a/install/helm/gloo/crds/gateway.solo.io_v1_HttpListenerOption.yaml +++ b/install/helm/gloo/crds/gateway.solo.io_v1_HttpListenerOption.yaml @@ -8,6 +8,8 @@ metadata: spec: group: gateway.solo.io names: + categories: + - gloo-gateway kind: HttpListenerOption listKind: HttpListenerOptionList plural: httplisteneroptions diff --git a/install/helm/gloo/crds/gateway.solo.io_v1_ListenerOption.yaml b/install/helm/gloo/crds/gateway.solo.io_v1_ListenerOption.yaml index de76dba968f..8f71493fed6 100644 --- a/install/helm/gloo/crds/gateway.solo.io_v1_ListenerOption.yaml +++ b/install/helm/gloo/crds/gateway.solo.io_v1_ListenerOption.yaml @@ -8,6 +8,8 @@ metadata: spec: group: gateway.solo.io names: + categories: + - gloo-gateway kind: ListenerOption listKind: ListenerOptionList plural: listeneroptions diff --git a/install/helm/gloo/crds/gateway.solo.io_v1_MatchableHttpGateway.yaml b/install/helm/gloo/crds/gateway.solo.io_v1_MatchableHttpGateway.yaml index 20576aaa914..338657c0c6a 100644 --- a/install/helm/gloo/crds/gateway.solo.io_v1_MatchableHttpGateway.yaml +++ b/install/helm/gloo/crds/gateway.solo.io_v1_MatchableHttpGateway.yaml @@ -8,6 +8,8 @@ metadata: spec: group: gateway.solo.io names: + categories: + - gloo-gateway kind: MatchableHttpGateway listKind: MatchableHttpGatewayList plural: httpgateways diff --git a/install/helm/gloo/crds/gateway.solo.io_v1_MatchableTcpGateway.yaml b/install/helm/gloo/crds/gateway.solo.io_v1_MatchableTcpGateway.yaml index ae8ac9802c6..af4823d93b7 100644 --- a/install/helm/gloo/crds/gateway.solo.io_v1_MatchableTcpGateway.yaml +++ b/install/helm/gloo/crds/gateway.solo.io_v1_MatchableTcpGateway.yaml @@ -8,6 +8,8 @@ metadata: spec: group: gateway.solo.io names: + categories: + - gloo-gateway kind: MatchableTcpGateway listKind: MatchableTcpGatewayList plural: tcpgateways diff --git a/install/helm/gloo/crds/gateway.solo.io_v1_RouteOption.yaml b/install/helm/gloo/crds/gateway.solo.io_v1_RouteOption.yaml index 8060d0e569a..7645709d237 100644 --- a/install/helm/gloo/crds/gateway.solo.io_v1_RouteOption.yaml +++ b/install/helm/gloo/crds/gateway.solo.io_v1_RouteOption.yaml @@ -8,6 +8,8 @@ metadata: spec: group: gateway.solo.io names: + categories: + - gloo-gateway kind: RouteOption listKind: RouteOptionList plural: routeoptions diff --git a/install/helm/gloo/crds/gateway.solo.io_v1_RouteTable.yaml b/install/helm/gloo/crds/gateway.solo.io_v1_RouteTable.yaml index d3e5d780ba5..64a37f07931 100644 --- a/install/helm/gloo/crds/gateway.solo.io_v1_RouteTable.yaml +++ b/install/helm/gloo/crds/gateway.solo.io_v1_RouteTable.yaml @@ -8,6 +8,8 @@ metadata: spec: group: gateway.solo.io names: + categories: + - gloo-gateway kind: RouteTable listKind: RouteTableList plural: routetables diff --git a/install/helm/gloo/crds/gateway.solo.io_v1_VirtualHostOption.yaml b/install/helm/gloo/crds/gateway.solo.io_v1_VirtualHostOption.yaml index 4d1664e9e8f..13c5614f8d9 100644 --- a/install/helm/gloo/crds/gateway.solo.io_v1_VirtualHostOption.yaml +++ b/install/helm/gloo/crds/gateway.solo.io_v1_VirtualHostOption.yaml @@ -8,6 +8,8 @@ metadata: spec: group: gateway.solo.io names: + categories: + - gloo-gateway kind: VirtualHostOption listKind: VirtualHostOptionList plural: virtualhostoptions diff --git a/install/helm/gloo/crds/gateway.solo.io_v1_VirtualService.yaml b/install/helm/gloo/crds/gateway.solo.io_v1_VirtualService.yaml index cb70926c694..7f38a5947ab 100644 --- a/install/helm/gloo/crds/gateway.solo.io_v1_VirtualService.yaml +++ b/install/helm/gloo/crds/gateway.solo.io_v1_VirtualService.yaml @@ -8,6 +8,8 @@ metadata: spec: group: gateway.solo.io names: + categories: + - gloo-gateway kind: VirtualService listKind: VirtualServiceList plural: virtualservices diff --git a/install/helm/gloo/crds/gloo.solo.io_v1_Proxy.yaml b/install/helm/gloo/crds/gloo.solo.io_v1_Proxy.yaml index 9b1eb71c173..0929d10c18c 100644 --- a/install/helm/gloo/crds/gloo.solo.io_v1_Proxy.yaml +++ b/install/helm/gloo/crds/gloo.solo.io_v1_Proxy.yaml @@ -8,6 +8,8 @@ metadata: spec: group: gloo.solo.io names: + categories: + - gloo-gateway kind: Proxy listKind: ProxyList plural: proxies diff --git a/install/helm/gloo/crds/gloo.solo.io_v1_Settings.yaml b/install/helm/gloo/crds/gloo.solo.io_v1_Settings.yaml index 41c74261a02..5912403a6d3 100644 --- a/install/helm/gloo/crds/gloo.solo.io_v1_Settings.yaml +++ b/install/helm/gloo/crds/gloo.solo.io_v1_Settings.yaml @@ -10,6 +10,8 @@ metadata: spec: group: gloo.solo.io names: + categories: + - gloo-gateway kind: Settings listKind: SettingsList plural: settings diff --git a/install/helm/gloo/crds/gloo.solo.io_v1_Upstream.yaml b/install/helm/gloo/crds/gloo.solo.io_v1_Upstream.yaml index 0993fe97976..2b52d95dcbd 100644 --- a/install/helm/gloo/crds/gloo.solo.io_v1_Upstream.yaml +++ b/install/helm/gloo/crds/gloo.solo.io_v1_Upstream.yaml @@ -8,6 +8,8 @@ metadata: spec: group: gloo.solo.io names: + categories: + - gloo-gateway kind: Upstream listKind: UpstreamList plural: upstreams diff --git a/install/helm/gloo/crds/gloo.solo.io_v1_UpstreamGroup.yaml b/install/helm/gloo/crds/gloo.solo.io_v1_UpstreamGroup.yaml index 39efafbd857..1409e0a1585 100644 --- a/install/helm/gloo/crds/gloo.solo.io_v1_UpstreamGroup.yaml +++ b/install/helm/gloo/crds/gloo.solo.io_v1_UpstreamGroup.yaml @@ -8,6 +8,8 @@ metadata: spec: group: gloo.solo.io names: + categories: + - gloo-gateway kind: UpstreamGroup listKind: UpstreamGroupList plural: upstreamgroups diff --git a/install/helm/gloo/crds/graphql.gloo.solo.io_v1beta1_GraphQLApi.yaml b/install/helm/gloo/crds/graphql.gloo.solo.io_v1beta1_GraphQLApi.yaml index 8a9f75e5bf2..7ac884444f9 100644 --- a/install/helm/gloo/crds/graphql.gloo.solo.io_v1beta1_GraphQLApi.yaml +++ b/install/helm/gloo/crds/graphql.gloo.solo.io_v1beta1_GraphQLApi.yaml @@ -8,6 +8,9 @@ metadata: spec: group: graphql.gloo.solo.io names: + categories: + - solo-io + - gloo-gateway kind: GraphQLApi listKind: GraphQLApiList plural: graphqlapis diff --git a/install/helm/gloo/crds/ratelimit_config.yaml b/install/helm/gloo/crds/ratelimit_config.yaml index 0be39652360..4dccd93647c 100644 --- a/install/helm/gloo/crds/ratelimit_config.yaml +++ b/install/helm/gloo/crds/ratelimit_config.yaml @@ -5,6 +5,9 @@ metadata: spec: group: ratelimit.solo.io names: + categories: + - solo-io + - gloo-gateway kind: RateLimitConfig listKind: RateLimitConfigList plural: ratelimitconfigs diff --git a/test/kube2e/README.md b/test/kube2e/README.md index e7778808d82..bacb04c8b16 100644 --- a/test/kube2e/README.md +++ b/test/kube2e/README.md @@ -1,3 +1,6 @@ +> [!NOTE] +> This directory houses legacy tests. All new tests should instead be added to the `test/kubernetes/e2e` directory. + # Kubernetes End-to-End tests See the [developer kube-e2e testing guide](/devel/testing/kube-e2e-tests.md) for more information about the philosophy of these tests. diff --git a/test/kubernetes/e2e/features/crd_categories/suite.go b/test/kubernetes/e2e/features/crd_categories/suite.go new file mode 100644 index 00000000000..192bf2263c0 --- /dev/null +++ b/test/kubernetes/e2e/features/crd_categories/suite.go @@ -0,0 +1,54 @@ +package crd_categories + +import ( + "bytes" + "context" + "io" + "strings" + + "github.com/solo-io/gloo/test/kubernetes/e2e" + "github.com/solo-io/gloo/test/kubernetes/e2e/features/helm" + "github.com/stretchr/testify/suite" +) + +var _ e2e.NewSuiteFunc = NewTestingSuite + +type testingSuite struct { + suite.Suite + ctx context.Context + ti *e2e.TestInstallation +} + +func NewTestingSuite( + ctx context.Context, + testInst *e2e.TestInstallation, +) suite.TestingSuite { + return &testingSuite{ + ctx: ctx, + ti: testInst, + } +} + +func (s *testingSuite) SetupSuite() { + err := s.ti.Actions.Kubectl().ApplyFile(s.ctx, emptyVsManifest) + s.NoError(err, "can apply manifest "+emptyVsManifest) +} + +func (s *testingSuite) TearDownSuite() { + output, err := s.ti.Actions.Kubectl().DeleteFileWithOutput(s.ctx, emptyVsManifest) + s.ti.Assertions.ExpectObjectDeleted(emptyVsManifest, err, output) +} + +// See TestApplyCRDs() helm test for a future-proofed common category test, +// which ensures all CRDs in our helm chart include the gloo-gateway category. +// This test uses one of those CRs to assert that the resulting end user experience is as desired. +func (s *testingSuite) TestCommonCategory() { + cmd := s.ti.Actions.Kubectl().Command(s.ctx, "get", helm.CommonCRDCategory, "-o", "name") + + var out bytes.Buffer + err := cmd.WithStdout(io.Writer(&out)).Run().Cause() + s.NoError(err) + + // output should match the installed VS + s.Equal(strings.TrimSpace(out.String()), installedVs) +} diff --git a/test/kubernetes/e2e/features/crd_categories/testdata/manifests/empty-virtualservice.yaml b/test/kubernetes/e2e/features/crd_categories/testdata/manifests/empty-virtualservice.yaml new file mode 100644 index 00000000000..1570f20c4c0 --- /dev/null +++ b/test/kubernetes/e2e/features/crd_categories/testdata/manifests/empty-virtualservice.yaml @@ -0,0 +1,5 @@ +apiVersion: gateway.solo.io/v1 +kind: VirtualService +metadata: + name: empty-virtualservice +spec: {} \ No newline at end of file diff --git a/test/kubernetes/e2e/features/crd_categories/types.go b/test/kubernetes/e2e/features/crd_categories/types.go new file mode 100644 index 00000000000..3d654198083 --- /dev/null +++ b/test/kubernetes/e2e/features/crd_categories/types.go @@ -0,0 +1,13 @@ +package crd_categories + +import ( + "path/filepath" + + "github.com/solo-io/skv2/codegen/util" +) + +var ( + emptyVsManifest = filepath.Join(util.MustGetThisDir(), "testdata/manifests", "empty-virtualservice.yaml") + + installedVs = "virtualservice.gateway.solo.io/empty-virtualservice" +) diff --git a/test/kubernetes/e2e/features/helm/suite.go b/test/kubernetes/e2e/features/helm/suite.go index f11b8855ae3..192c1b43a1e 100644 --- a/test/kubernetes/e2e/features/helm/suite.go +++ b/test/kubernetes/e2e/features/helm/suite.go @@ -3,12 +3,14 @@ package helm import ( "bytes" "context" + "encoding/json" "io" "os" "path/filepath" - "strings" + "slices" "time" + "github.com/rotisserie/eris" "github.com/stretchr/testify/suite" v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" @@ -51,7 +53,7 @@ func (s *testingSuite) TestChangedConfigMapTriggersRollout() { err = adminCli.ConfigDumpCmd(s.Ctx, nil).WithStdout(dump).Run().Cause() s.NoError(err) - strings.Contains(b.String(), str) + s.Contains(b.String(), str) } getChecksum := func() string { @@ -81,14 +83,14 @@ func (s *testingSuite) TestApplyCRDs() { if err != nil { return err } - if info.IsDir() { + if info.IsDir() || info.Name() == "README.md" { return nil } - // Parse the file, and extract the CRD + // Parse the file, and extract the CRD- will fail for any non-yaml files or files not containing a CRD crd, err := schemagen.GetCRDFromFile(crdFile) if err != nil { - return err + return eris.Wrap(err, "error getting CRD from "+crdFile) } crdsByFileName[crdFile] = crd @@ -106,6 +108,20 @@ func (s *testingSuite) TestApplyCRDs() { out, _, err := s.TestHelper.Execute(s.Ctx, "get", "crd", crd.GetName()) s.NoError(err) s.Contains(out, crd.GetName()) + + // Ensure the CRD has the gloo-gateway category + out, _, err = s.TestHelper.Execute(s.Ctx, "get", "crd", crd.GetName(), "-o", "json") + s.NoError(err) + + var crdJson v1.CustomResourceDefinition + s.NoError(json.Unmarshal([]byte(out), &crdJson)) + s.Contains(crdJson.Spec.Names.Categories, CommonCRDCategory) + + // Ensure the CRD has the solo-io category iff it's an enterprise CRD + s.Equal( + slices.Contains(enterpriseCRDs, crd.GetName()), + slices.Contains(crdJson.Spec.Names.Categories, enterpriseCRDCategory), + ) } } diff --git a/test/kubernetes/e2e/features/helm/types.go b/test/kubernetes/e2e/features/helm/types.go index 9b44c4b0009..56591e23871 100644 --- a/test/kubernetes/e2e/features/helm/types.go +++ b/test/kubernetes/e2e/features/helm/types.go @@ -18,4 +18,13 @@ var ( }, }, } + + enterpriseCRDCategory = "solo-io" + CommonCRDCategory = "gloo-gateway" + + enterpriseCRDs = []string{ + "authconfigs.enterprise.gloo.solo.io", + "ratelimitconfigs.ratelimit.solo.io", + "graphqlapis.graphql.gloo.solo.io", + } ) diff --git a/test/kubernetes/e2e/tests/k8s_gw_tests.go b/test/kubernetes/e2e/tests/k8s_gw_tests.go index c7d5e233e8b..17d3160ecd5 100644 --- a/test/kubernetes/e2e/tests/k8s_gw_tests.go +++ b/test/kubernetes/e2e/tests/k8s_gw_tests.go @@ -3,6 +3,7 @@ package tests import ( "github.com/solo-io/gloo/test/kubernetes/e2e" "github.com/solo-io/gloo/test/kubernetes/e2e/features/admin_server" + "github.com/solo-io/gloo/test/kubernetes/e2e/features/crd_categories" "github.com/solo-io/gloo/test/kubernetes/e2e/features/deployer" "github.com/solo-io/gloo/test/kubernetes/e2e/features/directresponse" "github.com/solo-io/gloo/test/kubernetes/e2e/features/headless_svc" @@ -33,6 +34,7 @@ func KubeGatewaySuiteRunner() e2e.SuiteRunner { kubeGatewaySuiteRunner.Register("RouteDelegation", route_delegation.NewTestingSuite) kubeGatewaySuiteRunner.Register("GlooAdminServer", admin_server.NewTestingSuite) kubeGatewaySuiteRunner.Register("DirectResponse", directresponse.NewTestingSuite) + kubeGatewaySuiteRunner.Register("CRDCategories", crd_categories.NewTestingSuite) return kubeGatewaySuiteRunner }