Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Truncate DCE/DCR to 44/64 chars in ARM, Bicep, Terraform... #922

Merged
merged 2 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AddonArmTemplate/FullAzureMonitorMetricsProfile.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)]",
vishiy marked this conversation as resolved.
Show resolved Hide resolved
"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'))]",
Expand Down
4 changes: 2 additions & 2 deletions AddonBicepTemplate/FullAzureMonitorMetricsProfile.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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}'
Expand Down
6 changes: 3 additions & 3 deletions AddonPolicyTemplate/AddonPolicyMetricsProfile.rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -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'))]",
Expand Down Expand Up @@ -548,4 +548,4 @@
}
}
}
}
}
5 changes: 2 additions & 3 deletions AddonTerraformTemplate/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -67,7 +67,6 @@ resource "azurerm_monitor_data_collection_rule" "dcr" {
destinations = ["MonitoringAccount1"]
}


data_sources {
prometheus_forwarder {
streams = ["Microsoft-PrometheusMetrics"]
Expand Down
4 changes: 2 additions & 2 deletions ArcArmTemplate/FullAzureMonitorMetricsProfile.json
Original file line number Diff line number Diff line change
Expand Up @@ -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'))]",
Expand Down
4 changes: 2 additions & 2 deletions ArcBicepTemplate/FullAzureMonitorMetricsProfile.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Loading