Skip to content

Commit

Permalink
address cr suggestions
Browse files Browse the repository at this point in the history
Signed-off-by: Kobi Levi <kobilevi503@gmail.com>
  • Loading branch information
levikobi committed Jan 26, 2024
1 parent 1c581eb commit 8716c9a
Show file tree
Hide file tree
Showing 11 changed files with 171 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,28 @@ gatewayClass:
reason: Accepted
status: "True"
type: Accepted
supportedFeatures:
- Gateway
- GatewayPort8080
- GatewayStaticAddresses
- HTTPRoute
- HTTPRouteBackendProtocolH2C
- HTTPRouteBackendProtocolWebSocket
- HTTPRouteBackendTimeout
- HTTPRouteDestinationPortMatching
- HTTPRouteHostRewrite
- HTTPRouteMethodMatching
- HTTPRoutePathRedirect
- HTTPRoutePathRewrite
- HTTPRoutePortRedirect
- HTTPRouteQueryParamMatching
- HTTPRouteRequestMirror
- HTTPRouteRequestMultipleMirrors
- HTTPRouteRequestTimeout
- HTTPRouteResponseHeaderModification
- HTTPRouteSchemeRedirect
- ReferenceGrant
- TLSRoute
gateways:
- metadata:
creationTimestamp: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,28 @@ gatewayClass:
reason: Accepted
status: "True"
type: Accepted
supportedFeatures:
- Gateway
- GatewayPort8080
- GatewayStaticAddresses
- HTTPRoute
- HTTPRouteBackendProtocolH2C
- HTTPRouteBackendProtocolWebSocket
- HTTPRouteBackendTimeout
- HTTPRouteDestinationPortMatching
- HTTPRouteHostRewrite
- HTTPRouteMethodMatching
- HTTPRoutePathRedirect
- HTTPRoutePathRewrite
- HTTPRoutePortRedirect
- HTTPRouteQueryParamMatching
- HTTPRouteRequestMirror
- HTTPRouteRequestMultipleMirrors
- HTTPRouteRequestTimeout
- HTTPRouteResponseHeaderModification
- HTTPRouteSchemeRedirect
- ReferenceGrant
- TLSRoute
gateways:
- metadata:
creationTimestamp: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,29 @@
"reason": "Accepted",
"message": "Valid GatewayClass"
}
],
"supportedFeatures": [
"Gateway",
"GatewayPort8080",
"GatewayStaticAddresses",
"HTTPRoute",
"HTTPRouteBackendProtocolH2C",
"HTTPRouteBackendProtocolWebSocket",
"HTTPRouteBackendTimeout",
"HTTPRouteDestinationPortMatching",
"HTTPRouteHostRewrite",
"HTTPRouteMethodMatching",
"HTTPRoutePathRedirect",
"HTTPRoutePathRewrite",
"HTTPRoutePortRedirect",
"HTTPRouteQueryParamMatching",
"HTTPRouteRequestMirror",
"HTTPRouteRequestMultipleMirrors",
"HTTPRouteRequestTimeout",
"HTTPRouteResponseHeaderModification",
"HTTPRouteSchemeRedirect",
"ReferenceGrant",
"TLSRoute"
]
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,28 @@ gatewayClass:
reason: InvalidParameters
status: "False"
type: Accepted
supportedFeatures:
- Gateway
- GatewayPort8080
- GatewayStaticAddresses
- HTTPRoute
- HTTPRouteBackendProtocolH2C
- HTTPRouteBackendProtocolWebSocket
- HTTPRouteBackendTimeout
- HTTPRouteDestinationPortMatching
- HTTPRouteHostRewrite
- HTTPRouteMethodMatching
- HTTPRoutePathRedirect
- HTTPRoutePathRewrite
- HTTPRoutePortRedirect
- HTTPRouteQueryParamMatching
- HTTPRouteRequestMirror
- HTTPRouteRequestMultipleMirrors
- HTTPRouteRequestTimeout
- HTTPRouteResponseHeaderModification
- HTTPRouteSchemeRedirect
- ReferenceGrant
- TLSRoute
gateways:
- metadata:
creationTimestamp: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,28 @@ gatewayClass:
reason: Accepted
status: "True"
type: Accepted
supportedFeatures:
- Gateway
- GatewayPort8080
- GatewayStaticAddresses
- HTTPRoute
- HTTPRouteBackendProtocolH2C
- HTTPRouteBackendProtocolWebSocket
- HTTPRouteBackendTimeout
- HTTPRouteDestinationPortMatching
- HTTPRouteHostRewrite
- HTTPRouteMethodMatching
- HTTPRoutePathRedirect
- HTTPRoutePathRewrite
- HTTPRoutePortRedirect
- HTTPRouteQueryParamMatching
- HTTPRouteRequestMirror
- HTTPRouteRequestMultipleMirrors
- HTTPRouteRequestTimeout
- HTTPRouteResponseHeaderModification
- HTTPRouteSchemeRedirect
- ReferenceGrant
- TLSRoute
gateways:
- metadata:
creationTimestamp: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,28 @@ gatewayClass:
reason: Accepted
status: "True"
type: Accepted
supportedFeatures:
- Gateway
- GatewayPort8080
- GatewayStaticAddresses
- HTTPRoute
- HTTPRouteBackendProtocolH2C
- HTTPRouteBackendProtocolWebSocket
- HTTPRouteBackendTimeout
- HTTPRouteDestinationPortMatching
- HTTPRouteHostRewrite
- HTTPRouteMethodMatching
- HTTPRoutePathRedirect
- HTTPRoutePathRewrite
- HTTPRoutePortRedirect
- HTTPRouteQueryParamMatching
- HTTPRouteRequestMirror
- HTTPRouteRequestMultipleMirrors
- HTTPRouteRequestTimeout
- HTTPRouteResponseHeaderModification
- HTTPRouteSchemeRedirect
- ReferenceGrant
- TLSRoute
gateways:
- metadata:
creationTimestamp: null
Expand Down
8 changes: 8 additions & 0 deletions internal/cmd/egctl/translate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/yaml"

"github.com/envoyproxy/gateway/internal/status"
"github.com/envoyproxy/gateway/internal/utils/field"
"github.com/envoyproxy/gateway/internal/utils/file"
)
Expand Down Expand Up @@ -344,6 +345,13 @@ func TestTranslate(t *testing.T) {
}
want := &TranslationResult{}
mustUnmarshal(t, requireTestDataOutFile(t, fn), want)

// Supported features are dynamic, instead of hard-coding them in the output files
// we define them here.
if want.GatewayClass != nil {
want.GatewayClass.Status.SupportedFeatures = status.GetSupportedFeatures()
}

opts := cmpopts.IgnoreFields(metav1.Condition{}, "LastTransitionTime")
require.Empty(t, cmp.Diff(want, got, opts))

Expand Down
13 changes: 7 additions & 6 deletions internal/status/gatewayclass.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ package status
import (
"k8s.io/apimachinery/pkg/util/sets"
gwapiv1 "sigs.k8s.io/gateway-api/apis/v1"
"sigs.k8s.io/gateway-api/conformance/utils/suite"

"github.com/envoyproxy/gateway/test/conformance"
)

// SetGatewayClassAccepted inserts or updates the Accepted condition
Expand All @@ -29,10 +30,8 @@ func SetGatewayClassAccepted(gc *gwapiv1.GatewayClass, accepted bool, reason, ms
// GetSupportedFeatures returns a list of supported Gateway-API features,
// based on the running conformance tests suite.
func GetSupportedFeatures() []gwapiv1.SupportedFeature {

// TODO(levikobi): This must be in sync with the cSuite supported features.
supportedFeatures := suite.AllFeatures
supportedFeatures.Delete(suite.MeshCoreFeatures.UnsortedList()...)
supportedFeatures := conformance.CommonEnvoySuite.SupportedFeatures
supportedFeatures.Delete(conformance.CommonEnvoySuite.ExemptFeatures.UnsortedList()...)

ret := sets.New[gwapiv1.SupportedFeature]()
for _, feature := range supportedFeatures.UnsortedList() {
Expand All @@ -44,6 +43,8 @@ func GetSupportedFeatures() []gwapiv1.SupportedFeature {
// SetGatewayClassSupportedFeatures insert or updates the SupportedFeatures field
// for the provided GatewayClass.
func SetGatewayClassSupportedFeatures(gc *gwapiv1.GatewayClass) *gwapiv1.GatewayClass {
gc.Status.SupportedFeatures = GetSupportedFeatures()
if gc != nil {
gc.Status.SupportedFeatures = GetSupportedFeatures()
}
return gc
}
17 changes: 17 additions & 0 deletions test/conformance/conformance_features.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright Envoy Gateway Authors
// SPDX-License-Identifier: Apache-2.0
// The full text of the Apache license is available in the LICENSE file at
// the root of the repo.

package conformance

import (
"sigs.k8s.io/gateway-api/conformance/tests"
"sigs.k8s.io/gateway-api/conformance/utils/suite"
)

var CommonEnvoySuite = suite.Options{
SupportedFeatures: suite.AllFeatures,
ExemptFeatures: suite.MeshCoreFeatures,
SkipTests: []string{tests.GatewayStaticAddresses.ShortName},
}
8 changes: 3 additions & 5 deletions test/conformance/conformance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,9 @@ func TestGatewayAPIConformance(t *testing.T) {
Debug: *flags.ShowDebug,
Clientset: clientset,
CleanupBaseResources: *flags.CleanupBaseResources,
SupportedFeatures: suite.AllFeatures,
SkipTests: []string{
tests.GatewayStaticAddresses.ShortName,
},
ExemptFeatures: suite.MeshCoreFeatures,
SupportedFeatures: CommonEnvoySuite.SupportedFeatures,
SkipTests: CommonEnvoySuite.SkipTests,
ExemptFeatures: CommonEnvoySuite.ExemptFeatures,
})
cSuite.Setup(t)
cSuite.Run(t, tests.ConformanceTests)
Expand Down
8 changes: 3 additions & 5 deletions test/conformance/experimental_conformance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,9 @@ func experimentalConformance(t *testing.T) {
GatewayClassName: *flags.GatewayClassName,
Debug: *flags.ShowDebug,
CleanupBaseResources: *flags.CleanupBaseResources,
SupportedFeatures: suite.AllFeatures,
SkipTests: []string{
tests.GatewayStaticAddresses.ShortName,
},
ExemptFeatures: suite.MeshCoreFeatures,
SupportedFeatures: CommonEnvoySuite.SupportedFeatures,
SkipTests: CommonEnvoySuite.SkipTests,
ExemptFeatures: CommonEnvoySuite.ExemptFeatures,
},
Implementation: *implementation,
ConformanceProfiles: conformanceProfiles,
Expand Down

0 comments on commit 8716c9a

Please sign in to comment.