-
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.
Remove kyma upgrade capability (#896)
* Remove kyma upgrade capability * Remove kyma upgrade from swagger
- Loading branch information
1 parent
0352ff1
commit 2613e6f
Showing
17 changed files
with
184 additions
and
1,006 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
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 |
---|---|---|
|
@@ -4,6 +4,12 @@ import ( | |
"fmt" | ||
"net/http" | ||
"testing" | ||
"time" | ||
|
||
"github.com/google/uuid" | ||
"github.com/kyma-project/control-plane/components/provisioner/pkg/gqlschema" | ||
"github.com/kyma-project/kyma-environment-broker/internal/ptr" | ||
"k8s.io/apimachinery/pkg/util/wait" | ||
|
||
"github.com/pivotal-cf/brokerapi/v8/domain" | ||
"github.com/stretchr/testify/assert" | ||
|
@@ -154,3 +160,111 @@ func TestClusterUpgrade_UpgradeAfterUpdateWithNetworkPolicy(t *testing.T) { | |
"kyma-project.io/platform-region": "cf-eu10", | ||
}) | ||
} | ||
|
||
func TestClusterUpgradeUsesUpdatedAutoscalerParams(t *testing.T) { | ||
// given | ||
suite := NewBrokerSuiteTest(t) | ||
defer suite.TearDown() | ||
iid := uuid.New().String() | ||
|
||
// Create an SKR with a default autoscaler params | ||
resp := suite.CallAPI("PUT", fmt.Sprintf("oauth/cf-eu10/v2/service_instances/%s?accepts_incomplete=true", iid), | ||
`{ | ||
"service_id": "47c9dcbf-ff30-448e-ab36-d3bad66ba281", | ||
"plan_id": "4deee563-e5ec-4731-b9b1-53b42d855f0c", | ||
"context": { | ||
"globalaccount_id": "g-account-id", | ||
"subaccount_id": "sub-id", | ||
"user_id": "[email protected]", | ||
"sm_platform_credentials": { | ||
"url": "https://sm.url", | ||
"credentials": {} | ||
} | ||
}, | ||
"parameters": { | ||
"name": "testing-cluster", | ||
"region": "eastus" | ||
} | ||
}`) | ||
opID := suite.DecodeOperationID(resp) | ||
suite.processProvisioningByOperationID(opID) | ||
suite.WaitForOperationState(opID, domain.Succeeded) | ||
|
||
// perform an update with custom autoscaler params | ||
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": "4deee563-e5ec-4731-b9b1-53b42d855f0c", | ||
"context": { | ||
"globalaccount_id": "g-account-id", | ||
"user_id": "[email protected]" | ||
}, | ||
"parameters": { | ||
"autoScalerMin":50, | ||
"autoScalerMax":80, | ||
"maxSurge":13, | ||
"maxUnavailable":9 | ||
} | ||
}`) | ||
// then | ||
assert.Equal(t, http.StatusAccepted, resp.StatusCode) | ||
upgradeOperationID := suite.DecodeOperationID(resp) | ||
suite.FinishUpdatingOperationByProvisioner(upgradeOperationID) | ||
|
||
// when | ||
orchestrationResp := suite.CallAPI("POST", "upgrade/cluster", | ||
`{ | ||
"strategy": { | ||
"type": "parallel", | ||
"schedule": "immediate", | ||
"parallel": { | ||
"workers": 1 | ||
} | ||
}, | ||
"dryRun": false, | ||
"targets": { | ||
"include": [ | ||
{ | ||
"subAccount": "sub-id" | ||
} | ||
] | ||
} | ||
}`) | ||
oID := suite.DecodeOrchestrationID(orchestrationResp) | ||
|
||
var upgradeKymaOperationID string | ||
err := wait.PollImmediate(5*time.Millisecond, 400*time.Millisecond, func() (bool, error) { | ||
var err error | ||
opResponse := suite.CallAPI("GET", fmt.Sprintf("orchestrations/%s/operations", oID), "") | ||
upgradeKymaOperationID, err = suite.DecodeLastUpgradeKymaOperationIDFromOrchestration(opResponse) | ||
return err == nil, nil | ||
}) | ||
|
||
require.NoError(t, err) | ||
|
||
// then | ||
disabled := false | ||
suite.AssertShootUpgrade(upgradeKymaOperationID, gqlschema.UpgradeShootInput{ | ||
GardenerConfig: &gqlschema.GardenerUpgradeInput{ | ||
KubernetesVersion: ptr.String("1.18"), | ||
MachineImage: ptr.String("coreos"), | ||
MachineImageVersion: ptr.String("253"), | ||
|
||
MaxSurge: ptr.Integer(13), | ||
MaxUnavailable: ptr.Integer(9), | ||
|
||
EnableKubernetesVersionAutoUpdate: ptr.Bool(false), | ||
EnableMachineImageVersionAutoUpdate: ptr.Bool(false), | ||
|
||
OidcConfig: defaultOIDCConfig(), | ||
ShootNetworkingFilterDisabled: &disabled, | ||
}, | ||
Administrators: []string{"[email protected]"}, | ||
}) | ||
|
||
suite.AssertKymaResourceExists(upgradeOperationID) | ||
suite.AssertKymaLabelsExist(upgradeOperationID, map[string]string{ | ||
"kyma-project.io/region": "eastus", | ||
"kyma-project.io/platform-region": "cf-eu10", | ||
}) | ||
} |
Oops, something went wrong.