-
Notifications
You must be signed in to change notification settings - Fork 28
Add AKS-owned labels to Flex Nodes #275
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,13 @@ const ( | |
|
|
||
| // aksAADServerID is the Azure AD server application ID for AKS. | ||
| aksAADServerID = "6dae42f8-4368-4678-94ff-3960e28e3630" | ||
|
|
||
| managedNodeLabel = "kubernetes.azure.com/managed" | ||
| agentPoolNodeLabel = "kubernetes.azure.com/agentpool" | ||
| modeNodeLabel = "kubernetes.azure.com/mode" | ||
| nodePoolTypeNodeLabel = "kubernetes.azure.com/nodepool-type" | ||
| flexNodePoolType = "FlexNodes" | ||
| userNodeMode = "user" | ||
| ) | ||
|
|
||
| // ToAgentConfig converts a FlexNode Config to the shared agent library's | ||
|
|
@@ -44,7 +51,7 @@ func ToAgentConfig(cfg *Config, machineName string) *agentconfig.AgentConfig { | |
| Kubelet: agentconfig.AgentKubeletConfig{ | ||
| ApiServer: cfg.APIServerURL(), | ||
| NodeIP: cfg.Node.Kubelet.NodeIP, | ||
| Labels: cfg.Node.Labels, | ||
| Labels: kubeletNodeLabels(cfg), | ||
| RegisterWithTaints: cfg.Node.Taints, | ||
| Configuration: kubeletConfig, | ||
| }, | ||
|
|
@@ -162,6 +169,20 @@ func kubeReservedOrDefault(cfg *Config, maxPods int) map[string]string { | |
| return defaultKubeReserved(runtime.NumCPU(), hostTotalMemoryMi(), maxPods) | ||
| } | ||
|
|
||
| func kubeletNodeLabels(cfg *Config) map[string]string { | ||
| labels := maps.Clone(cfg.Node.Labels) | ||
| if labels == nil { | ||
| labels = make(map[string]string) | ||
| } | ||
|
|
||
| // Keep AKS-owned labels out of the custom labels sent in the Machine goal. | ||
| labels[managedNodeLabel] = "false" | ||
| labels[agentPoolNodeLabel] = cfg.Azure.TargetAgentPoolName | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does AKS RP side process nodes with this agent pool label? Because this could be overrode by user
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Synced offline, this label is immutable after node creation. |
||
| labels[modeNodeLabel] = userNodeMode | ||
| labels[nodePoolTypeNodeLabel] = flexNodePoolType | ||
| return labels | ||
| } | ||
|
|
||
| // ResolveMachineGoalState converts FlexNode config to the shared agent config | ||
| // and resolves the nspawn machine goal state. Bootstrap and preflight both use | ||
| // this helper so preflight validates the same sources that bootstrap consumes. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.