From 986249e5e3312821db5a096f1ea6f1a712e4a7c4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 19 Jun 2026 20:07:50 +0000 Subject: [PATCH 1/3] Initial plan From 86a0fdeef92948f7ab4f887b47b78d3762387807 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 19 Jun 2026 20:12:57 +0000 Subject: [PATCH 2/3] Use AKS current Kubernetes version --- scripts/aks-flex-config | 2 +- scripts/aks_flex_config_test.py | 51 +++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 scripts/aks_flex_config_test.py diff --git a/scripts/aks-flex-config b/scripts/aks-flex-config index fe7491d6..9d94213a 100755 --- a/scripts/aks-flex-config +++ b/scripts/aks-flex-config @@ -136,7 +136,7 @@ def cluster_metadata(args: argparse.Namespace) -> dict[str, str]: "resource_id": run(["az", "aks", "show", *aks, "--query", "id", "-o", "tsv"], capture=True), "location": run(["az", "aks", "show", *aks, "--query", "location", "-o", "tsv"], capture=True), "kubernetes_version": run( - ["az", "aks", "show", *aks, "--query", "currentKubernetesVersion || kubernetesVersion", "-o", "tsv"], + ["az", "aks", "show", *aks, "--query", "currentKubernetesVersion", "-o", "tsv"], capture=True, ), "dns_service_ip": run( diff --git a/scripts/aks_flex_config_test.py b/scripts/aks_flex_config_test.py new file mode 100644 index 00000000..b4fc9c44 --- /dev/null +++ b/scripts/aks_flex_config_test.py @@ -0,0 +1,51 @@ +import argparse +import importlib.machinery +import importlib.util +from pathlib import Path +import unittest +from unittest import mock + + +SCRIPT_PATH = Path(__file__).with_name("aks-flex-config") + + +def load_module(): + loader = importlib.machinery.SourceFileLoader("aks_flex_config", str(SCRIPT_PATH)) + spec = importlib.util.spec_from_loader(loader.name, loader) + module = importlib.util.module_from_spec(spec) + loader.exec_module(module) + return module + + +class ClusterMetadataTest(unittest.TestCase): + def test_cluster_metadata_uses_current_kubernetes_version(self): + module = load_module() + args = argparse.Namespace(resource_group="rg", cluster_name="cluster", subscription="sub") + responses = iter(["sub", "tenant", "resource-id", "westus2", "1.34.8", "10.0.0.10"]) + + with mock.patch.object(module, "run", side_effect=lambda *unused_args, **unused_kwargs: next(responses)) as run: + metadata = module.cluster_metadata(args) + + self.assertEqual(metadata["kubernetes_version"], "1.34.8") + run.assert_any_call( + [ + "az", + "aks", + "show", + "--resource-group", + "rg", + "--name", + "cluster", + "--subscription", + "sub", + "--query", + "currentKubernetesVersion", + "-o", + "tsv", + ], + capture=True, + ) + + +if __name__ == "__main__": + unittest.main() From e283564746dc1862ea939617f90cc3663e4f6c09 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 19 Jun 2026 21:33:39 +0000 Subject: [PATCH 3/3] Remove aks_flex_config_test.py per review request --- scripts/aks_flex_config_test.py | 51 --------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 scripts/aks_flex_config_test.py diff --git a/scripts/aks_flex_config_test.py b/scripts/aks_flex_config_test.py deleted file mode 100644 index b4fc9c44..00000000 --- a/scripts/aks_flex_config_test.py +++ /dev/null @@ -1,51 +0,0 @@ -import argparse -import importlib.machinery -import importlib.util -from pathlib import Path -import unittest -from unittest import mock - - -SCRIPT_PATH = Path(__file__).with_name("aks-flex-config") - - -def load_module(): - loader = importlib.machinery.SourceFileLoader("aks_flex_config", str(SCRIPT_PATH)) - spec = importlib.util.spec_from_loader(loader.name, loader) - module = importlib.util.module_from_spec(spec) - loader.exec_module(module) - return module - - -class ClusterMetadataTest(unittest.TestCase): - def test_cluster_metadata_uses_current_kubernetes_version(self): - module = load_module() - args = argparse.Namespace(resource_group="rg", cluster_name="cluster", subscription="sub") - responses = iter(["sub", "tenant", "resource-id", "westus2", "1.34.8", "10.0.0.10"]) - - with mock.patch.object(module, "run", side_effect=lambda *unused_args, **unused_kwargs: next(responses)) as run: - metadata = module.cluster_metadata(args) - - self.assertEqual(metadata["kubernetes_version"], "1.34.8") - run.assert_any_call( - [ - "az", - "aks", - "show", - "--resource-group", - "rg", - "--name", - "cluster", - "--subscription", - "sub", - "--query", - "currentKubernetesVersion", - "-o", - "tsv", - ], - capture=True, - ) - - -if __name__ == "__main__": - unittest.main()