Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Update prometheus extension with new cse naming convention (#3018)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritazh authored and CecileRobertMichon committed May 22, 2018
1 parent fc88383 commit 1cba33e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,9 @@ DS_NAME=prometheus1

PROM_URL=http://monitoring-prometheus-server

# When RBAC is enabled, need to grant permission to tiller
kubectl create clusterrolebinding tiller-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default

install_helm "$RAW_PROMETHEUS_CHART_VALS"
wait_for_tiller
if [[ $? -ne 0 ]]; then
Expand Down
5 changes: 4 additions & 1 deletion extensions/prometheus-grafana-k8s/v1/template-link.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "Microsoft.Resources/deployments",
"apiVersion": "[variables('apiVersionLinkDefault')]",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', EXTENSION_TARGET_VM_NAME_PREFIX, copyIndex(EXTENSION_LOOP_OFFSET), '/extensions/cse', copyIndex(EXTENSION_LOOP_OFFSET))]"
"[concat('Microsoft.Compute/virtualMachines/', EXTENSION_TARGET_VM_NAME_PREFIX, copyIndex(EXTENSION_LOOP_OFFSET), '/extensions/cse', '-EXTENSION_TARGET_VM_TYPE-', copyIndex(EXTENSION_LOOP_OFFSET))]"
],
"copy": {
"count": "EXTENSION_LOOP_COUNT",
Expand All @@ -25,6 +25,9 @@
"targetVMName": {
"value": "[concat(EXTENSION_TARGET_VM_NAME_PREFIX, copyIndex(EXTENSION_LOOP_OFFSET))]"
},
"targetVMType": {
"value": "EXTENSION_TARGET_VM_TYPE"
},
"extensionParameters": {
"value": "EXTENSION_PARAMETERS_REPLACE"
},
Expand Down
9 changes: 8 additions & 1 deletion extensions/prometheus-grafana-k8s/v1/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
"description": "Name of the vm to run the "
}
},
"targetVMType":{
"type": "string",
"minLength": 1,
"metadata": {
"description": "Type of the vm to run the extension: master or agent "
}
},
"extensionParameters": {
"type": "securestring",
"minLength": 0,
Expand All @@ -47,7 +54,7 @@
"dependsOn": [],
"location": "[resourceGroup().location]",
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(parameters('targetVMName'),'/cse', parameters('vmIndex'))]",
"name": "[concat(parameters('targetVMName'),'/cse', '-', parameters('targetVMType'), '-', parameters('vmIndex'))]",
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
Expand Down
6 changes: 3 additions & 3 deletions pkg/acsengine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -2866,10 +2866,10 @@ func internalGetPoolLinkedTemplateText(extTargetVMNamePrefix, orchestratorType,
if e != nil {
return "", e
}
if strings.Contains(extTargetVMNamePrefix, "master") {
dta = strings.Replace(dta, "EXTENSION_TARGET_VM_TYPE", "master", -1)
} else {
if strings.Contains(extTargetVMNamePrefix, "agent") {
dta = strings.Replace(dta, "EXTENSION_TARGET_VM_TYPE", "agent", -1)
} else {
dta = strings.Replace(dta, "EXTENSION_TARGET_VM_TYPE", "master", -1)
}
extensionsParameterReference := fmt.Sprintf("[parameters('%sParameters')]", extensionProfile.Name)
dta = strings.Replace(dta, "EXTENSION_PARAMETERS_REPLACE", extensionsParameterReference, -1)
Expand Down

0 comments on commit 1cba33e

Please sign in to comment.