From 13cd70eaa5460b9d25eeb09e6716aee88b0557f1 Mon Sep 17 00:00:00 2001 From: Thomas Hartland Date: Fri, 13 Aug 2021 11:54:07 +0200 Subject: [PATCH] Use highest available magnum microversion Magnum allows using the microversion string "latest", and it will replace it internally with the highest microversion that it supports. This will let the autoscaler use microversion 1.10 which allows scaling groups to 0 nodes, if it is available. The autoscaler will still be able to use microversion 1.9 on older versions of magnum. --- cluster-autoscaler/cloudprovider/magnum/README.md | 2 ++ cluster-autoscaler/cloudprovider/magnum/magnum_manager.go | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cluster-autoscaler/cloudprovider/magnum/README.md b/cluster-autoscaler/cloudprovider/magnum/README.md index 7f1e3d81c154..5d0ca86a7c41 100644 --- a/cluster-autoscaler/cloudprovider/magnum/README.md +++ b/cluster-autoscaler/cloudprovider/magnum/README.md @@ -16,6 +16,8 @@ using the cluster autoscaler v1.18 or lower. ## Updates +* CA 1.22 + * Allow scaling node groups to 0 nodes, if supported (requires Magnum Wallaby). * CA 1.19 * Update to support Magnum node groups (introduced in Magnum Train). * Add node group autodiscovery based on the group's role property. diff --git a/cluster-autoscaler/cloudprovider/magnum/magnum_manager.go b/cluster-autoscaler/cloudprovider/magnum/magnum_manager.go index 53df60b5cd2c..1e97a9f5390a 100644 --- a/cluster-autoscaler/cloudprovider/magnum/magnum_manager.go +++ b/cluster-autoscaler/cloudprovider/magnum/magnum_manager.go @@ -29,6 +29,10 @@ import ( const ( // Magnum microversion that must be requested to use the node groups API. microversionNodeGroups = "1.9" + // Magnum microversion that must be requested to support scaling node groups to 0 nodes. + microversionScaleToZero = "1.10" + // Magnum interprets "latest" to mean the highest available microversion. + microversionLatest = "latest" ) // magnumManager is an interface for the basic interactions with the cluster. @@ -61,7 +65,7 @@ func createMagnumManager(configReader io.Reader, discoverOpts cloudprovider.Node return nil, err } - clusterClient.Microversion = microversionNodeGroups + clusterClient.Microversion = microversionLatest // This replaces the cluster name with a UUID if the name was given in the parameters. err = checkClusterUUID(provider, clusterClient, opts)