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

Make GetNodeBootstrappingPayload return base64 encoded string. #412

Conversation

yizhang4321
Copy link
Member

Updated GetAgentKubernetesLabels and GetAgentKubernetesLabelsDeprecated in the function map to generate the resource group names themselves so they don't need to take it from the nodecustomdata.yml. This simplifies the logic for nodecustomdata.yml: we no longer need to "concat" substrings, which contains a variables('labelResourceGroup') in the middle. We can now directly take nodecustomdata.yaml as a string in our code.

… non-ARM case.

Updated GetAgentKubernetesLabels and GetAgentKubernetesLabelsDeprecated in the function map to generate the resource group names themselves so they don't need to take it from the nodecustomdata.yml. This simplifies the logic for nodecustomdata.yml: we no longer need to "concat" substrings, which contains a variables('labelResourceGroup') in the middle. We can now directly take nodecustomdata.yaml as a string in our code.
pkg/agent/baker.go Outdated Show resolved Hide resolved
pkg/agent/baker.go Outdated Show resolved Hide resolved
pkg/agent/baker.go Outdated Show resolved Hide resolved
Windows CSE isn't in AgentBaker yet, so the code there is not worling and isn't worth changing.
…m data.

Because both non-ARM and ARM case use base64 encoding of the custom data, they can be unified into one.
@yizhang4321 yizhang4321 changed the title Add a Get...PayloadNonARM that provides custom data for non-ARM case. Make GetNodeBootstrappingPayload return base64 encoded string. Oct 27, 2020
@@ -48,11 +51,11 @@ func (t *TemplateGenerator) getLinuxNodeCustomDataJSONObject(config *datamodel.N
panic(e)
}

return fmt.Sprintf("{\"customData\": \"[base64(concat('%s'))]\"}", str)
return fmt.Sprintf("{\"customData\": \"%s\"}", str)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alternatively, we can do base64.StdEncoding.EncodeToString([]byte(str)) here and save the change from caller side.

…<= 62.

This is for parity with aks-engine's value:
[if(or(or(endsWith(variables('truncatedResourceGroup'), '-'), endsWith(variables('truncatedResourceGroup'), '_')), endsWith(variables('truncatedResourceGroup'), '.')), concat(take(variables('truncatedResourceGroup'), 62), 'z'), variables('truncatedResourceGroup'))]

I converted that to code incorrectly before.
@xuto2
Copy link

xuto2 commented Oct 28, 2020

/lgtm

@yizhang4321 yizhang4321 merged commit 6926e6a into Azure:master Oct 28, 2020
@yizhang4321 yizhang4321 deleted the yizhang4321/ProvideNonARMTemplateCustomData branch October 28, 2020 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants