From a68506c54f60a578c3d189d0fbf18fc230e3f6da Mon Sep 17 00:00:00 2001 From: Neil MacDougall Date: Fri, 1 Sep 2023 17:23:58 +0100 Subject: [PATCH] Show banner that Weave is deprecated for k8s >= 1.27 --- .../form-network-config/component.js | 18 ++++++++++++++++++ .../form-network-config/template.hbs | 5 +++++ translations/en-us.yaml | 2 ++ 3 files changed, 25 insertions(+) diff --git a/lib/shared/addon/components/form-network-config/component.js b/lib/shared/addon/components/form-network-config/component.js index 3bcbfcec5..6440c3b3e 100644 --- a/lib/shared/addon/components/form-network-config/component.js +++ b/lib/shared/addon/components/form-network-config/component.js @@ -55,6 +55,7 @@ export default Component.extend({ enableNetworkPolicy: null, clusterTemplateRevision: null, applyClusterTemplate: null, + weaveDeprecated: false, windowsSupportOverrideAvailable: false, @@ -64,6 +65,8 @@ export default Component.extend({ this._super(...arguments); this.setFlannelLables(); + + this.checkWeaveDeprecation(); }, windowsSupportAvailableDidChange: observer('windowsSupportAvailable', function() { @@ -115,6 +118,10 @@ export default Component.extend({ } }), + k8sVersionDidChange: observer('config.kubernetesVersion', function() { + this.checkWeaveDeprecation(); + }), + networkPluginDidChange: observer('config.network.plugin', function() { let plugin = get(this, 'config.network.plugin'); @@ -131,6 +138,8 @@ export default Component.extend({ } else if (plugin !== WEAVE && get(this, 'config.network.weaveNetworkProvider.password')) { set(this, 'config.network.weaveNetworkProvider', null); } + + this.checkWeaveDeprecation(); } }), @@ -158,4 +167,13 @@ export default Component.extend({ set(flannel, 'label', 'clusterNew.rke.network.flannel'); } }, + + // Weave networking is deprecated as of Kubernetes 1.27 - show a banner to the user when they select Weave and >= 1.27 + checkWeaveDeprecation() { + const plugin = get(this, 'config.network.plugin'); + const kubernetesVersion = get(this, 'config.kubernetesVersion'); + const deprecated = (plugin === WEAVE && gte(coerceVersion(kubernetesVersion), 'v1.27.0')); + + set(this, 'weaveDeprecated', deprecated); + }, }); diff --git a/lib/shared/addon/components/form-network-config/template.hbs b/lib/shared/addon/components/form-network-config/template.hbs index f3e34c794..784a3edaa 100644 --- a/lib/shared/addon/components/form-network-config/template.hbs +++ b/lib/shared/addon/components/form-network-config/template.hbs @@ -33,6 +33,11 @@ {{/input-or-display}} + {{#if weaveDeprecated}} + {{#banner-message color="bg-warning"}} +

{{t 'clusterNew.rke.network.banners.weaveDeprecation' htmlSafe=true}}

+ {{/banner-message}} + {{/if}} {{!-- disabled for now --}} diff --git a/translations/en-us.yaml b/translations/en-us.yaml index 5825ee16c..871400a9e 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -4706,6 +4706,8 @@ clusterNew: monitoring: label: Metrics Server Monitoring network: + banners: + weaveDeprecation: The Weave CNI plugin is deprecated as of Kubernetes 1.27 and will be removed in 1.30 calico: Calico canal: Canal detail: Configure the networking for the cluster