From 1f0c309f41f2f5ce6faa0852e6c869db34edf71e Mon Sep 17 00:00:00 2001 From: Harshil Sanjay Jain Date: Mon, 23 Sep 2024 09:11:10 -0400 Subject: [PATCH 1/2] Allow updating kubernetes version --- .../KubernetesClusterResource.java | 15 +++++++++----- .../azure/containerservice/package-info.java | 20 +++++++++++++++++++ 2 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 src/main/java/gyro/azure/containerservice/package-info.java diff --git a/src/main/java/gyro/azure/containerservice/KubernetesClusterResource.java b/src/main/java/gyro/azure/containerservice/KubernetesClusterResource.java index 54accaa8..48bb6fce 100644 --- a/src/main/java/gyro/azure/containerservice/KubernetesClusterResource.java +++ b/src/main/java/gyro/azure/containerservice/KubernetesClusterResource.java @@ -30,7 +30,12 @@ import com.azure.resourcemanager.containerservice.models.ContainerServiceVMSizeTypes; import com.azure.resourcemanager.containerservice.models.KubeletDiskType; import com.azure.resourcemanager.containerservice.models.KubernetesCluster; +import com.azure.resourcemanager.containerservice.models.KubernetesCluster.DefinitionStages.WithAgentPool; +import com.azure.resourcemanager.containerservice.models.KubernetesCluster.DefinitionStages.WithCreate; +import com.azure.resourcemanager.containerservice.models.KubernetesCluster.DefinitionStages.WithServicePrincipalClientId; import com.azure.resourcemanager.containerservice.models.KubernetesClusterAgentPool; +import com.azure.resourcemanager.containerservice.models.KubernetesClusterAgentPool.DefinitionStages.Blank; +import com.azure.resourcemanager.containerservice.models.KubernetesClusterAgentPool.DefinitionStages.WithAttach; import com.azure.resourcemanager.containerservice.models.KubernetesClusters; import com.azure.resourcemanager.containerservice.models.LoadBalancerSku; import com.azure.resourcemanager.containerservice.models.ManagedClusterAddonProfile; @@ -40,11 +45,6 @@ import com.azure.resourcemanager.containerservice.models.OSType; import com.azure.resourcemanager.containerservice.models.ScaleSetEvictionPolicy; import com.azure.resourcemanager.containerservice.models.ScaleSetPriority; -import com.azure.resourcemanager.containerservice.models.KubernetesClusterAgentPool.DefinitionStages.WithAttach; -import com.azure.resourcemanager.containerservice.models.KubernetesClusterAgentPool.DefinitionStages.Blank; -import com.azure.resourcemanager.containerservice.models.KubernetesCluster.DefinitionStages.WithCreate; -import com.azure.resourcemanager.containerservice.models.KubernetesCluster.DefinitionStages.WithServicePrincipalClientId; -import com.azure.resourcemanager.containerservice.models.KubernetesCluster.DefinitionStages.WithAgentPool; import gyro.azure.AzureResource; import gyro.azure.Copyable; import gyro.azure.resources.ResourceGroupResource; @@ -166,6 +166,7 @@ public void setName(String name) { /** * Version of the AKS cluster to use. */ + @Updatable public String getVersion() { return version; } @@ -684,6 +685,10 @@ public void update( update = cluster.update(); + if (changedFieldNames.contains("version")) { + update = update.withVersion(getVersion()); + } + if (changedFieldNames.contains("enable-rbac")) { if (getEnableRbac()) { update = update.withRBACEnabled(); diff --git a/src/main/java/gyro/azure/containerservice/package-info.java b/src/main/java/gyro/azure/containerservice/package-info.java new file mode 100644 index 00000000..3e27fab5 --- /dev/null +++ b/src/main/java/gyro/azure/containerservice/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2024, Perfect Sense, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@DocGroup("ContainerService") +package gyro.azure.containerservice; + +import gyro.core.resource.DocGroup; \ No newline at end of file From 388c0b2e663ffbd8b5103891e68214e6374edf75 Mon Sep 17 00:00:00 2001 From: Harshil Sanjay Jain Date: Wed, 25 Sep 2024 11:03:26 -0400 Subject: [PATCH 2/2] Add newline to package info --- src/main/java/gyro/azure/containerservice/package-info.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/gyro/azure/containerservice/package-info.java b/src/main/java/gyro/azure/containerservice/package-info.java index 3e27fab5..62b2c3c6 100644 --- a/src/main/java/gyro/azure/containerservice/package-info.java +++ b/src/main/java/gyro/azure/containerservice/package-info.java @@ -17,4 +17,4 @@ @DocGroup("ContainerService") package gyro.azure.containerservice; -import gyro.core.resource.DocGroup; \ No newline at end of file +import gyro.core.resource.DocGroup;