func()

in pkg/api/defaults.go [745:823]


func (p *Properties) setAgentProfileDefaults(isUpgrade, isScale bool) {
	for i, profile := range p.AgentPoolProfiles {
		if profile.AvailabilityProfile == "" {
			profile.AvailabilityProfile = VirtualMachineScaleSets
		}
		if profile.AvailabilityProfile == VirtualMachineScaleSets {
			if profile.ScaleSetEvictionPolicy == "" && (profile.ScaleSetPriority == ScaleSetPriorityLow || profile.ScaleSetPriority == ScaleSetPrioritySpot) {
				profile.ScaleSetEvictionPolicy = ScaleSetEvictionPolicyDelete
			}

			if profile.ScaleSetPriority == ScaleSetPrioritySpot && profile.SpotMaxPrice == nil {
				var maximumValueFlag float64 = -1
				profile.SpotMaxPrice = &maximumValueFlag
			}

			if profile.VMSSOverProvisioningEnabled == nil {
				profile.VMSSOverProvisioningEnabled = to.BoolPtr(DefaultVMSSOverProvisioningEnabled && !isUpgrade && !isScale)
			}

			profile.VMSSName = p.GetAgentVMPrefix(profile, i)
		}
		// set default OSType to Linux
		if profile.OSType == "" {
			profile.OSType = Linux
		}

		// Update default fault domain value for Azure Stack
		if p.IsAzureStackCloud() && profile.PlatformFaultDomainCount == nil {
			profile.PlatformFaultDomainCount = to.IntPtr(DefaultAzureStackFaultDomainCount)
		}
		if profile.PlatformUpdateDomainCount == nil {
			profile.PlatformUpdateDomainCount = to.IntPtr(3)
		}

		// Accelerated Networking is supported on most general purpose and compute-optimized instance sizes with 2 or more vCPUs.
		// These supported series are: D/DSv2 and F/Fs // All the others are not supported
		// On instances that support hyperthreading, Accelerated Networking is supported on VM instances with 4 or more vCPUs.
		// Supported series are: D/DSv3, E/ESv3, Fsv2, and Ms/Mms.
		if profile.AcceleratedNetworkingEnabled == nil {
			if p.IsAzureStackCloud() {
				profile.AcceleratedNetworkingEnabled = to.BoolPtr(DefaultAzureStackAcceleratedNetworking)
			} else {
				profile.AcceleratedNetworkingEnabled = to.BoolPtr(DefaultAcceleratedNetworking && !isUpgrade && !isScale && helpers.AcceleratedNetworkingSupported(profile.VMSize))
			}
		}

		if profile.AcceleratedNetworkingEnabledWindows == nil {
			if p.IsAzureStackCloud() {
				// Here we are using same default variable. We will change once we will start supporting AcceleratedNetworking feature in general.
				profile.AcceleratedNetworkingEnabledWindows = to.BoolPtr(DefaultAzureStackAcceleratedNetworking)
			} else {
				profile.AcceleratedNetworkingEnabledWindows = to.BoolPtr(DefaultAcceleratedNetworkingWindowsEnabled && !isUpgrade && !isScale && helpers.AcceleratedNetworkingSupported(profile.VMSize))
			}
		}

		if profile.AuditDEnabled == nil {
			profile.AuditDEnabled = to.BoolPtr(DefaultAuditDEnabled && !isUpgrade && !isScale)
		}

		if profile.PreserveNodesProperties == nil {
			profile.PreserveNodesProperties = to.BoolPtr(DefaultPreserveNodesProperties)
		}

		if profile.EnableVMSSNodePublicIP == nil {
			profile.EnableVMSSNodePublicIP = to.BoolPtr(DefaultEnableVMSSNodePublicIP)
		}

		if profile.OSDiskCachingType == "" {
			if profile.IsEphemeral() {
				profile.OSDiskCachingType = string(compute.CachingTypesReadOnly)
			} else {
				profile.OSDiskCachingType = string(compute.CachingTypesReadWrite)
			}
		}
		if profile.DataDiskCachingType == "" {
			profile.DataDiskCachingType = string(compute.CachingTypesReadOnly)
		}
	}
}