From 09cea4f4e3e4e1799c9335e227e22f265b802306 Mon Sep 17 00:00:00 2001 From: Kaveesh Dubey Date: Mon, 24 Jun 2024 12:31:54 -0700 Subject: [PATCH 1/2] fix: Truncate DCE/DCR to 44/64 chars in ARM, Bicep, Terraform... --- AddonArmTemplate/FullAzureMonitorMetricsProfile.json | 4 ++-- AddonBicepTemplate/FullAzureMonitorMetricsProfile.bicep | 4 ++-- AddonPolicyTemplate/AddonPolicyMetricsProfile.rules.json | 6 +++--- AddonTerraformTemplate/main.tf | 5 ++--- ArcArmTemplate/FullAzureMonitorMetricsProfile.json | 4 ++-- ArcBicepTemplate/FullAzureMonitorMetricsProfile.bicep | 4 ++-- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/AddonArmTemplate/FullAzureMonitorMetricsProfile.json b/AddonArmTemplate/FullAzureMonitorMetricsProfile.json index 5d2ad7842..67213023a 100644 --- a/AddonArmTemplate/FullAzureMonitorMetricsProfile.json +++ b/AddonArmTemplate/FullAzureMonitorMetricsProfile.json @@ -52,8 +52,8 @@ "clusterSubscriptionId": "[split(parameters('clusterResourceId'),'/')[2]]", "clusterResourceGroup": "[split(parameters('clusterResourceId'),'/')[4]]", "clusterName": "[split(parameters('clusterResourceId'),'/')[8]]", - "dceName": "[Concat('MSProm', '-', parameters('azureMonitorWorkspaceLocation'), '-', variables('clusterName'))]", - "dcrName": "[Concat('MSProm', '-', parameters('azureMonitorWorkspaceLocation'), '-', variables('clusterName'))]", + "dceName": "[substring(Concat('MSProm', '-', parameters('azureMonitorWorkspaceLocation'), '-', variables('clusterName')), 0, 44)]", + "dcrName": "[substring(Concat('MSProm', '-', parameters('azureMonitorWorkspaceLocation'), '-', variables('clusterName')), 0, 64)]", "dcraName": "[Concat('MSProm', '-', parameters('clusterLocation'), '-', variables('clusterName'))]", "nodeRecordingRuleGroup": "NodeRecordingRulesRuleGroup-", "nodeRecordingRuleGroupName": "[concat(variables('nodeRecordingRuleGroup'), variables('clusterName'))]", diff --git a/AddonBicepTemplate/FullAzureMonitorMetricsProfile.bicep b/AddonBicepTemplate/FullAzureMonitorMetricsProfile.bicep index 5431f27aa..82f70b16a 100644 --- a/AddonBicepTemplate/FullAzureMonitorMetricsProfile.bicep +++ b/AddonBicepTemplate/FullAzureMonitorMetricsProfile.bicep @@ -17,8 +17,8 @@ var azureMonitorWorkspaceSubscriptionId = split(azureMonitorWorkspaceResourceId, var clusterSubscriptionId = split(clusterResourceId, '/')[2] var clusterResourceGroup = split(clusterResourceId, '/')[4] var clusterName = split(clusterResourceId, '/')[8] -var dceName = 'MSProm-${azureMonitorWorkspaceLocation}-${clusterName}' -var dcrName = 'MSProm-${azureMonitorWorkspaceLocation}-${clusterName}' +var dceName = substring('MSProm-${azureMonitorWorkspaceLocation}-${clusterName}', 0, 44) +var dcrName = substring('MSProm-${azureMonitorWorkspaceLocation}-${clusterName}', 0, 64) var dcraName = 'MSProm-${clusterLocation}-${clusterName}' var nodeRecordingRuleGroupPrefix = 'NodeRecordingRulesRuleGroup-' var nodeRecordingRuleGroupName = '${nodeRecordingRuleGroupPrefix}${clusterName}' diff --git a/AddonPolicyTemplate/AddonPolicyMetricsProfile.rules.json b/AddonPolicyTemplate/AddonPolicyMetricsProfile.rules.json index 28eea7922..358ecb985 100644 --- a/AddonPolicyTemplate/AddonPolicyMetricsProfile.rules.json +++ b/AddonPolicyTemplate/AddonPolicyMetricsProfile.rules.json @@ -51,8 +51,8 @@ "clusterSubscriptionId": "[split(parameters('clusterResourceId'),'/')[2]]", "clusterResourceGroup": "[split(parameters('clusterResourceId'),'/')[4]]", "clusterName": "[split(parameters('clusterResourceId'),'/')[8]]", - "dceName": "[Concat('MSProm', '-', parameters('azureMonitorWorkspaceLocation'), '-', variables('clusterName'))]", - "dcrName": "[Concat('MSProm', '-', parameters('azureMonitorWorkspaceLocation'), '-', variables('clusterName'))]", + "dceName": "[substring(Concat('MSProm', '-', parameters('azureMonitorWorkspaceLocation'), '-', variables('clusterName')), 0, 44)]", + "dcrName": "[substring(Concat('MSProm', '-', parameters('azureMonitorWorkspaceLocation'), '-', variables('clusterName')), 0, 64)]", "dcraName": "[Concat('MSProm', '-', parameters('clusterLocation'), '-', variables('clusterName'))]", "nodeRecordingRuleGroup": "NodeRecordingRulesRuleGroup-", "nodeRecordingRuleGroupName": "[concat(variables('nodeRecordingRuleGroup'), variables('clusterName'))]", @@ -548,4 +548,4 @@ } } } -} +} \ No newline at end of file diff --git a/AddonTerraformTemplate/main.tf b/AddonTerraformTemplate/main.tf index b3593d983..b96d79376 100644 --- a/AddonTerraformTemplate/main.tf +++ b/AddonTerraformTemplate/main.tf @@ -42,14 +42,14 @@ resource "azurerm_monitor_workspace" "amw" { } resource "azurerm_monitor_data_collection_endpoint" "dce" { - name = "MSProm-${azurerm_resource_group.rg.location}-${var.cluster_name}" + name = substr("MSProm-${azurerm_resource_group.rg.location}-${var.cluster_name}", 0, 44) resource_group_name = azurerm_resource_group.rg.name location = azurerm_resource_group.rg.location kind = "Linux" } resource "azurerm_monitor_data_collection_rule" "dcr" { - name = "MSProm-${azurerm_resource_group.rg.location}-${var.cluster_name}" + name = substr("MSProm-${azurerm_resource_group.rg.location}-${var.cluster_name}", 0, 64) resource_group_name = azurerm_resource_group.rg.name location = azurerm_resource_group.rg.location data_collection_endpoint_id = azurerm_monitor_data_collection_endpoint.dce.id @@ -67,7 +67,6 @@ resource "azurerm_monitor_data_collection_rule" "dcr" { destinations = ["MonitoringAccount1"] } - data_sources { prometheus_forwarder { streams = ["Microsoft-PrometheusMetrics"] diff --git a/ArcArmTemplate/FullAzureMonitorMetricsProfile.json b/ArcArmTemplate/FullAzureMonitorMetricsProfile.json index 5d7b96d26..84d1c10e8 100644 --- a/ArcArmTemplate/FullAzureMonitorMetricsProfile.json +++ b/ArcArmTemplate/FullAzureMonitorMetricsProfile.json @@ -51,8 +51,8 @@ "clusterSubscriptionId": "[split(parameters('clusterResourceId'),'/')[2]]", "clusterResourceGroup": "[split(parameters('clusterResourceId'),'/')[4]]", "clusterName": "[split(parameters('clusterResourceId'),'/')[8]]", - "dceName": "[Concat('MSProm', '-', parameters('azureMonitorWorkspaceLocation'), '-', variables('clusterName'))]", - "dcrName": "[Concat('MSProm', '-', parameters('azureMonitorWorkspaceLocation'), '-', variables('clusterName'))]", + "dceName": "[substring(Concat('MSProm', '-', parameters('azureMonitorWorkspaceLocation'), '-', variables('clusterName')), 0, 44)]", + "dcrName": "[substring(Concat('MSProm', '-', parameters('azureMonitorWorkspaceLocation'), '-', variables('clusterName')), 0, 64)]", "dcraName": "[Concat('MSProm', '-', parameters('clusterLocation'), '-', variables('clusterName'))]", "nodeRecordingRuleGroup": "NodeRecordingRulesRuleGroup-", "nodeRecordingRuleGroupName": "[concat(variables('nodeRecordingRuleGroup'), variables('clusterName'))]", diff --git a/ArcBicepTemplate/FullAzureMonitorMetricsProfile.bicep b/ArcBicepTemplate/FullAzureMonitorMetricsProfile.bicep index 132b03f45..34877f6d4 100644 --- a/ArcBicepTemplate/FullAzureMonitorMetricsProfile.bicep +++ b/ArcBicepTemplate/FullAzureMonitorMetricsProfile.bicep @@ -17,8 +17,8 @@ var azureMonitorWorkspaceSubscriptionId = split(azureMonitorWorkspaceResourceId, var clusterSubscriptionId = split(clusterResourceId, '/')[2] var clusterResourceGroup = split(clusterResourceId, '/')[4] var clusterName = split(clusterResourceId, '/')[8] -var dceName = 'MSProm-${azureMonitorWorkspaceLocation}-${clusterName}' -var dcrName = 'MSProm-${azureMonitorWorkspaceLocation}-${clusterName}' +var dceName = substring('MSProm-${azureMonitorWorkspaceLocation}-${clusterName}', 0, 44) +var dcrName = substring('MSProm-${azureMonitorWorkspaceLocation}-${clusterName}', 0, 64) var dcraName = 'MSProm-${clusterLocation}-${clusterName}' var nodeRecordingRuleGroup_var = 'NodeRecordingRulesRuleGroup-' var nodeRecordingRuleGroupName = concat(nodeRecordingRuleGroup_var, clusterName) From 76a9c8143aaadb1f2ff5b9026a5c59076edbc11b Mon Sep 17 00:00:00 2001 From: Kaveesh Dubey Date: Mon, 24 Jun 2024 12:33:52 -0700 Subject: [PATCH 2/2] release notes --- RELEASENOTES.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index f9eb97ccc..ec992a357 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -1,5 +1,8 @@ # Azure Monitor Metrics for AKS clusters +## Pending +* fix: Truncate DCE/DCR to 44/64 chars in ARM, Bicep, Terraform... - https://github.com/Azure/prometheus-collector/pull/922 + ## Release 06-12-2024 * Target Allocator Chart update to add Tls secret to the config reader sidecar container