Skip to content
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

Add a warning in case new networks extend the network configuration #1194

Merged
merged 8 commits into from
May 10, 2022
Merged
9 changes: 8 additions & 1 deletion frontend/src/components/ShootWorkers/ManageWorkers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ import assign from 'lodash/assign'
import isEmpty from 'lodash/isEmpty'
import flatMap from 'lodash/flatMap'
import difference from 'lodash/difference'
import get from 'lodash/get'
import { v4 as uuidv4 } from '@/utils/uuid'

const NO_LIMIT = -1
Expand Down Expand Up @@ -158,12 +159,18 @@ export default {
},
cloudProviderKind () {
const cloudProfile = this.cloudProfileByName(this.cloudProfileName)
return cloudProfile.metadata.cloudProviderKind
return get(cloudProfile, 'metadata.cloudProviderKind')
},
currentZonesNetworkConfiguration () {
return getZonesNetworkConfiguration(this.zonesNetworkConfiguration, this.internalWorkers, this.cloudProviderKind, this.allZones.length, this.existingWorkerCIDR)
}
},
watch: {
currentZonesNetworkConfiguration (value) {
grolu marked this conversation as resolved.
Show resolved Hide resolved
const additionalZonesNetworkConfiguration = difference(this.currentZonesNetworkConfiguration, this.zonesNetworkConfiguration)
this.$emit('additionalZonesNetworkConfiguration', additionalZonesNetworkConfiguration)
}
},
methods: {
setInternalWorkers (workers) {
this.internalWorkers = []
Expand Down
48 changes: 46 additions & 2 deletions frontend/src/components/ShootWorkers/WorkerConfiguration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,36 @@ SPDX-License-Identifier: Apache-2.0
<template v-slot:actionComponent>
<manage-workers
@valid="onWorkersValid"
@additionalZonesNetworkConfiguration="onAdditionalZonesNetworkConfiguration"
grolu marked this conversation as resolved.
Show resolved Hide resolved
ref="manageWorkers"
v-on="$manageWorkers.hooks"
></manage-workers>
</template>
<template v-slot:errorMessage>
<v-alert
type="warning"
outlined
tile
prominent
v-if="hasAdditionalZonesNetworkConfiguration"
dismissible
@input="dismissAdditionalNetworksWarning"
class="mx-1">
<span>Adding addtional zones will extend the zone network configuration by adding new networks to your cluster:</span>
<code-block
lang="code"
:content="additionalZonesNetworkConfigurationYaml"
grolu marked this conversation as resolved.
Show resolved Hide resolved
:show-copy-button="false"
></code-block>
<span class="font-weight-bold">This change cannot be undone.</span>
</v-alert>
</template>
</action-button-dialog>
</template>

<script>
import ActionButtonDialog from '@/components/dialogs/ActionButtonDialog'
import CodeBlock from '@/components/CodeBlock'
import { patchShootProvider } from '@/utils/api'
import shootItem from '@/mixins/shootItem'
import asyncRef from '@/mixins/asyncRef'
Expand All @@ -39,18 +60,26 @@ export default {
name: 'worker-configuration',
components: {
ActionButtonDialog,
ManageWorkers
ManageWorkers,
CodeBlock
},
data () {
return {
workersValid: false,
workers: undefined
workers: undefined,
additionalZonesNetworkConfiguration: [],
additionalZonesNetworkConfigurationYaml: undefined
grolu marked this conversation as resolved.
Show resolved Hide resolved
}
},
mixins: [
shootItem,
asyncRef('manageWorkers')
],
computed: {
hasAdditionalZonesNetworkConfiguration () {
return this.additionalZonesNetworkConfiguration.length
}
},
grolu marked this conversation as resolved.
Show resolved Hide resolved
methods: {
async onConfigurationDialogOpened () {
await this.reset()
Expand Down Expand Up @@ -95,6 +124,21 @@ export default {
},
onWorkersValid (value) {
this.workersValid = value
},
onAdditionalZonesNetworkConfiguration (value) {
this.additionalZonesNetworkConfiguration = value
},
dismissAdditionalNetworksWarning () {
this.additionalZonesNetworkConfiguration = []
}
},
watch: {
async hasAdditionalZonesNetworkConfiguration (value) {
if (value) {
this.additionalZonesNetworkConfigurationYaml = await this.$yaml.safeDump(this.additionalZonesNetworkConfiguration)
} else {
this.additionalZonesNetworkConfigurationYaml = undefined
}
grolu marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/dialogs/ActionButtonDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ SPDX-License-Identifier: Apache-2.0
<template v-slot:caption>{{caption}}</template>
<template v-slot:affectedObjectName>{{shootName}}</template>
<template v-slot:message><slot name="actionComponent"></slot></template>
<template v-slot:errorMessage><slot name="errorMessage"></slot></template>
</g-dialog>
</div>
<div v-else style="width: 36px"></div>
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/dialogs/GDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ SPDX-License-Identifier: Apache-2.0
<slot name="message">
This is a generic dialog template.
</slot>
<g-message color="error" class="mt-4" :message.sync="message" :detailed-message.sync="detailedMessage"></g-message>
</v-card-text>
<slot name="errorMessage"></slot>
<g-message color="error" class="mt-4" :message.sync="message" :detailed-message.sync="detailedMessage"></g-message>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
Expand Down