-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Additional worker node pools feature flag (#1695)
* Additional worker node pools feature flag * Rename variable --------- Co-authored-by: Jarosław Pieszka <[email protected]>
- Loading branch information
1 parent
c9ed200
commit a325843
Showing
13 changed files
with
168 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2530,14 +2530,20 @@ func TestUpdateErsContextAndParamsForExpiredInstance(t *testing.T) { | |
func TestUpdateAdditionalWorkerNodePools(t *testing.T) { | ||
t.Run("should add additional worker node pools", func(t *testing.T) { | ||
// given | ||
suite := NewBrokerSuiteTest(t) | ||
cfg := fixConfig() | ||
cfg.Broker.KimConfig.Enabled = true | ||
cfg.Broker.KimConfig.Plans = []string{"aws"} | ||
cfg.Broker.KimConfig.KimOnlyPlans = []string{"aws"} | ||
cfg.Broker.EnableAdditionalWorkerNodePools = true | ||
|
||
suite := NewBrokerSuiteTestWithConfig(t, cfg) | ||
defer suite.TearDown() | ||
iid := uuid.New().String() | ||
|
||
resp := suite.CallAPI("PUT", fmt.Sprintf("oauth/cf-eu10/v2/service_instances/%s?accepts_incomplete=true&plan_id=7d55d31d-35ae-4438-bf13-6ffdfa107d9f&service_id=47c9dcbf-ff30-448e-ab36-d3bad66ba281", iid), | ||
resp := suite.CallAPI("PUT", fmt.Sprintf("oauth/cf-eu10/v2/service_instances/%s?accepts_incomplete=true&plan_id=361c511f-f939-4621-b228-d0fb79a1fe15&service_id=47c9dcbf-ff30-448e-ab36-d3bad66ba281", iid), | ||
`{ | ||
"service_id": "47c9dcbf-ff30-448e-ab36-d3bad66ba281", | ||
"plan_id": "5cb3d976-b85c-42ea-a636-79cadda109a9", | ||
"plan_id": "361c511f-f939-4621-b228-d0fb79a1fe15", | ||
"context": { | ||
"globalaccount_id": "g-account-id", | ||
"subaccount_id": "sub-id", | ||
|
@@ -2557,7 +2563,7 @@ func TestUpdateAdditionalWorkerNodePools(t *testing.T) { | |
resp = suite.CallAPI("PATCH", fmt.Sprintf("oauth/cf-eu10/v2/service_instances/%s?accepts_incomplete=true", iid), | ||
`{ | ||
"service_id": "47c9dcbf-ff30-448e-ab36-d3bad66ba281", | ||
"plan_id": "5cb3d976-b85c-42ea-a636-79cadda109a9", | ||
"plan_id": "361c511f-f939-4621-b228-d0fb79a1fe15", | ||
"context": { | ||
"globalaccount_id": "g-account-id", | ||
"user_id": "[email protected]" | ||
|
@@ -2594,14 +2600,20 @@ func TestUpdateAdditionalWorkerNodePools(t *testing.T) { | |
|
||
t.Run("should replace additional worker node pools", func(t *testing.T) { | ||
// given | ||
suite := NewBrokerSuiteTest(t) | ||
cfg := fixConfig() | ||
cfg.Broker.KimConfig.Enabled = true | ||
cfg.Broker.KimConfig.Plans = []string{"aws"} | ||
cfg.Broker.KimConfig.KimOnlyPlans = []string{"aws"} | ||
cfg.Broker.EnableAdditionalWorkerNodePools = true | ||
|
||
suite := NewBrokerSuiteTestWithConfig(t, cfg) | ||
defer suite.TearDown() | ||
iid := uuid.New().String() | ||
|
||
resp := suite.CallAPI("PUT", fmt.Sprintf("oauth/cf-eu10/v2/service_instances/%s?accepts_incomplete=true&plan_id=7d55d31d-35ae-4438-bf13-6ffdfa107d9f&service_id=47c9dcbf-ff30-448e-ab36-d3bad66ba281", iid), | ||
resp := suite.CallAPI("PUT", fmt.Sprintf("oauth/cf-eu10/v2/service_instances/%s?accepts_incomplete=true&plan_id=361c511f-f939-4621-b228-d0fb79a1fe15&service_id=47c9dcbf-ff30-448e-ab36-d3bad66ba281", iid), | ||
`{ | ||
"service_id": "47c9dcbf-ff30-448e-ab36-d3bad66ba281", | ||
"plan_id": "5cb3d976-b85c-42ea-a636-79cadda109a9", | ||
"plan_id": "361c511f-f939-4621-b228-d0fb79a1fe15", | ||
"context": { | ||
"globalaccount_id": "g-account-id", | ||
"subaccount_id": "sub-id", | ||
|
@@ -2630,7 +2642,7 @@ func TestUpdateAdditionalWorkerNodePools(t *testing.T) { | |
resp = suite.CallAPI("PATCH", fmt.Sprintf("oauth/cf-eu10/v2/service_instances/%s?accepts_incomplete=true", iid), | ||
`{ | ||
"service_id": "47c9dcbf-ff30-448e-ab36-d3bad66ba281", | ||
"plan_id": "5cb3d976-b85c-42ea-a636-79cadda109a9", | ||
"plan_id": "361c511f-f939-4621-b228-d0fb79a1fe15", | ||
"context": { | ||
"globalaccount_id": "g-account-id", | ||
"user_id": "[email protected]" | ||
|
@@ -2659,14 +2671,20 @@ func TestUpdateAdditionalWorkerNodePools(t *testing.T) { | |
|
||
t.Run("should remove additional worker node pools when list is empty", func(t *testing.T) { | ||
// given | ||
suite := NewBrokerSuiteTest(t) | ||
cfg := fixConfig() | ||
cfg.Broker.KimConfig.Enabled = true | ||
cfg.Broker.KimConfig.Plans = []string{"aws"} | ||
cfg.Broker.KimConfig.KimOnlyPlans = []string{"aws"} | ||
cfg.Broker.EnableAdditionalWorkerNodePools = true | ||
|
||
suite := NewBrokerSuiteTestWithConfig(t, cfg) | ||
defer suite.TearDown() | ||
iid := uuid.New().String() | ||
|
||
resp := suite.CallAPI("PUT", fmt.Sprintf("oauth/cf-eu10/v2/service_instances/%s?accepts_incomplete=true&plan_id=7d55d31d-35ae-4438-bf13-6ffdfa107d9f&service_id=47c9dcbf-ff30-448e-ab36-d3bad66ba281", iid), | ||
resp := suite.CallAPI("PUT", fmt.Sprintf("oauth/cf-eu10/v2/service_instances/%s?accepts_incomplete=true&plan_id=361c511f-f939-4621-b228-d0fb79a1fe15&service_id=47c9dcbf-ff30-448e-ab36-d3bad66ba281", iid), | ||
`{ | ||
"service_id": "47c9dcbf-ff30-448e-ab36-d3bad66ba281", | ||
"plan_id": "5cb3d976-b85c-42ea-a636-79cadda109a9", | ||
"plan_id": "361c511f-f939-4621-b228-d0fb79a1fe15", | ||
"context": { | ||
"globalaccount_id": "g-account-id", | ||
"subaccount_id": "sub-id", | ||
|
@@ -2702,7 +2720,7 @@ func TestUpdateAdditionalWorkerNodePools(t *testing.T) { | |
resp = suite.CallAPI("PATCH", fmt.Sprintf("oauth/cf-eu10/v2/service_instances/%s?accepts_incomplete=true", iid), | ||
`{ | ||
"service_id": "47c9dcbf-ff30-448e-ab36-d3bad66ba281", | ||
"plan_id": "5cb3d976-b85c-42ea-a636-79cadda109a9", | ||
"plan_id": "361c511f-f939-4621-b228-d0fb79a1fe15", | ||
"context": { | ||
"globalaccount_id": "g-account-id", | ||
"user_id": "[email protected]" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1563,7 +1563,7 @@ func TestAdditionalWorkerNodePools(t *testing.T) { | |
queue.On("Add", mock.AnythingOfType("string")) | ||
|
||
factoryBuilder := &automock.PlanValidator{} | ||
factoryBuilder.On("IsPlanSupport", broker.PreviewPlanID).Return(true) | ||
factoryBuilder.On("IsPlanSupport", broker.AWSPlanID).Return(true) | ||
|
||
planDefaults := func(planID string, platformProvider pkg.CloudProvider, provider *pkg.CloudProvider) (*gqlschema.ClusterConfigInput, error) { | ||
return &gqlschema.ClusterConfigInput{}, nil | ||
|
@@ -1573,10 +1573,11 @@ func TestAdditionalWorkerNodePools(t *testing.T) { | |
// #create provisioner endpoint | ||
provisionEndpoint := broker.NewProvision( | ||
broker.Config{ | ||
EnablePlans: []string{"preview"}, | ||
URL: brokerURL, | ||
OnlySingleTrialPerGA: true, | ||
EnableKubeconfigURLLabel: true, | ||
EnablePlans: []string{"aws"}, | ||
URL: brokerURL, | ||
OnlySingleTrialPerGA: true, | ||
EnableKubeconfigURLLabel: true, | ||
EnableAdditionalWorkerNodePools: true, | ||
}, | ||
gardener.Config{Project: "test", ShootDomain: "example.com", DNSProviders: fixDNSProviders()}, | ||
memoryStorage.Operations(), | ||
|
@@ -1596,7 +1597,7 @@ func TestAdditionalWorkerNodePools(t *testing.T) { | |
// when | ||
_, err := provisionEndpoint.Provision(fixRequestContext(t, "cf-eu10"), instanceID, domain.ProvisionDetails{ | ||
ServiceID: serviceID, | ||
PlanID: broker.PreviewPlanID, | ||
PlanID: broker.AWSPlanID, | ||
RawParameters: json.RawMessage(fmt.Sprintf(`{"name": "%s", "region": "%s","additionalWorkerNodePools": %s }`, clusterName, "eu-central-1", tc.additionalWorkerNodePools)), | ||
RawContext: json.RawMessage(fmt.Sprintf(`{"globalaccount_id": "%s", "subaccount_id": "%s", "user_id": "%s"}`, "any-global-account-id", subAccountID, "[email protected]")), | ||
}, true) | ||
|
@@ -1618,21 +1619,6 @@ func TestAdditionalWorkerNodePoolsForUnsupportedPlans(t *testing.T) { | |
"Free": { | ||
planID: broker.FreemiumPlanID, | ||
}, | ||
"Azure": { | ||
planID: broker.AzurePlanID, | ||
}, | ||
"Azure lite": { | ||
planID: broker.AzureLitePlanID, | ||
}, | ||
"AWS": { | ||
planID: broker.AWSPlanID, | ||
}, | ||
"GCP": { | ||
planID: broker.GCPPlanID, | ||
}, | ||
"SAP converged cloud": { | ||
planID: broker.SapConvergedCloudPlanID, | ||
}, | ||
} { | ||
t.Run(tn, func(t *testing.T) { | ||
// given | ||
|
@@ -1656,10 +1642,11 @@ func TestAdditionalWorkerNodePoolsForUnsupportedPlans(t *testing.T) { | |
// #create provisioner endpoint | ||
provisionEndpoint := broker.NewProvision( | ||
broker.Config{ | ||
EnablePlans: []string{"trial", "free", "azure", "azure_lite", "aws", "gcp", "sap-converged-cloud"}, | ||
URL: brokerURL, | ||
OnlySingleTrialPerGA: true, | ||
EnableKubeconfigURLLabel: true, | ||
EnablePlans: []string{"trial", "free"}, | ||
URL: brokerURL, | ||
OnlySingleTrialPerGA: true, | ||
EnableKubeconfigURLLabel: true, | ||
EnableAdditionalWorkerNodePools: true, | ||
}, | ||
gardener.Config{Project: "test", ShootDomain: "example.com", DNSProviders: fixDNSProviders()}, | ||
memoryStorage.Operations(), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.