Skip to content

Commit

Permalink
update aks auto feature
Browse files Browse the repository at this point in the history
  • Loading branch information
zedy committed Jul 19, 2024
1 parent d0d0766 commit f7cc4e5
Show file tree
Hide file tree
Showing 6 changed files with 254 additions and 1 deletion.
19 changes: 19 additions & 0 deletions avm/res/container-service/managed-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
Expand Down Expand Up @@ -1449,6 +1450,7 @@ module managedCluster 'br/public:avm/res/container-service/managed-cluster:<vers
| [`adminUsername`](#parameter-adminusername) | string | Specifies the administrator username of Linux virtual machines. |
| [`agentPools`](#parameter-agentpools) | array | Define one or more secondary/additional agent pools. |
| [`authorizedIPRanges`](#parameter-authorizedipranges) | array | IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. This feature is not compatible with clusters that use Public IP Per Node, or clusters that are using a Basic Load Balancer. |
| [`automatic`](#parameter-automatic) | bool | Whether or not to use AKS Automatic mode. |
| [`autoScalerProfileBalanceSimilarNodeGroups`](#parameter-autoscalerprofilebalancesimilarnodegroups) | string | Specifies the balance of similar node groups for the auto-scaler of the AKS cluster. |
| [`autoScalerProfileExpander`](#parameter-autoscalerprofileexpander) | string | Specifies the expand strategy for the auto-scaler of the AKS cluster. |
| [`autoScalerProfileMaxEmptyBulkDelete`](#parameter-autoscalerprofilemaxemptybulkdelete) | string | Specifies the maximum empty bulk delete for the auto-scaler of the AKS cluster. |
Expand Down Expand Up @@ -1511,6 +1513,7 @@ module managedCluster 'br/public:avm/res/container-service/managed-cluster:<vers
| [`loadBalancerSku`](#parameter-loadbalancersku) | string | Specifies the sku of the load balancer used by the virtual machine scale sets used by nodepools. |
| [`location`](#parameter-location) | string | Specifies the location of AKS cluster. It picks up Resource Group's location by default. |
| [`lock`](#parameter-lock) | object | The lock settings of the service. |
| [`maintenanceWindow`](#parameter-maintenancewindow) | object | Maintenance window for the maintenance configuration. |
| [`managedIdentities`](#parameter-managedidentities) | object | The managed identity definition for this resource. Only one type of identity is supported: system-assigned or user-assigned, but not both. |
| [`managedOutboundIPCount`](#parameter-managedoutboundipcount) | int | Outbound IP Count for the Load balancer. |
| [`metricAnnotationsAllowList`](#parameter-metricannotationsallowlist) | string | A comma-separated list of Kubernetes cluster metrics annotations. |
Expand Down Expand Up @@ -2009,6 +2012,14 @@ IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. This feature is
- Required: No
- Type: array

### Parameter: `automatic`

Whether or not to use AKS Automatic mode.

- Required: No
- Type: bool
- Default: `False`

### Parameter: `autoScalerProfileBalanceSimilarNodeGroups`

Specifies the balance of similar node groups for the auto-scaler of the AKS cluster.
Expand Down Expand Up @@ -2860,6 +2871,14 @@ Specify the name of lock.
- Required: No
- Type: string

### Parameter: `maintenanceWindow`

Maintenance window for the maintenance configuration.

- Required: No
- Type: object
- Default: `{}`

### Parameter: `managedIdentities`

The managed identity definition for this resource. Only one type of identity is supported: system-assigned or user-assigned, but not both.
Expand Down
15 changes: 15 additions & 0 deletions avm/res/container-service/managed-cluster/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ param primaryAgentPoolProfile array
@description('Optional. Define one or more secondary/additional agent pools.')
param agentPools agentPoolType

@description('Optional. Whether or not to use AKS Automatic mode.')
param automatic bool = false

@description('Optional. Maintenance window for the maintenance configuration.')
param maintenanceWindow object = {}

@description('Optional. Specifies whether the cost analysis add-on is enabled or not. If Enabled `enableStorageProfileDiskCSIDriver` is set to true as it is needed.')
param costAnalysisEnabled bool = false

Expand Down Expand Up @@ -753,6 +759,15 @@ resource managedCluster 'Microsoft.ContainerService/managedClusters@2024-03-02-p
}
}

module managedCluster_maintenanceConfigurations 'maintenance-configurations/main.bicep' = if (automatic) {
name: '${uniqueString(deployment().name, location)}-ManagedCluster-MaintenanceConfigurations'
params: {
name: '${uniqueString(deployment().name, location)}-ManagedCluster-MaintenanceConfigurations'
maintenanceWindow: maintenanceWindow
managedClusterName: managedCluster.name
}
}

module managedCluster_agentPools 'agent-pool/main.bicep' = [
for (agentPool, index) in (agentPools ?? []): {
name: '${uniqueString(deployment().name, location)}-ManagedCluster-AgentPool-${index}'
Expand Down
86 changes: 85 additions & 1 deletion avm/res/container-service/managed-cluster/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"_generator": {
"name": "bicep",
"version": "0.27.1.19265",
"templateHash": "3755993319783141806"
"templateHash": "14986963864114287459"
},
"name": "Azure Kubernetes Service (AKS) Managed Clusters",
"description": "This module deploys an Azure Kubernetes Service (AKS) Managed Cluster.",
Expand Down Expand Up @@ -966,6 +966,20 @@
"description": "Optional. Define one or more secondary/additional agent pools."
}
},
"automatic": {
"type": "bool",
"defaultValue": false,
"metadata": {
"description": "Optional. Whether or not to use AKS Automatic mode."
}
},
"maintenanceWindow": {
"type": "object",
"defaultValue": {},
"metadata": {
"description": "Optional. Maintenance window for the maintenance configuration."
}
},
"costAnalysisEnabled": {
"type": "bool",
"defaultValue": false,
Expand Down Expand Up @@ -1791,6 +1805,76 @@
"managedCluster"
]
},
"managedCluster_maintenanceConfigurations": {
"condition": "[parameters('automatic')]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2022-09-01",
"name": "[format('{0}-ManagedCluster-MaintenanceConfigurations', uniqueString(deployment().name, parameters('location')))]",
"properties": {
"expressionEvaluationOptions": {
"scope": "inner"
},
"mode": "Incremental",
"parameters": {
"name": {
"value": "[format('{0}-ManagedCluster-MaintenanceConfigurations', uniqueString(deployment().name, parameters('location')))]"
},
"maintenanceWindow": {
"value": "[parameters('maintenanceWindow')]"
},
"managedClusterName": {
"value": "[parameters('name')]"
}
},
"template": {
"$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')]"
}
}
]
}
},
"dependsOn": [
"managedCluster"
]
},
"managedCluster_agentPools": {
"copy": {
"name": "managedCluster_agentPools",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Azure Kubernetes Service (AKS) Managed Cluster Maintenance Configurations `[Microsoft.ContainerService/managedClusters/maintenanceConfigurations]`

This module deploys an Azure Kubernetes Service (AKS) Managed Cluster Maintenance Configurations.

## Navigation

- [Resource Types](#Resource-Types)
- [Parameters](#Parameters)
- [Outputs](#Outputs)
- [Cross-referenced modules](#Cross-referenced-modules)
- [Data Collection](#Data-Collection)

## Resource Types

| Resource Type | API Version |
| :-- | :-- |
| `Microsoft.ContainerService/managedClusters/maintenanceConfigurations` | [2023-10-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ContainerService/2023-10-01/managedClusters/maintenanceConfigurations) |

## Parameters

**Required parameters**

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`maintenanceWindow`](#parameter-maintenancewindow) | object | Maintenance window for the maintenance configuration. |
| [`name`](#parameter-name) | string | Name of the maintenance configuration. |

**Conditional parameters**

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`managedClusterName`](#parameter-managedclustername) | string | The name of the parent managed cluster. Required if the template is used in a standalone deployment. |

### Parameter: `maintenanceWindow`

Maintenance window for the maintenance configuration.

- Required: Yes
- Type: object

### Parameter: `name`

Name of the maintenance configuration.

- Required: Yes
- Type: string

### Parameter: `managedClusterName`

The name of the parent managed cluster. Required if the template is used in a standalone deployment.

- Required: Yes
- Type: string


## Outputs

| Output | Type |
| :-- | :-- |

## Cross-referenced modules

_None_

## Data Collection

The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the [repository](https://aka.ms/avm/telemetry). There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at <https://go.microsoft.com/fwlink/?LinkID=824704>. 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.
Original file line number Diff line number Diff line change
@@ -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
}
}
Original file line number Diff line number Diff line change
@@ -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')]"
}
}
]
}

0 comments on commit f7cc4e5

Please sign in to comment.