Command line arguments not properly handled - equal signs truncated
Is this a request for help?: NO
Is this an ISSUE or FEATURE REQUEST? ISSUE
What version of acs-engine?: 0.17.1 => 0.18.9 (both specifically tested)
Orchestrator and version (e.g. Kubernetes, DC/OS, Swarm) ACS-Engine 0.18.9 with Kubernetes
What happened: Secrets were removed from the API file and passed from command line; extract example below:
"servicePrincipalProfile": {
"clientId": "",
"secret": ""
}
}
acs-engine generate --output-directory "./_output/rack8s" --set servicePrincipalProfile.clientId='123a4321-c6eb-4b61-9d6f-7db123e14a7a',servicePrincipalProfile.secret='#msRock5!t=' ./clusterBuild-ACS_config-cardk8s.json
When this was done, the servicePrincipalClientSecret value in the generated azuredeploy.parameters.json has the '=' truncated out of it, failing without error. If the value has a leading '=', the following exception is thrown:
INFO[0000] Error returned by LoadContainerService: json: cannot unmarshal number into Go struct field ServicePrincipalProfile.secret of type string
FATA[0000] error loading API model in generateCmd: error parsing the api model: json: cannot unmarshal number into Go struct field ServicePrincipalProfile.secret of type string
If, on the other hand, the same values are placed in the API config JSON (with or without a leading '='), the correct value shows up in the ARM template parameters file.
What you expected to happen: I expected the command line parameters and those used in the API JSON to behave in the same manner.
How to reproduce it (as minimally and precisely as possible): Example API JSON:
{
"apiVersion": "vlabs",
"properties": {
"orchestratorProfile": {
"orchestratorType": "Kubernetes",
"orchestratorRelease": "1.10",
"kubernetesConfig": {
"networkPlugin": "kubenet",
"networkPolicy": "calico",
"privateCluster": {
"enabled": true
},
"enableRbac": true,
"maxPods": 80,
"addons": [
{
"name": "tiller",
"enabled": false
},
{
"name": "kubernetes-dashboard",
"enabled": false
}
]
}
},
"masterProfile": {
"count": 1,
"dnsPrefix": "rack8s",
"vmSize": "Standard_D2_v2",
"osDiskSizeGB": 200,
"vnetSubnetId": "/subscriptions/123412341234/resourceGroups/cardinalsolutionsgroup-network/providers/Microsoft.Network/virtualNetworks/k8s-vnet/subnets/k8s-subnet",
"firstConsecutiveStaticIP": "10.1.0.100",
"vnetCidr": "10.1.0.0/16"
},
"agentPoolProfiles": [
{
"name": "linuxpool1",
"count": 2,
"vmSize": "Standard_D2_v2",
"availabilityProfile": "AvailabilitySet",
"osDiskSizeGB": 200,
"vnetSubnetId": "/subscriptions/123412341234/resourceGroups/jbh-network/providers/Microsoft.Network/virtualNetworks/k8s-vnet/subnets/k8s-subnet"
}
],
"linuxProfile": {
"adminUsername": "",
"ssh": {
"publicKeys": [
{
"keyData": ""
}
]
}
},
"servicePrincipalProfile": {
"clientId": "",
"secret": ""
}
}
}
Example command line input:
acs-engine generate --output-directory "./_output/rack8s" --set servicePrincipalProfile.clientId='123a1238-c6eb-4b61-9d6f-7db6f1e14123',servicePrincipalProfile.secret='=MsR0ck5!t=',aadProfile.serverAppID='123a1238-c6eb-4b61-9d6f-7db6f1e14123',aadProfile.clientAppID='123a1238-c6eb-4b61-9d6f-7db6f1e14123',aadProfile.tenantID='123a1238-c6eb-4b61-9d6f-7db6f1e14123',linuxProfile.adminUsername='cardinal',linuxProfile.ssh.publicKeys[0].keyData='ssh-rsa AAAAB3N123412341234123412341234123412341213412341234rElF9/uV2/+S6itZ' ./clusterBuild-ACS_config-cardk8s.json
When the above command is run, it bombs on unmarshalling (due to the leading '='). If the leading '=' is removed, the resulting servicePrincipalClientSecret will be MsR0ck5!t not MsR0ck5!t= as expected. If these values are removed from the command line and placed in the API JSON, both =MsR0ck5!t= and MsR0ck5!t= work as expected.
Anything else we need to know: This is relevant because service principal secrets, as generated by the Azure Portal, often have trailing '=' signs.
/assign @jcorioland
Related to #3355
@jcorioland any update on this? We have been able to do deployments with our key in file, however I'd really like to remove it and use env vars instead.
@flyboarder nope sorry, I did not have time to look in details.
@flyboarder @raycrawford I've just committed a fix on my forked repository - if you want to test it right now, you just need to compile acs-engine from the bug/set-flag-sshkey branch. I need to do more validation testing before doing the PR, but will try to do it asap. @CecileRobertMichon fyi.