From de11f40d0c632ff839e5838ed650d1821c87d8a8 Mon Sep 17 00:00:00 2001
From: Travis Holton <travisholton@catalystcloud.nz>
Date: Mon, 28 Nov 2022 08:40:59 +1300
Subject: [PATCH] Update client.authentication.k8s.io api version for
 kubeconfig

The v1alpha1 version is removed in kubernetes 1.24. v1beta1 was added in
Kubernetes 1.11 and should be supported through existing versions.

Change-Id: I446b8c1c9b46fb8d70317f271a6a650d2a1bbefa
---
 magnumclient/common/utils.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/magnumclient/common/utils.py b/magnumclient/common/utils.py
index 3af5b67..a185115 100644
--- a/magnumclient/common/utils.py
+++ b/magnumclient/common/utils.py
@@ -238,7 +238,7 @@ def _config_cluster_kubernetes(cluster, cluster_template, cfg_dir,
                    "  user:\n"
                    "    exec:\n"
                    "      command: /bin/bash\n"
-                   "      apiVersion: client.authentication.k8s.io/v1alpha1\n"
+                   "      apiVersion: client.authentication.k8s.io/v1beta1\n"
                    "      args:\n"
                    "      - -c\n"
                    "      - >\n"
@@ -246,7 +246,7 @@ def _config_cluster_kubernetes(cluster, cluster_template, cfg_dir,
                    "            echo 'Error: Missing OpenStack credential from environment variable $OS_TOKEN' > /dev/stderr\n"  # noqa
                    "            exit 1\n"
                    "        else\n"
-                   "            echo '{ \"apiVersion\": \"client.authentication.k8s.io/v1alpha1\", \"kind\": \"ExecCredential\", \"status\": { \"token\": \"'\"${OS_TOKEN}\"'\"}}'\n"  # noqa
+                   "            echo '{ \"apiVersion\": \"client.authentication.k8s.io/v1beta1\", \"kind\": \"ExecCredential\", \"status\": { \"token\": \"'\"${OS_TOKEN}\"'\"}}'\n"  # noqa
                    "        fi\n"
                    % {'name': cluster.name,
                       'api_address': cluster.api_address,
-- 
GitLab