From e23c4d3e94c55c7b37bb643b32d583f6d63838aa Mon Sep 17 00:00:00 2001 From: Tony Schneider Date: Wed, 20 Sep 2023 15:55:08 -0500 Subject: [PATCH] remove UserDefinedRouting AFEC feature flag (#3180) --- pkg/api/featureflags.go | 4 - pkg/frontend/openshiftcluster_putorpatch.go | 2 - pkg/frontend/outbound_type.go | 24 ---- pkg/frontend/outbound_type_test.go | 145 -------------------- 4 files changed, 175 deletions(-) delete mode 100644 pkg/frontend/outbound_type.go delete mode 100644 pkg/frontend/outbound_type_test.go diff --git a/pkg/api/featureflags.go b/pkg/api/featureflags.go index 27ef02ac9b2..a224ca35b99 100644 --- a/pkg/api/featureflags.go +++ b/pkg/api/featureflags.go @@ -15,10 +15,6 @@ const ( // Otherwise cluster nodes will use the DHCP-provided MTU of 1500 bytes. FeatureFlagMTU3900 = "Microsoft.RedHatOpenShift/MTU3900" - // FeatureFlagUserDefinedRouting is the feature in the subscription that is used to indicate we need to - // provision a private cluster without an IP address - FeatureFlagUserDefinedRouting = "Microsoft.RedHatOpenShift/UserDefinedRouting" - // FeatureFlagCheckAccessTestToggle is used for safely testing the new check access // API in production. The toggle will be removed once the testing has been completed. FeatureFlagCheckAccessTestToggle = "Microsoft.RedHatOpenShift/CheckAccessTestToggle" diff --git a/pkg/frontend/openshiftcluster_putorpatch.go b/pkg/frontend/openshiftcluster_putorpatch.go index 66bef843161..df697959fd1 100644 --- a/pkg/frontend/openshiftcluster_putorpatch.go +++ b/pkg/frontend/openshiftcluster_putorpatch.go @@ -195,8 +195,6 @@ func (f *frontend) _putOrPatchOpenShiftCluster(ctx context.Context, log *logrus. if err != nil { return nil, err } - // TODO: Remove this once 23-04-01 API release is complete. - determineOutboundType(ctx, doc, subscription) // TODO remove this when introducing the BYONSG CLI option if feature.IsRegisteredForFeature(subscription.Subscription.Properties, api.FeatureFlagPreconfiguredNSG) { diff --git a/pkg/frontend/outbound_type.go b/pkg/frontend/outbound_type.go deleted file mode 100644 index 5f240ea0565..00000000000 --- a/pkg/frontend/outbound_type.go +++ /dev/null @@ -1,24 +0,0 @@ -package frontend - -// Copyright (c) Microsoft Corporation. -// Licensed under the Apache License 2.0. - -import ( - "context" - - "github.com/Azure/ARO-RP/pkg/api" - "github.com/Azure/ARO-RP/pkg/util/feature" -) - -func determineOutboundType(ctx context.Context, doc *api.OpenShiftClusterDocument, subscription *api.SubscriptionDocument) { - // Honor the value of OutboundType if it was passed in via the API - if doc.OpenShiftCluster.Properties.NetworkProfile.OutboundType == "" { - // Determine if this is a cluster with user defined routing - doc.OpenShiftCluster.Properties.NetworkProfile.OutboundType = api.OutboundTypeLoadbalancer - if doc.OpenShiftCluster.Properties.APIServerProfile.Visibility == api.VisibilityPrivate && - doc.OpenShiftCluster.Properties.IngressProfiles[0].Visibility == api.VisibilityPrivate && - feature.IsRegisteredForFeature(subscription.Subscription.Properties, api.FeatureFlagUserDefinedRouting) { - doc.OpenShiftCluster.Properties.NetworkProfile.OutboundType = api.OutboundTypeUserDefinedRouting - } - } -} diff --git a/pkg/frontend/outbound_type_test.go b/pkg/frontend/outbound_type_test.go deleted file mode 100644 index 013d0140a28..00000000000 --- a/pkg/frontend/outbound_type_test.go +++ /dev/null @@ -1,145 +0,0 @@ -package frontend - -// Copyright (c) Microsoft Corporation. -// Licensed under the Apache License 2.0. - -import ( - "context" - "strings" - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/Azure/ARO-RP/pkg/api" -) - -func TestDetermineOutboundType(t *testing.T) { - ctx := context.Background() - - // Define the DB instance we will use to run the PatchWithLease function - key := "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resourceGroup/providers/Microsoft.RedHatOpenShift/openShiftClusters/resourceName" - - // Run tests - for _, tt := range []struct { - name string - clusterDoc *api.OpenShiftClusterDocument - subscriptionDoc *api.SubscriptionDocument - expectedOutboundType api.OutboundType - expectedErr error - }{ - { - name: "No OutboundType defined and no feature flag registered", - clusterDoc: &api.OpenShiftClusterDocument{ - Key: strings.ToLower(key), - OpenShiftCluster: &api.OpenShiftCluster{ - ID: key, - Properties: api.OpenShiftClusterProperties{ - ProvisioningState: api.ProvisioningStateSucceeded, - }, - }, - }, - subscriptionDoc: &api.SubscriptionDocument{ - Subscription: &api.Subscription{ - Properties: &api.SubscriptionProperties{ - RegisteredFeatures: []api.RegisteredFeatureProfile{}, - }, - }, - }, - expectedOutboundType: api.OutboundTypeLoadbalancer, - expectedErr: nil, - }, - { - name: "No OutboundType defined and UserDefinedRouting feature flag registered", - clusterDoc: &api.OpenShiftClusterDocument{ - Key: strings.ToLower(key), - OpenShiftCluster: &api.OpenShiftCluster{ - ID: key, - Properties: api.OpenShiftClusterProperties{ - ProvisioningState: api.ProvisioningStateSucceeded, - APIServerProfile: api.APIServerProfile{ - Visibility: api.VisibilityPrivate, - }, - IngressProfiles: []api.IngressProfile{ - { - Visibility: api.VisibilityPrivate, - }, - }, - }, - }, - }, - subscriptionDoc: &api.SubscriptionDocument{ - Subscription: &api.Subscription{ - Properties: &api.SubscriptionProperties{ - RegisteredFeatures: []api.RegisteredFeatureProfile{ - { - Name: api.FeatureFlagUserDefinedRouting, - State: "Registered", - }, - }, - }, - }, - }, - expectedOutboundType: api.OutboundTypeUserDefinedRouting, - expectedErr: nil, - }, - { - name: "OutboundType specified and UserDefinedRouting feature flag registered", - clusterDoc: &api.OpenShiftClusterDocument{ - Key: strings.ToLower(key), - OpenShiftCluster: &api.OpenShiftCluster{ - ID: key, - Properties: api.OpenShiftClusterProperties{ - ProvisioningState: api.ProvisioningStateSucceeded, - NetworkProfile: api.NetworkProfile{ - OutboundType: api.OutboundTypeLoadbalancer, - }, - }, - }, - }, - subscriptionDoc: &api.SubscriptionDocument{ - Subscription: &api.Subscription{ - Properties: &api.SubscriptionProperties{ - RegisteredFeatures: []api.RegisteredFeatureProfile{ - { - Name: api.FeatureFlagUserDefinedRouting, - State: "Registered", - }, - }, - }, - }, - }, - expectedOutboundType: api.OutboundTypeLoadbalancer, - expectedErr: nil, - }, - { - name: "OutboundType specified and no feature flag registered", - clusterDoc: &api.OpenShiftClusterDocument{ - Key: strings.ToLower(key), - OpenShiftCluster: &api.OpenShiftCluster{ - ID: key, - Properties: api.OpenShiftClusterProperties{ - ProvisioningState: api.ProvisioningStateSucceeded, - NetworkProfile: api.NetworkProfile{ - OutboundType: api.OutboundTypeLoadbalancer, - }, - }, - }, - }, - subscriptionDoc: &api.SubscriptionDocument{ - Subscription: &api.Subscription{ - Properties: &api.SubscriptionProperties{ - RegisteredFeatures: []api.RegisteredFeatureProfile{}, - }, - }, - }, - expectedOutboundType: api.OutboundTypeLoadbalancer, - expectedErr: nil, - }, - } { - t.Run(tt.name, func(t *testing.T) { - // Run determineOutboundType and assert the correct results - determineOutboundType(ctx, tt.clusterDoc, tt.subscriptionDoc) - assert.Equal(t, tt.expectedOutboundType, tt.clusterDoc.OpenShiftCluster.Properties.NetworkProfile.OutboundType, "OutboundType was not updated as expected exception") - }) - } -}