Skip to content

Remove disable rollback when creating a cluster #171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions frontend/locales/en/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -1053,8 +1053,7 @@
"title": "Cluster configuration",
"description": "Check/edit the yaml file that is used to create the cluster",
"pending": "{{action}} request pending...",
"forceUpdate": "Force update: Edit the cluster while the compute fleet is still running.",
"disableRollback": "Disable rollback: Retain the cluster resources in case of a cluster create failure."
"forceUpdate": "Force update: Edit the cluster while the compute fleet is still running."
},
"flashBar": {
"success": "Success"
Expand Down
25 changes: 0 additions & 25 deletions frontend/src/__tests__/CreateCluster.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ describe('given a CreateCluster command and a cluster configuration', () => {
mockRegion,
mockSelectedRegion,
false,
false,
mockSuccessCallback,
)
expect(mockSuccessCallback).toHaveBeenCalledTimes(1)
Expand All @@ -70,7 +69,6 @@ describe('given a CreateCluster command and a cluster configuration', () => {
clusterConfiguration,
mockRegion,
mockSelectedRegion,
false,
mockDryRun,
)
expect(mockRequest).toHaveBeenCalledTimes(1)
Expand All @@ -83,28 +81,6 @@ describe('given a CreateCluster command and a cluster configuration', () => {
)
})
})

describe('when stack rollback on failure is disabled', () => {
const mockDisableRollback = true

it('should add set the rollbackOnFailure query parameter', async () => {
await CreateCluster(
clusterName,
clusterConfiguration,
mockRegion,
mockSelectedRegion,
mockDisableRollback,
)
expect(mockRequest).toHaveBeenCalledTimes(1)
expect(mockRequest).toHaveBeenCalledWith(
'post',
'api?path=/v3/clusters&rollbackOnFailure=false&region=some-region',
expect.any(Object),
expect.any(Object),
expect.any(Object),
)
})
})
})

describe('when the cluster creation fails', () => {
Expand All @@ -129,7 +105,6 @@ describe('given a CreateCluster command and a cluster configuration', () => {
mockRegion,
mockSelectedRegion,
false,
false,
undefined,
mockErrorCallback,
)
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/model.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,12 @@ function CreateCluster(
clusterConfig: any,
region: string,
selectedRegion: string,
disableRollback = false,
dryrun = false,
successCallback?: Callback,
errorCallback?: Callback,
) {
var url = 'api?path=/v3/clusters'
url += dryrun ? '&dryrun=true' : ''
url += disableRollback ? '&rollbackOnFailure=false' : ''
url += region ? `&region=${region}` : ''
var body = {clusterName: clusterName, clusterConfiguration: clusterConfig}
request('post', url, body)
Expand Down
21 changes: 3 additions & 18 deletions frontend/src/old-pages/Configure/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ function handleCreate(
) {
const clusterName = getState(['app', 'wizard', 'clusterName'])
const editing = getState(['app', 'wizard', 'editing'])
const disableRollback =
getState(['app', 'wizard', 'disableRollback']) || false
const forceUpdate = getState(['app', 'wizard', 'forceUpdate'])
const clusterConfig = getState(configPath) || ''
const dryRun = false
Expand Down Expand Up @@ -99,7 +97,6 @@ function handleCreate(
clusterConfig,
region,
selectedRegion,
disableRollback,
dryRun,
successHandler,
errHandler,
Expand All @@ -114,7 +111,6 @@ function handleDryRun() {
const clusterConfig = getState(configPath) || ''
const region = getState(['app', 'wizard', 'config', 'Region'])
const selectedRegion = getState(['app', 'selectedRegion'])
const disableRollback = false
const dryRun = true
var errHandler = (err: any) => {
setState(['app', 'wizard', 'errors', 'create'], err)
Expand All @@ -141,7 +137,6 @@ function handleDryRun() {
clusterConfig,
region,
selectedRegion,
disableRollback,
dryRun,
successHandler,
errHandler,
Expand Down Expand Up @@ -196,8 +191,6 @@ function Create() {
const {t} = useTranslation()
const clusterConfig = useState(configPath)
const forceUpdate = useState(['app', 'wizard', 'forceUpdate']) || false
const disableRollback =
useState(['app', 'wizard', 'disableRollback']) || false
const errors = useState(['app', 'wizard', 'errors', 'create'])
const pending = useState(['app', 'wizard', 'pending'])
const editing = getState(['app', 'wizard', 'editing'])
Expand Down Expand Up @@ -230,7 +223,9 @@ function Create() {
}
>
<SpaceBetween direction="vertical" size="s">
<Flashbar {...flashbarProps} />
{flashbarProps.items.length > 0 ? (
<Flashbar {...flashbarProps} />
) : null}
<ConfigView
config={clusterConfig}
pending={!clusterConfig}
Expand All @@ -254,16 +249,6 @@ function Create() {
{t('wizard.create.configuration.forceUpdate')}
</Checkbox>
)}
{!editing && (
<Checkbox
checked={disableRollback}
onChange={() =>
setState(['app', 'wizard', 'disableRollback'], !disableRollback)
}
>
{t('wizard.create.configuration.disableRollback')}
</Checkbox>
)}
</SpaceBetween>
</Container>
)
Expand Down