Skip to content

Commit 88da96c

Browse files
committed
Updating azure capz-monitoring AKS terraform config
Signed-off-by: Mark Rossetti <[email protected]>
1 parent f6458ce commit 88da96c

File tree

4 files changed

+48
-18
lines changed

4 files changed

+48
-18
lines changed

infra/azure/terraform/capz/capz-monitoring/main.tf

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,22 @@ resource "azurerm_role_assignment" "monitoring_reader" {
5858
depends_on = [ azurerm_user_assigned_identity.capz_monitoring_user_identity ]
5959
}
6060

61+
# lookups for AKS-created user assigned identities and DNS zone (do not create new identities)
62+
data "azurerm_user_assigned_identity" "aks_akv" {
63+
name = "azurekeyvaultsecretsprovider-capz-monitoring"
64+
resource_group_name = "MC_capz-monitoring_capz-monitoring_eastus"
65+
}
66+
67+
data "azurerm_user_assigned_identity" "aks_webapp" {
68+
name = "webapprouting-capz-monitoring"
69+
resource_group_name = "MC_capz-monitoring_capz-monitoring_eastus"
70+
}
71+
72+
data "azurerm_dns_zone" "capz_monitoring" {
73+
name = "capz-monitoring.org"
74+
resource_group_name = "capz-monitoring"
75+
}
76+
6177
resource "azurerm_kubernetes_cluster" "capz-monitoring" {
6278
dns_prefix = local.computed_dns_prefix
6379
location = var.location
@@ -82,15 +98,39 @@ resource "azurerm_kubernetes_cluster" "capz-monitoring" {
8298
azurerm_user_assigned_identity.capz_monitoring_user_identity.id
8399
]
84100
}
101+
102+
# keep AKS addon-managed identities and the DNS zone referenced via data sources
103+
key_vault_secrets_provider {
104+
secret_rotation_enabled = false
105+
secret_rotation_interval = "2m"
106+
107+
# secret_identity is computed by the AKS provider; do not set it here.
108+
}
109+
110+
web_app_routing {
111+
default_nginx_controller = "AnnotationControlled"
112+
dns_zone_ids = [
113+
data.azurerm_dns_zone.capz_monitoring.id,
114+
]
115+
116+
# web_app_routing_identity is created/linked by AKS and is computed; do not set it here.
117+
}
118+
85119
default_node_pool {
86120
name = "nodepool1"
87-
node_count = 1
121+
node_count = 3
88122
vm_size = "Standard_DS2_v2"
123+
124+
upgrade_settings {
125+
drain_timeout_in_minutes = 0
126+
max_surge = "10%"
127+
node_soak_duration_in_minutes = 0
128+
}
89129
}
90130

91131
lifecycle {
92132
ignore_changes = [
93-
linux_profile,
133+
linux_profile
94134
]
95135
}
96136
}

infra/azure/terraform/capz/identities/main.tf

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,6 @@ resource "azurerm_role_assignment" "gmsa_role_assignment" {
7777
depends_on = [azurerm_user_assigned_identity.domain_vm_identity]
7878
}
7979

80-
resource "azurerm_role_assignment" "cloud_provider_sub_contributor" {
81-
principal_id = azurerm_user_assigned_identity.cloud_provider_user_identity.principal_id
82-
role_definition_name = "Contributor"
83-
scope = "/subscriptions/${var.subscription_id}"
84-
}
85-
86-
resource "azurerm_role_assignment" "acr_pull" {
87-
principal_id = azurerm_user_assigned_identity.cloud_provider_user_identity.principal_id
88-
role_definition_name = "AcrPull"
89-
scope = var.container_registry_scope
90-
}
91-
9280
output "cloud_provider_user_identity_id" {
9381
value = azurerm_user_assigned_identity.cloud_provider_user_identity.principal_id
9482
}

infra/azure/terraform/capz/main.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ resource "azurerm_resource_provider_registration" "provider-k8s-config" {
3737
}
3838
}
3939

40-
resource "azurerm_resource_provider_registration" "provider-container-service" {
41-
name = "Microsoft.ContainerService"
42-
}
43-
4440
resource "azurerm_marketplace_agreement" "traefik-agreement" {
4541
publisher = "containous"
4642
offer = "traefik-proxy"

infra/azure/terraform/capz/role-assignments/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ resource "azurerm_role_assignment" "acr_pull_private" {
7474
scope = var.e2eprivate_registry_scope
7575
}
7676

77+
resource "azurerm_role_assignment" "acr_pull_cloud_provider" {
78+
principal_id = var.cloud_provider_user_identity_id
79+
role_definition_name = "AcrPull"
80+
scope = var.container_registry_scope
81+
}
82+
7783
resource "azurerm_role_definition" "custom_role" {
7884
name = "WriteAccessOnly"
7985
scope = "/subscriptions/${var.subscription_id}"

0 commit comments

Comments
 (0)