Skip to content

Commit

Permalink
Fixed worker zone network management for existing shoots (gardener#2048)
Browse files Browse the repository at this point in the history
Co-authored-by: Holger Koser <[email protected]>
  • Loading branch information
grolu and holgerkoser authored Sep 3, 2024
1 parent 77ac6e1 commit ca76b9e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
18 changes: 7 additions & 11 deletions frontend/src/components/ShootWorkers/GWorkerConfiguration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ import {
ref,
computed,
provide,
watch,
} from 'vue'
import { useVuelidate } from '@vuelidate/core'
import yaml from 'js-yaml'
Expand All @@ -133,6 +132,7 @@ import {
isEmpty,
pick,
isEqual,
map,
} from '@/lodash'

export default {
Expand All @@ -154,8 +154,7 @@ export default {
const {
providerWorkers,
providerInfrastructureConfigNetworksZones,
initialZones,
usedZones,
initialProviderInfrastructureConfigNetworksZones,
setShootManifest,
} = useShootContext()

Expand All @@ -167,16 +166,17 @@ export default {
const disableWorkerAnimation = ref(false)
const newZonesAlert = ref(true)

const newZones = computed(() => {
const newZoneNetworks = computed(() => {
const initialNetworkNames = map(initialProviderInfrastructureConfigNetworksZones.value, 'name')
return filter(providerInfrastructureConfigNetworksZones.value, ({ name }) => {
return !includes(initialZones.value, name)
return !includes(initialNetworkNames, name)
})
})

const newZonesYaml = computed(() => {
return isEmpty(newZones.value)
return isEmpty(newZoneNetworks.value)
? undefined
: yaml.dump(newZones.value)
: yaml.dump(newZoneNetworks.value)
})

const editorData = computed({
Expand Down Expand Up @@ -222,10 +222,6 @@ export default {
disableLineHighlighting: true,
}))

watch(usedZones, value => {
providerInfrastructureConfigNetworksZones.value = filter(providerInfrastructureConfigNetworksZones.value, zone => includes(value, zone.name))
})

return {
v$: useVuelidate(),
shootItem,
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/components/ShootWorkers/GWorkerInputGeneric.vue
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ import {
set,
head,
pick,
every,
} from '@/lodash'

export default {
Expand Down Expand Up @@ -422,8 +423,14 @@ export default {
return sortBy(concat(this.selectedZones, this.unselectedZones), 'text')
},
zoneHint () {
const allAvailable = every(this.allZones, zone =>
includes(this.availableZones, zone),
)
if (allAvailable) {
return ''
}
if (this.maxAdditionalZones >= this.availableZones.length) {
return undefined
return ''
}
if (this.maxAdditionalZones === 0) {
return 'Your network configuration does not allow to add more zones that are not already used by this cluster'
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/composables/useShootContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ export function createShootContextComposable (options = {}) {
return uniq(flatMap(workers, 'zones'))
})

const initialProviderInfrastructureConfigNetworksZones = computed(() => {
return get(initialManifest.value, 'spec.provider.infrastructureConfig.networks.zones')
})

/* manifest */
const manifest = ref({})

Expand Down Expand Up @@ -982,6 +986,7 @@ export function createShootContextComposable (options = {}) {
providerInfrastructureConfigFirewallSize,
providerInfrastructureConfigFloatingPoolName,
providerInfrastructureConfigNetworksZones,
initialProviderInfrastructureConfigNetworksZones,
providerInfrastructureConfigPartitionID,
providerInfrastructureConfigProjectID,
/* provider - workers */
Expand Down

0 comments on commit ca76b9e

Please sign in to comment.