From f7cc4e552a76cf6288a1fff456f0bef4ff21d4cf Mon Sep 17 00:00:00 2001 From: zedy Date: Fri, 19 Jul 2024 17:02:33 +0800 Subject: [PATCH] update aks auto feature --- .../managed-cluster/README.md | 19 ++++ .../managed-cluster/main.bicep | 15 ++++ .../managed-cluster/main.json | 86 ++++++++++++++++++- .../maintenance-configurations/README.md | 67 +++++++++++++++ .../maintenance-configurations/main.bicep | 24 ++++++ .../maintenance-configurations/main.json | 44 ++++++++++ 6 files changed, 254 insertions(+), 1 deletion(-) create mode 100644 avm/res/container-service/managed-cluster/maintenance-configurations/README.md create mode 100644 avm/res/container-service/managed-cluster/maintenance-configurations/main.bicep create mode 100644 avm/res/container-service/managed-cluster/maintenance-configurations/main.json diff --git a/avm/res/container-service/managed-cluster/README.md b/avm/res/container-service/managed-cluster/README.md index d381a5ff29..e172503f64 100644 --- a/avm/res/container-service/managed-cluster/README.md +++ b/avm/res/container-service/managed-cluster/README.md @@ -19,6 +19,7 @@ This module deploys an Azure Kubernetes Service (AKS) Managed Cluster. | `Microsoft.Authorization/roleAssignments` | [2022-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2022-04-01/roleAssignments) | | `Microsoft.ContainerService/managedClusters` | [2024-03-02-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ContainerService/2024-03-02-preview/managedClusters) | | `Microsoft.ContainerService/managedClusters/agentPools` | [2023-07-02-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ContainerService/2023-07-02-preview/managedClusters/agentPools) | +| `Microsoft.ContainerService/managedClusters/maintenanceConfigurations` | [2023-10-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ContainerService/2023-10-01/managedClusters/maintenanceConfigurations) | | `Microsoft.Insights/diagnosticSettings` | [2021-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Insights/2021-05-01-preview/diagnosticSettings) | | `Microsoft.KubernetesConfiguration/extensions` | [2022-03-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.KubernetesConfiguration/2022-03-01/extensions) | | `Microsoft.KubernetesConfiguration/fluxConfigurations` | [2022-03-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.KubernetesConfiguration/2022-03-01/fluxConfigurations) | @@ -1449,6 +1450,7 @@ module managedCluster 'br/public:avm/res/container-service/managed-cluster:. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices. diff --git a/avm/res/container-service/managed-cluster/maintenance-configurations/main.bicep b/avm/res/container-service/managed-cluster/maintenance-configurations/main.bicep new file mode 100644 index 0000000000..2f2b8df064 --- /dev/null +++ b/avm/res/container-service/managed-cluster/maintenance-configurations/main.bicep @@ -0,0 +1,24 @@ +metadata name = 'Azure Kubernetes Service (AKS) Managed Cluster Maintenance Configurations' +metadata description = 'This module deploys an Azure Kubernetes Service (AKS) Managed Cluster Maintenance Configurations.' +metadata owner = 'Azure/module-maintainers' + +@description('Required. Maintenance window for the maintenance configuration.') +param maintenanceWindow object + +@description('Conditional. The name of the parent managed cluster. Required if the template is used in a standalone deployment.') +param managedClusterName string + +@description('Required. Name of the maintenance configuration.') +param name string + +resource managedCluster 'Microsoft.ContainerService/managedClusters@2024-03-02-preview' existing = { + name: managedClusterName +} + +resource aksManagedAutoUpgradeSchedule 'Microsoft.ContainerService/managedClusters/maintenanceConfigurations@2023-10-01' = { + name: name + parent: managedCluster + properties: { + maintenanceWindow: maintenanceWindow + } +} diff --git a/avm/res/container-service/managed-cluster/maintenance-configurations/main.json b/avm/res/container-service/managed-cluster/maintenance-configurations/main.json new file mode 100644 index 0000000000..e8125e2b1f --- /dev/null +++ b/avm/res/container-service/managed-cluster/maintenance-configurations/main.json @@ -0,0 +1,44 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "metadata": { + "_generator": { + "name": "bicep", + "version": "0.27.1.19265", + "templateHash": "18344615743873477382" + }, + "name": "Azure Kubernetes Service (AKS) Managed Cluster Maintenance Configurations", + "description": "This module deploys an Azure Kubernetes Service (AKS) Managed Cluster Maintenance Configurations.", + "owner": "Azure/module-maintainers" + }, + "parameters": { + "maintenanceWindow": { + "type": "object", + "metadata": { + "description": "Required. Maintenance window for the maintenance configuration." + } + }, + "managedClusterName": { + "type": "string", + "metadata": { + "description": "Conditional. The name of the parent managed cluster. Required if the template is used in a standalone deployment." + } + }, + "name": { + "type": "string", + "metadata": { + "description": "Required. Name of the maintenance configuration." + } + } + }, + "resources": [ + { + "type": "Microsoft.ContainerService/managedClusters/maintenanceConfigurations", + "apiVersion": "2023-10-01", + "name": "[format('{0}/{1}', parameters('managedClusterName'), parameters('name'))]", + "properties": { + "maintenanceWindow": "[parameters('maintenanceWindow')]" + } + } + ] +} \ No newline at end of file