func getParameters()

in pkg/agent/params.go [14:77]


func getParameters(config *datamodel.NodeBootstrappingConfiguration) paramsMap {
	cs := config.ContainerService
	profile := config.AgentPoolProfile
	properties := cs.Properties
	parametersMap := paramsMap{}
	cloudSpecConfig := config.CloudSpecConfig

	linuxProfile := properties.LinuxProfile
	if linuxProfile != nil {
		addValue(parametersMap, "linuxAdminUsername", linuxProfile.AdminUsername)
	}
	// masterEndpointDNSNamePrefix is the basis for storage account creation across dcos, swarm, and k8s
	// looks like masterEndpointDNSNamePrefix is only used in windows cse kubeconfig cluster/context name and it's not
	// required since linux uses static value for that.
	if properties.HostedMasterProfile != nil {
		// Agents only, use cluster DNS prefix
		switch {
		case properties.HostedMasterProfile.DNSPrefix != "":
			addValue(parametersMap, "masterEndpointDNSNamePrefix", properties.HostedMasterProfile.DNSPrefix)
		case properties.HostedMasterProfile.FQDNSubdomain != "":
			addValue(parametersMap, "masterEndpointDNSNamePrefix", properties.HostedMasterProfile.FQDNSubdomain)
		default:
			// should not happen but just in case, we fill in value "localcluster" just like linux
			addValue(parametersMap, "masterEndpointDNSNamePrefix", "localcluster")
		}
	}
	if properties.HostedMasterProfile != nil {
		addValue(parametersMap, "vnetCidr", DefaultVNETCIDR)
	}

	// Kubernetes Parameters
	if properties.OrchestratorProfile.IsKubernetes() {
		assignKubernetesParameters(properties, parametersMap, cloudSpecConfig, config.K8sComponents, config)
		if profile != nil {
			assignKubernetesParametersFromAgentProfile(profile, parametersMap, config)
		}
	}

	// Agent parameters
	// We should always use profile to remove the dependency on cs.Properties.AgentPoolProfiles since RP always set
	// config.AgentPoolProfile to the target agent pool
	if len(profile.VnetCidrs) != 0 {
		// For AKS (properties.HostedMasterProfile != nil), set vnetCidr if a custom vnet is used so the address space can be
		// added into the ExceptionList of Windows nodes. Otherwise, the default value `10.0.0.0/8` will
		// be added into the ExceptionList and it does not work if users use other ip address ranges.
		// All agent pools in the same cluster share a same VnetCidrs
		addValue(parametersMap, "vnetCidr", strings.Join(profile.VnetCidrs, ","))
	}

	if properties.CustomConfiguration != nil && properties.CustomConfiguration.KubernetesConfigurations != nil {
		if configuration, ok := properties.CustomConfiguration.KubernetesConfigurations["kubelet"]; ok && configuration.DownloadURL != nil {
			addValue(parametersMap, "customKubeBinaryURL", configuration.DownloadURL)
		}
	}

	// Windows parameters
	if properties.HasWindows() {
		addValue(parametersMap, "windowsDockerVersion", properties.WindowsProfile.GetWindowsDockerVersion())
		addValue(parametersMap, "defaultContainerdWindowsSandboxIsolation", properties.WindowsProfile.GetDefaultContainerdWindowsSandboxIsolation())
		addValue(parametersMap, "containerdWindowsRuntimeHandlers", properties.WindowsProfile.GetContainerdWindowsRuntimeHandlers())
	}

	return parametersMap
}