From e73a22cfcdb5c63d6c29daf76ff6095c375584bb Mon Sep 17 00:00:00 2001 From: Lukas Gross Date: Fri, 28 Aug 2020 13:16:07 +0200 Subject: [PATCH 1/4] Implementation reflects current state of this feature in Gardener --- .../ShootWorkers/ContainerRuntime.vue | 142 ++++++++++++++++++ .../ShootWorkers/WorkerInputGeneric.vue | 27 +++- frontend/src/store/index.js | 3 +- 3 files changed, 169 insertions(+), 3 deletions(-) create mode 100644 frontend/src/components/ShootWorkers/ContainerRuntime.vue diff --git a/frontend/src/components/ShootWorkers/ContainerRuntime.vue b/frontend/src/components/ShootWorkers/ContainerRuntime.vue new file mode 100644 index 0000000000..1455e9183f --- /dev/null +++ b/frontend/src/components/ShootWorkers/ContainerRuntime.vue @@ -0,0 +1,142 @@ + + + diff --git a/frontend/src/components/ShootWorkers/WorkerInputGeneric.vue b/frontend/src/components/ShootWorkers/WorkerInputGeneric.vue index c170b0f7ef..ca4daa25e5 100644 --- a/frontend/src/components/ShootWorkers/WorkerInputGeneric.vue +++ b/frontend/src/components/ShootWorkers/WorkerInputGeneric.vue @@ -46,6 +46,13 @@ limitations under the License. @valid="onMachineImageValid"> +
+ + +
{ + return map(versions, ({ version, expirationDate, cri, classification }) => { const vendorName = vendorNameFromImageName(machineImage.name) const name = machineImage.name @@ -387,6 +387,7 @@ const getters = { key: name + '/' + version, name, version, + cri, classification, isPreview: classification === 'preview', isSupported: classification === 'supported', From 9288133273ed894cfddcd93c3c63150d6dfaa194 Mon Sep 17 00:00:00 2001 From: Lukas Gross Date: Wed, 5 May 2021 15:44:58 +0200 Subject: [PATCH 2/4] Show container runtimes selection as disabled for existing workers --- .../ShootWorkers/ContainerRuntime.vue | 66 ++++++++++++++++--- .../ShootWorkers/WorkerInputGeneric.vue | 8 ++- 2 files changed, 63 insertions(+), 11 deletions(-) diff --git a/frontend/src/components/ShootWorkers/ContainerRuntime.vue b/frontend/src/components/ShootWorkers/ContainerRuntime.vue index 1455e9183f..c4097a1fcd 100644 --- a/frontend/src/components/ShootWorkers/ContainerRuntime.vue +++ b/frontend/src/components/ShootWorkers/ContainerRuntime.vue @@ -1,28 +1,59 @@ + + + @@ -39,6 +70,7 @@ import unset from 'lodash/unset' // The following runtimes are defaults that are always offered. // Selecting a default Container / OCI Runtime will not create a CRI config in the shoot worker +// Currently, this is hard-coded in Gardener. Once this can be configured or default is removed, we need to adapt const DEFAULT_CONTAINER_RUNTIME = 'docker' const DEFAULT_OCI_RUNTIME = 'runc' @@ -71,6 +103,10 @@ export default { machineImageCri: { type: Array, default: () => [] + }, + immutableCri: { + type: Boolean, + default: false } }, data () { @@ -78,7 +114,9 @@ export default { validationErrors, valid: undefined, containerRuntime: undefined, - ociRuntime: undefined + ociRuntime: undefined, + defaultCir: DEFAULT_CONTAINER_RUNTIME, + defaultOci: DEFAULT_OCI_RUNTIME } }, validations, @@ -94,6 +132,18 @@ export default { const containerRuntime = find(this.machineImageCri, { name: this.containerRuntime }) const ociRuntimes = get(containerRuntime, 'containerRuntimes', []) return map(ociRuntimes, 'type') + }, + criHint () { + if (this.immutableCri) { + return 'Container runtime cannot be changed after worker has been created' + } + return undefined + }, + ociHint () { + if (this.immutableCri) { + return 'OCI runtimes cannot be changed after worker has been created' + } + return undefined } }, methods: { diff --git a/frontend/src/components/ShootWorkers/WorkerInputGeneric.vue b/frontend/src/components/ShootWorkers/WorkerInputGeneric.vue index 6bf857fa0f..5c14ee4bdb 100644 --- a/frontend/src/components/ShootWorkers/WorkerInputGeneric.vue +++ b/frontend/src/components/ShootWorkers/WorkerInputGeneric.vue @@ -38,8 +38,9 @@ SPDX-License-Identifier: Apache-2.0
@@ -138,7 +139,6 @@ import find from 'lodash/find' import concat from 'lodash/concat' import last from 'lodash/last' import difference from 'lodash/difference' -import find from 'lodash/find' import get from 'lodash/get' import set from 'lodash/set' import { required, maxLength, minValue, requiredIf } from 'vuelidate/lib/validators' @@ -223,7 +223,8 @@ export default { machineImageValid: undefined, containerRuntimeValid: undefined, immutableZones: undefined, - volumeSizeInternal: undefined + volumeSizeInternal: undefined, + immutableCri: undefined } }, validations () { @@ -502,6 +503,7 @@ export default { this.setVolumeDependingOnMachineType() this.onInputVolumeSize() this.immutableZones = this.isNew ? [] : this.worker.zones + this.immutableCri = !this.isNew } } From 7c085222bfbe6c75a092bb75fff2741ddb44cf3a Mon Sep 17 00:00:00 2001 From: Lukas Gross <35373687+grolu@users.noreply.github.com> Date: Thu, 6 May 2021 10:27:02 +0200 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: Holger Koser --- .../ShootWorkers/ContainerRuntime.vue | 23 +++++++++++-------- .../ShootWorkers/WorkerInputGeneric.vue | 8 +++---- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/frontend/src/components/ShootWorkers/ContainerRuntime.vue b/frontend/src/components/ShootWorkers/ContainerRuntime.vue index c4097a1fcd..53206714e6 100644 --- a/frontend/src/components/ShootWorkers/ContainerRuntime.vue +++ b/frontend/src/components/ShootWorkers/ContainerRuntime.vue @@ -20,13 +20,12 @@ SPDX-License-Identifier: Apache-2.0 :hint="criHint" persistent-hint > +```suggestion @@ -115,7 +112,7 @@ export default { valid: undefined, containerRuntime: undefined, ociRuntime: undefined, - defaultCir: DEFAULT_CONTAINER_RUNTIME, + defaultCri: DEFAULT_CONTAINER_RUNTIME, defaultOci: DEFAULT_OCI_RUNTIME } }, @@ -129,7 +126,7 @@ export default { if (this.containerRuntime === DEFAULT_CONTAINER_RUNTIME) { return [DEFAULT_OCI_RUNTIME] } - const containerRuntime = find(this.machineImageCri, { name: this.containerRuntime }) + const containerRuntime = find(this.machineImageCri, ['name', this.containerRuntime]) const ociRuntimes = get(containerRuntime, 'containerRuntimes', []) return map(ociRuntimes, 'type') }, @@ -147,6 +144,12 @@ export default { } }, methods: { + ociItemText (item) { + return !this.immutableCri && item === this.defaultOci ? `default (${item})` : item + }, + criItemText (item) { + return !this.immutableCri && item === this.defaultCri ? `default (${item})` : item + }, getErrorMessages (field) { return getValidationErrors(this, field) }, diff --git a/frontend/src/components/ShootWorkers/WorkerInputGeneric.vue b/frontend/src/components/ShootWorkers/WorkerInputGeneric.vue index 5c14ee4bdb..d8fed5714b 100644 --- a/frontend/src/components/ShootWorkers/WorkerInputGeneric.vue +++ b/frontend/src/components/ShootWorkers/WorkerInputGeneric.vue @@ -38,10 +38,10 @@ SPDX-License-Identifier: Apache-2.0
+ :machine-image-cri="machineImageCri" + :worker="worker" + :immutable-cri="immutableCri" + @valid="onContainerRuntimeValid">
From b7ce48c4cd44a8981b42ec257a3b2f90c918dbde Mon Sep 17 00:00:00 2001 From: Lukas Gross Date: Thu, 6 May 2021 10:34:25 +0200 Subject: [PATCH 4/4] fix suggestion --- frontend/src/components/ShootWorkers/ContainerRuntime.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/components/ShootWorkers/ContainerRuntime.vue b/frontend/src/components/ShootWorkers/ContainerRuntime.vue index 53206714e6..20aaee0e3f 100644 --- a/frontend/src/components/ShootWorkers/ContainerRuntime.vue +++ b/frontend/src/components/ShootWorkers/ContainerRuntime.vue @@ -20,7 +20,6 @@ SPDX-License-Identifier: Apache-2.0 :hint="criHint" persistent-hint > -```suggestion