-
Notifications
You must be signed in to change notification settings - Fork 558
feat(ext): Add choco extension with param support #2707
Conversation
@sylr is this PR ready for review? Or does this mean that the code is not ready:
? |
@CecileRobertMichon there is still the one manual adjustment that needs to be made, i can try to fix this myself but was hoping someone could point me to where that line is being generated? Thanks so much! |
This is the place where the Windows agent custom script extension name is set:
Not sure how that has to do with your PR and why you need to change it though? If you are going to change, please change it to something like
to be consistent with #2713 |
If the artifact has only the following line: "name": "[concat(variables('windowspool1VMNamePrefix'), copyIndex(variables('windowspool1Offset')), '/cse')]", Then the choco installation won't install saying can't find cse extension. This is why I need to change the line to: "name": "[concat(variables('windowspool1VMNamePrefix'), copyIndex(variables('windowspool1Offset')),'/cse', copyIndex(variables('windowspool1Offset')))]", Thanks for pointing me to the line, i'll send an updated P.R. shortly! Appreciate your guidance as always! |
@sylus can please share the exact error message you're seeing? It's curious that the choco extension relies on the CSE |
@CecileRobertMichon here you go, please let me know if can provide any more info. ^_^ ❯ az group deployment create --name "acs-default" \
--resource-group "acs-default" \
--template-file "./_output/k8s-acs-default/azuredeploy.json" \
--parameters "./_output/k8s-acs-default/azuredeploy.parameters.json"
Deployment template validation failed: 'The resource 'Microsoft.Compute/virtualMachines/42410k8s9010/extensions/cse0' is not defined in the template. Please see https://aka.ms/arm-template for usage details.'. With the mentioned fix everything then deploys correctly with choco installing the specified package. Here was the base cluster def I used: {
"apiVersion": "vlabs",
"properties": {
"orchestratorProfile": {
"orchestratorType": "Kubernetes",
"orchestratorRelease": "1.9",
"orchestratorVersion": "1.9.6",
"kubernetesConfig": {
"kubernetesImageBase": "k8s-gcrio.azureedge.net/",
"addons": [
{
"name": "tiller",
"enabled" : true
},
{
"name": "kubernetes-dashboard",
"enabled" : true
},
{
"name": "rescheduler",
"enabled" : true
}
]
}
},
"masterProfile": {
"count": 1,
"dnsPrefix": "k8s-acs-default",
"vmSize": "Standard_D4s_v3",
"OSDiskSizeGB": 200
},
"agentPoolProfiles": [
{
"name": "linuxpool1",
"count": 1,
"customNodeLabels": {
"os": "linux"
},
"vmSize": "Standard_D4s_v3",
"OSDiskSizeGB": 200,
"storageProfile" : "ManagedDisks",
"availabilityProfile": "AvailabilitySet"
},
{
"name": "windowspool1",
"count": 1,
"osType": "Windows",
"customNodeLabels": {
"os": "windows"
},
"vmSize": "Standard_D4s_v3",
"OSDiskSizeGB": 200,
"storageProfile" : "ManagedDisks",
"availabilityProfile": "AvailabilitySet",
"extensions": [
{
"name": "choco"
}
]
}
],
"linuxProfile": {
"adminUsername": "azureuser",
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa XXXX"
}
]
}
},
"extensionProfiles": [
{
"name": "choco",
"version": "v1",
"extensionParameters": "microsoft-build-tools",
"rootURL": "https://raw.githubusercontent.com/govcloud/acs-engine/extension-choco/"
}
],
"windowsProfile": {
"adminUsername": "azureuser",
"adminPassword": "XXXX",
"imageVersion": "2016.127.20180220",
"WindowsImageSourceUrl": ""
},
"servicePrincipalProfile": {
"clientId": "XXXX",
"secret": "XXXX"
}
}
} |
"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))]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what is causing your error, you need to make sure that the name of the VM extension is the same as it is defined in parts\k8s\kuberneteswinagentresourcesvmas.t
extensions/choco/v1/template.json
Outdated
"dependsOn": [], | ||
"location": "[resourceGroup().location]", | ||
"type": "Microsoft.Compute/virtualMachines/extensions", | ||
"name": "[concat(parameters('targetVMName'),'/cse', parameters('vmIndex'))]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be named something more specific to chocolatey not to be confused with the already existing CSE
@sylus what is the status of this PR? |
Ah thanks for reminding me, I will take a look at this over the weekend and have it rdy to merge given for fix before the start of Monday! @CecileRobertMichon |
@CecileRobertMichon thanks a bunch for your help I made the correction by calling the correct template, and everything works now without any manual changes needed. Thanks a bunch! This is ready to review from my end. ^_^ |
Deployed a test cluster w/ the extension at https://jenkins.azure-containers.io/view/acs-engine%20ad-hoc/job/k8s-deployment/102 @JiangtianLi could you kindly review this when you have time? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thanks @sylus!
What this PR does / why we need it: Adds a Windows extension example; in this case an extension which installs packages passed as parameters via the Choco package manager. Very similar to how the one that works in DevTestLabs.
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #2709Special notes for your reviewer: Confirmed and tested with microsoft-build-tools and it provisioned by Windows with the package.
I tested this on a generated cluster definition on top of v0.15.2
I did have to fix an entry in azuredeploy.json to get everything to work so think still need a fix in code.
Should be this instead:
If applicable:
Release note: