-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor amw, dce, dcr, and aks-metrics-enable
- move metrics modules from ADO -> ARO-HCP - add default node/k8s recording rule group for all clusters with the Azure Monitoring Workspace - use bicep to deploy data collection endpoints and data collection rules - enable metrics within aks-cluster-base.bicep - remove unused make targets and pipeline steps
- Loading branch information
1 parent
e6425f1
commit 2f64286
Showing
13 changed files
with
382 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
param azureMonitorWorkspaceName string | ||
param azureMonitorWorkspaceLocation string | ||
param aksClusterName string | ||
param regionalResourceGroup string | ||
|
||
var dceName = take('MSProm-${azureMonitorWorkspaceLocation}-${aksClusterName}', 44) | ||
var dcrName = take('MSProm-${azureMonitorWorkspaceLocation}-${aksClusterName}', 44) | ||
|
||
resource amw 'microsoft.monitor/accounts@2021-06-03-preview' existing = { | ||
name: azureMonitorWorkspaceName | ||
scope: resourceGroup(regionalResourceGroup) | ||
} | ||
|
||
resource dce 'Microsoft.Insights/dataCollectionEndpoints@2022-06-01' = { | ||
name: dceName | ||
location: azureMonitorWorkspaceLocation | ||
kind: 'Linux' | ||
properties: {} | ||
} | ||
|
||
resource dcr 'Microsoft.Insights/dataCollectionRules@2022-06-01' = { | ||
name: dcrName | ||
location: azureMonitorWorkspaceLocation | ||
kind: 'Linux' | ||
properties: { | ||
dataCollectionEndpointId: dce.id | ||
dataFlows: [ | ||
{ | ||
destinations: [ | ||
'MonitoringAccount1' | ||
] | ||
streams: [ | ||
'Microsoft-PrometheusMetrics' | ||
] | ||
} | ||
] | ||
dataSources: { | ||
prometheusForwarder: [ | ||
{ | ||
name: 'PrometheusDataSource' | ||
streams: [ | ||
'Microsoft-PrometheusMetrics' | ||
] | ||
labelIncludeFilter: {} | ||
} | ||
] | ||
} | ||
description: 'DCR for Azure Monitor Metrics Profile (Managed Prometheus)' | ||
destinations: { | ||
monitoringAccounts: [ | ||
{ | ||
accountResourceId: amw.id | ||
name: 'MonitoringAccount1' | ||
} | ||
] | ||
} | ||
} | ||
} | ||
|
||
output dcrId string = dcr.id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
@description('Metrics global resource group name') | ||
param globalResourceGroup string | ||
|
||
@description('Metrics global MSI name') | ||
param msiName string | ||
|
||
@description('Metrics global Grafana name') | ||
param grafanaName string | ||
|
||
@description('Metrics region monitor name') | ||
param monitorName string = 'aro-hcp-monitor' | ||
|
||
resource monitor 'microsoft.monitor/accounts@2021-06-03-preview' = { | ||
name: monitorName | ||
location: resourceGroup().location | ||
} | ||
|
||
module defaultRuleGroups 'rules/defaultRecordingRuleGroups.bicep' ={ | ||
name: 'defaultRecordingRuleGroups' | ||
params: { | ||
azureMonitorWorkspaceLocation: resourceGroup().location | ||
azureMonitorWorkspaceName: monitorName | ||
regionalResourceGroup: resourceGroup().name | ||
} | ||
} | ||
// Assign the Monitoring Data Reader role to the Azure Managed Grafana system-assigned managed identity at the workspace scope | ||
var dataReader = 'b0d8363b-8ddd-447d-831f-62ca05bff136' | ||
|
||
resource msi 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' existing = { | ||
name: msiName | ||
scope: resourceGroup(globalResourceGroup) | ||
} | ||
|
||
resource grafana 'Microsoft.Dashboard/grafana@2023-09-01' existing = { | ||
name: grafanaName | ||
scope: resourceGroup(globalResourceGroup) | ||
} | ||
|
||
resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = { | ||
name: guid(monitor.id, grafana.id, dataReader) | ||
scope: monitor | ||
properties: { | ||
principalId: grafana.identity.principalId | ||
principalType: 'ServicePrincipal' | ||
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', dataReader) | ||
} | ||
} | ||
|
||
module prometheus 'rules/prometheusAlertingRules.bicep' = { | ||
name: 'prometheusAlertingRules' | ||
params: { | ||
azureMonitoring: monitor.id | ||
} | ||
} | ||
|
||
output msiId string = msi.id | ||
output grafanaId string = grafana.id | ||
output monitorId string = monitor.id |
Oops, something went wrong.