diff --git a/config/gateway-api/crd/standard/gateway.networking.k8s.io_gatewayclasses.yaml b/config/gateway-api/crd/standard/gateway.networking.k8s.io_gatewayclasses.yaml index e124a26..d6d5535 100644 --- a/config/gateway-api/crd/standard/gateway.networking.k8s.io_gatewayclasses.yaml +++ b/config/gateway-api/crd/standard/gateway.networking.k8s.io_gatewayclasses.yaml @@ -234,6 +234,9 @@ spec: - jsonPath: .metadata.creationTimestamp name: Age type: date + - jsonPath: .status.supportedFeatures + name: SupportedFeatures + type: string - jsonPath: .spec.description name: Description priority: 1 @@ -418,6 +421,11 @@ spec: x-kubernetes-list-map-keys: - type x-kubernetes-list-type: map + supportedFeatures: + items: + type: string + maxItems: 64 + type: array type: object required: - spec diff --git a/custom-resource-state.yaml b/custom-resource-state.yaml index b7bc995..0e36339 100644 --- a/custom-resource-state.yaml +++ b/custom-resource-state.yaml @@ -126,6 +126,14 @@ spec: labelsFromPath: type: ["type"] valueFrom: ["status"] + - name: "status_supported_features" + help: "List of supported features for the GatewayClass" + each: + type: Info + info: + path: [status, supportedFeatures] + labelsFromPath: + features: [] - groupVersionKind: group: gateway.networking.k8s.io kind: "HTTPRoute" diff --git a/examples/enterprise/all.yaml b/examples/enterprise/all.yaml index 9e78eb5..a1ff5e5 100644 --- a/examples/enterprise/all.yaml +++ b/examples/enterprise/all.yaml @@ -202,6 +202,11 @@ status: reason: Accepted status: "True" type: Accepted + supportedFeatures: + - HTTPRoute + - HTTPRouteHostRewrite + - HTTPRoutePortRedirect + - HTTPRouteQueryParamMatching --- apiVersion: gateway.networking.k8s.io/v1beta1 kind: Gateway diff --git a/tests/e2e/main_test.go b/tests/e2e/main_test.go index 4d3a9fa..58e68c9 100644 --- a/tests/e2e/main_test.go +++ b/tests/e2e/main_test.go @@ -106,6 +106,29 @@ func testGatewayClasses(t *testing.T, metrics map[string][][]string) { expectEqual(t, gatewayClass1Status1Labels["customresource_version"], "v1beta1", "gatewayapi_gatewayclass_status__1 customresource_version") expectEqual(t, gatewayClass1Status1Labels["name"], "testgatewayclass1", "gatewayapi_gatewayclass_status__1 name") expectEqual(t, gatewayClass1Status1Labels["type"], "Accepted", "gatewayapi_gatewayclass_status__1 type") + + //gatewayapi_gatewayclass_status_supported_features + gatewayClassStatusSupportedFeatures := metrics["gatewayapi_gatewayclass_status_supported_features"] + gatewayClass1StatusSupportedFeatures1 := gatewayClassStatusSupportedFeatures[0] + expectEqual(t, gatewayClass1StatusSupportedFeatures1[3], "1", "gatewayapi_gatewayclass_status_supported_features__1 value") + gatewayClass1StatusSupportedFeatures1Labels := parseLabels(string(gatewayClass1StatusSupportedFeatures1[2])) + expectEqual(t, gatewayClass1StatusSupportedFeatures1Labels["customresource_group"], "gateway.networking.k8s.io", "gatewayapi_gatewayclass_status_supported_features__1 customresource_group") + expectEqual(t, gatewayClass1StatusSupportedFeatures1Labels["customresource_kind"], "GatewayClass", "gatewayapi_gatewayclass_status_supported_features__1 customresource_kind") + expectEqual(t, gatewayClass1StatusSupportedFeatures1Labels["customresource_version"], "v1beta1", "gatewayapi_gatewayclass_status_supported_features__1 customresource_version") + expectEqual(t, gatewayClass1StatusSupportedFeatures1Labels["name"], "testgatewayclass1", "gatewayapi_gatewayclass_status_supported_features__1 name") + + expectedFeatures := map[int]string{ + 0: "HTTPRoute", + 1: "HTTPRouteHostRewrite", + 2: "HTTPRoutePortRedirect", + 3: "HTTPRouteQueryParamMatching", + } + + for i, feature := range gatewayClassStatusSupportedFeatures { + featureInfo := parseLabels(string(feature[0])) + featureName := featureInfo["features"] + expectEqual(t, featureName, expectedFeatures[i], "gatewayapi_gatewayclass_status_supported_features__"+strconv.Itoa(i)+" features") + } } func testGateways(t *testing.T, metrics map[string][][]string) { diff --git a/tests/manifests/testgatewayclass1.yaml b/tests/manifests/testgatewayclass1.yaml index 73d8268..e711ec8 100644 --- a/tests/manifests/testgatewayclass1.yaml +++ b/tests/manifests/testgatewayclass1.yaml @@ -11,4 +11,9 @@ status: observedGeneration: 1 reason: Accepted status: "True" - type: Accepted \ No newline at end of file + type: Accepted + supportedFeatures: + - HTTPRoute + - HTTPRouteHostRewrite + - HTTPRoutePortRedirect + - HTTPRouteQueryParamMatching