Skip to content

Commit

Permalink
Feature channel added
Browse files Browse the repository at this point in the history
Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>
  • Loading branch information
mlavacca committed Aug 27, 2024
1 parent 870d515 commit 552e3dd
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 122 deletions.
6 changes: 3 additions & 3 deletions conformance/utils/suite/conformance.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ func (test *ConformanceTest) Run(t *testing.T, suite *ConformanceTestSuite) {
t.Skipf("Skipping %s: suite does not support %s", test.ShortName, featureName)
}
feature := features.GetFeature(featureName)
featuresInfo = fmt.Sprintf("%s%s-%s", featuresInfo, feature.Name, feature.Status)
if i < len(featureName)-1 {
featuresInfo = fmt.Sprintf("%s%s-%s", featuresInfo, feature.Name, feature.Channel)
if i < len(test.Features)-1 {
featuresInfo += ", "
}
}
Expand All @@ -73,7 +73,7 @@ func (test *ConformanceTest) Run(t *testing.T, suite *ConformanceTestSuite) {
}

if featuresInfo != "" {
t.Logf("Running %s, relying on the following features: %s", test.ShortName, featuresInfo)
tlog.Logf(t, "Running %s, relying on the following features: %s", test.ShortName, featuresInfo)
}
test.Test(t, suite)
}
Expand Down
27 changes: 16 additions & 11 deletions pkg/features/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,23 @@ import "k8s.io/apimachinery/pkg/util/sets"
// Features - Types
// -----------------------------------------------------------------------------

// FeatureName allows opting in to additional conformance tests at an
// individual feature granularity.
// FeatureName is the type used to represent the name of a feature.
type FeatureName string

type FeatureStatus string
// FeatureChannel is the type used to represent the channel a feature belongs to.
type FeatureChannel string

// TODO: comment
const (
FeatureStatusTrial = "TRIAL"
FeatureStatusStable = "STABLE"
// FeatureChannelExperimental is used for experimental features.
FeatureChannelExperimental = "experimental"
// FeatureChannelStandard is used for standard features.
FeatureChannelStandard = "standard"
)

// TODO: comment
// Feature is a struct that represents a feature.
type Feature struct {
Name FeatureName
Status FeatureStatus
Name FeatureName
Channel FeatureChannel
}

// -----------------------------------------------------------------------------
Expand All @@ -56,7 +57,6 @@ var (
Insert(ReferenceGrantCoreFeatures.UnsortedList()...).
Insert(HTTPRouteCoreFeatures.UnsortedList()...).
Insert(HTTPRouteExtendedFeatures.UnsortedList()...).
Insert(HTTPRouteExperimentalFeatures.UnsortedList()...).
Insert(TLSRouteCoreFeatures.UnsortedList()...).
Insert(MeshCoreFeatures.UnsortedList()...).
Insert(MeshExtendedFeatures.UnsortedList()...).
Expand All @@ -71,7 +71,11 @@ func init() {
}
}

// TODO: comment
// -----------------------------------------------------------------------------
// Features - Helpers
// -----------------------------------------------------------------------------

// FeaturesSetsToFeatureNamesSet merges multiple sets of features into a single one and returns it.
func FeaturesSetsToFeatureNamesSet(featuresSets ...sets.Set[Feature]) sets.Set[FeatureName] {
res := sets.Set[FeatureName]{}
for _, set := range featuresSets {
Expand All @@ -82,6 +86,7 @@ func FeaturesSetsToFeatureNamesSet(featuresSets ...sets.Set[Feature]) sets.Set[F
return res
}

// GetFeature returns the feature with the given name.
func GetFeature(name FeatureName) Feature {
return featureMap[name]
}
23 changes: 10 additions & 13 deletions pkg/features/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ const (

var (
GatewayFeature = Feature{
Name: SupportGateway,
Status: FeatureStatusStable,
Name: SupportGateway,
Channel: FeatureChannelStandard,
}
)

Expand Down Expand Up @@ -65,23 +65,20 @@ const (

var (
GatewayPort8080Feature = Feature{
Name: SupportGatewayPort8080,
Status: FeatureStatusStable, // TODO: figure it out
Name: SupportGatewayPort8080,
Channel: FeatureChannelStandard,
}

GatewayStaticAddressesFeature = Feature{
Name: SupportGatewayStaticAddresses,
Status: FeatureStatusStable, // TODO: figure it out
Name: SupportGatewayStaticAddresses,
Channel: FeatureChannelStandard,
}

GatewayHTTPListenerIsolationFeature = Feature{
Name: SupportGatewayHTTPListenerIsolation,
Status: FeatureStatusStable, // TODO: figure it out
Name: SupportGatewayHTTPListenerIsolation,
Channel: FeatureChannelStandard,
}

GatewayInfrastructurePropagationFeature = Feature{
Name: SupportGatewayInfrastructurePropagation,
Status: FeatureStatusStable, // TODO: figure it out
Name: SupportGatewayInfrastructurePropagation,
Channel: FeatureChannelExperimental,
}
)

Expand Down
6 changes: 3 additions & 3 deletions pkg/features/grpcroute.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ import "k8s.io/apimachinery/pkg/util/sets"
// -----------------------------------------------------------------------------

const (
// This option indicates general support for service mesh
// This option indicates general support for GRPCRoute.
SupportGRPCRoute FeatureName = "GRPCRoute"
)

var (
GRPCRouteFeature = Feature{
Name: SupportGRPCRoute,
Status: FeatureStatusStable,
Name: SupportGRPCRoute,
Channel: FeatureChannelStandard,
}
)

Expand Down
114 changes: 42 additions & 72 deletions pkg/features/httproute.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const (

var (
HTTPRouteFeature = Feature{
Name: SupportHTTPRoute,
Status: FeatureStatusStable,
Name: SupportHTTPRoute,
Channel: FeatureChannelStandard,
}
)

Expand All @@ -45,6 +45,9 @@ var HTTPRouteCoreFeatures = sets.New(
// -----------------------------------------------------------------------------

const (
// This option indicates support for Destination Port matching.
SupportHTTPRouteDestinationPortMatching FeatureName = "HTTPRouteDestinationPortMatching"

// This option indicates support for HTTPRoute backend request header modification
SupportHTTPRouteBackendRequestHeaderModification FeatureName = "HTTPRouteBackendRequestHeaderModification"

Expand Down Expand Up @@ -95,91 +98,81 @@ const (
)

var (
HTTPRouteDestinationPortMatchingFeature = Feature{
Name: SupportHTTPRouteDestinationPortMatching,
Channel: FeatureChannelExperimental,
}
HTTPRouteBackendRequestHeaderModificationFeature = Feature{
Name: SupportHTTPRouteBackendRequestHeaderModification,
Status: FeatureStatusStable,
Name: SupportHTTPRouteBackendRequestHeaderModification,
Channel: FeatureChannelStandard,
}

HTTPRouteQueryParamMatchingFeature = Feature{
Name: SupportHTTPRouteQueryParamMatching,
Status: FeatureStatusStable,
Name: SupportHTTPRouteQueryParamMatching,
Channel: FeatureChannelStandard,
}

HTTPRouteMethodMatchingFeature = Feature{
Name: SupportHTTPRouteMethodMatching,
Status: FeatureStatusStable,
Name: SupportHTTPRouteMethodMatching,
Channel: FeatureChannelStandard,
}

HTTPRouteResponseHeaderModificationFeature = Feature{
Name: SupportHTTPRouteResponseHeaderModification,
Status: FeatureStatusStable,
Name: SupportHTTPRouteResponseHeaderModification,
Channel: FeatureChannelStandard,
}

HTTPRoutePortRedirectFeature = Feature{
Name: SupportHTTPRoutePortRedirect,
Status: FeatureStatusStable,
Name: SupportHTTPRoutePortRedirect,
Channel: FeatureChannelStandard,
}

HTTPRouteSchemeRedirectFeature = Feature{
Name: SupportHTTPRouteSchemeRedirect,
Status: FeatureStatusStable,
Name: SupportHTTPRouteSchemeRedirect,
Channel: FeatureChannelStandard,
}

HTTPRoutePathRedirectFeature = Feature{
Name: SupportHTTPRoutePathRedirect,
Status: FeatureStatusStable,
Name: SupportHTTPRoutePathRedirect,
Channel: FeatureChannelStandard,
}

HTTPRouteHostRewriteFeature = Feature{
Name: SupportHTTPRouteHostRewrite,
Status: FeatureStatusStable,
Name: SupportHTTPRouteHostRewrite,
Channel: FeatureChannelStandard,
}

HTTPRoutePathRewriteFeature = Feature{
Name: SupportHTTPRoutePathRewrite,
Status: FeatureStatusStable,
Name: SupportHTTPRoutePathRewrite,
Channel: FeatureChannelStandard,
}

HTTPRouteRequestMirrorFeature = Feature{
Name: SupportHTTPRouteRequestMirror,
Status: FeatureStatusStable,
Name: SupportHTTPRouteRequestMirror,
Channel: FeatureChannelStandard,
}

HTTPRouteRequestMultipleMirrorsFeature = Feature{
Name: SupportHTTPRouteRequestMultipleMirrors,
Status: FeatureStatusStable,
Name: SupportHTTPRouteRequestMultipleMirrors,
Channel: FeatureChannelStandard,
}

HTTPRouteRequestTimeoutFeature = Feature{
Name: SupportHTTPRouteRequestTimeout,
Status: FeatureStatusStable,
Name: SupportHTTPRouteRequestTimeout,
Channel: FeatureChannelStandard,
}

HTTPRouteBackendTimeoutFeature = Feature{
Name: SupportHTTPRouteBackendTimeout,
Status: FeatureStatusStable,
Name: SupportHTTPRouteBackendTimeout,
Channel: FeatureChannelStandard,
}

HTTPRouteParentRefPortFeature = Feature{
Name: SupportHTTPRouteParentRefPort,
Status: FeatureStatusStable,
Name: SupportHTTPRouteParentRefPort,
Channel: FeatureChannelStandard,
}

HTTPRouteBackendProtocolH2CFeature = Feature{
Name: SupportHTTPRouteBackendProtocolH2C,
Status: FeatureStatusStable,
Name: SupportHTTPRouteBackendProtocolH2C,
Channel: FeatureChannelStandard,
}

HTTPRouteBackendProtocolWebSocketFeature = Feature{
Name: SupportHTTPRouteBackendProtocolWebSocket,
Status: FeatureStatusStable,
Name: SupportHTTPRouteBackendProtocolWebSocket,
Channel: FeatureChannelStandard,
}
)

// HTTPRouteExtendedFeatures includes all extended features for HTTPRoute
// conformance and can be used to opt-in to run all HTTPRoute extended features tests.
// This does not include any Core Features.
var HTTPRouteExtendedFeatures = sets.New(
HTTPRouteDestinationPortMatchingFeature,
HTTPRouteBackendRequestHeaderModificationFeature,
HTTPRouteQueryParamMatchingFeature,
HTTPRouteMethodMatchingFeature,
Expand All @@ -197,26 +190,3 @@ var HTTPRouteExtendedFeatures = sets.New(
HTTPRouteBackendProtocolH2CFeature,
HTTPRouteBackendProtocolWebSocketFeature,
)

// -----------------------------------------------------------------------------
// Features - HTTPRoute Conformance (Experimental)
// -----------------------------------------------------------------------------

const (
// This option indicates support for Destination Port matching.
SupportHTTPRouteDestinationPortMatching FeatureName = "HTTPRouteDestinationPortMatching"
)

var (
HTTPRouteDestinationPortMatchingFeature = Feature{
Name: SupportHTTPRouteDestinationPortMatching,
Status: FeatureStatusTrial,
}
)

// HTTPRouteExperimentalFeatures includes all the supported experimental features, currently only
// available in our experimental release channel.
// Implementations have the flexibility to opt-in for either specific features or the entire set.
var HTTPRouteExperimentalFeatures = sets.New(
HTTPRouteDestinationPortMatchingFeature,
)
38 changes: 24 additions & 14 deletions pkg/features/mesh.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,12 @@ import "k8s.io/apimachinery/pkg/util/sets"
const (
// This option indicates general support for service mesh
SupportMesh FeatureName = "Mesh"
// This option indicates support for matching Service traffic specifically by Cluster IP rather than other mechanisms.
SupportMeshClusterIPMatching FeatureName = "MeshClusterIPMatching"
// This option indicates support for "consumer" routes, where a namespace creates a route for a service in another namespace.
SupportMeshConsumerRoute FeatureName = "MeshConsumerRoute"
)

var (
MeshFeature = Feature{
Name: SupportMesh,
Status: FeatureStatusStable,
}
MeshClusterIPMatchingFeature = Feature{
Name: SupportMeshClusterIPMatching,
Status: FeatureStatusStable,
}
MeshConsumerRouteFeature = Feature{
Name: SupportMeshConsumerRoute,
Status: FeatureStatusStable,
Name: SupportMesh,
Channel: FeatureChannelStandard,
}
)

Expand All @@ -52,6 +40,28 @@ var MeshCoreFeatures = sets.New(
MeshFeature,
)

// -----------------------------------------------------------------------------
// Features - Mesh Conformance (Extended)
// -----------------------------------------------------------------------------

const (
// This option indicates support for matching Service traffic specifically by Cluster IP rather than other mechanisms.
SupportMeshClusterIPMatching FeatureName = "MeshClusterIPMatching"
// This option indicates support for "consumer" routes, where a namespace creates a route for a service in another namespace.
SupportMeshConsumerRoute FeatureName = "MeshConsumerRoute"
)

var (
MeshClusterIPMatchingFeature = Feature{
Name: SupportMeshClusterIPMatching,
Channel: FeatureChannelStandard,
}
MeshConsumerRouteFeature = Feature{
Name: SupportMeshConsumerRoute,
Channel: FeatureChannelStandard,
}
)

// MeshExtendedFeatures includes all the supported features for the service mesh at
// an Extended level of support.
var MeshExtendedFeatures = sets.New(
Expand Down
4 changes: 2 additions & 2 deletions pkg/features/referencegrant.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const (
)

var ReferenceGrantFeature = Feature{
Name: SupportReferenceGrant,
Status: FeatureStatusStable,
Name: SupportReferenceGrant,
Channel: FeatureChannelStandard,
}

// ReferenceGrantCoreFeatures includes all SupportedFeatures needed to be
Expand Down
4 changes: 2 additions & 2 deletions pkg/features/tlsroute.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const (

var (
TLSRouteFeature = Feature{
Name: SupportTLSRoute,
Status: FeatureStatusTrial,
Name: SupportTLSRoute,
Channel: FeatureChannelExperimental,
}
)

Expand Down
Loading

0 comments on commit 552e3dd

Please sign in to comment.