sigs.k8s.io/cluster-api-provider-azure@v1.17.0/azure/converters/managedagentpool.go (about) 1 /* 2 Copyright 2022 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package converters 18 19 import ( 20 asocontainerservicev1hub "github.com/Azure/azure-service-operator/v2/api/containerservice/v1api20231001/storage" 21 "k8s.io/utils/ptr" 22 ) 23 24 // AgentPoolToManagedClusterAgentPoolProfile converts a AgentPoolSpec to an Azure SDK ManagedClusterAgentPoolProfile used in managedcluster reconcile. 25 func AgentPoolToManagedClusterAgentPoolProfile(pool *asocontainerservicev1hub.ManagedClustersAgentPool) asocontainerservicev1hub.ManagedClusterAgentPoolProfile { 26 properties := pool.Spec 27 agentPool := asocontainerservicev1hub.ManagedClusterAgentPoolProfile{ 28 Name: ptr.To(pool.AzureName()), 29 VmSize: properties.VmSize, 30 OsType: properties.OsType, 31 OsDiskSizeGB: properties.OsDiskSizeGB, 32 Count: properties.Count, 33 Type: properties.Type, 34 OrchestratorVersion: properties.OrchestratorVersion, 35 VnetSubnetReference: properties.VnetSubnetReference, 36 Mode: properties.Mode, 37 EnableAutoScaling: properties.EnableAutoScaling, 38 MaxCount: properties.MaxCount, 39 MinCount: properties.MinCount, 40 NodeTaints: properties.NodeTaints, 41 AvailabilityZones: properties.AvailabilityZones, 42 MaxPods: properties.MaxPods, 43 OsDiskType: properties.OsDiskType, 44 NodeLabels: properties.NodeLabels, 45 EnableUltraSSD: properties.EnableUltraSSD, 46 EnableNodePublicIP: properties.EnableNodePublicIP, 47 NodePublicIPPrefixReference: properties.NodePublicIPPrefixReference, 48 ScaleSetPriority: properties.ScaleSetPriority, 49 ScaleDownMode: properties.ScaleDownMode, 50 SpotMaxPrice: properties.SpotMaxPrice, 51 Tags: properties.Tags, 52 KubeletDiskType: properties.KubeletDiskType, 53 LinuxOSConfig: properties.LinuxOSConfig, 54 EnableFIPS: properties.EnableFIPS, 55 EnableEncryptionAtHost: properties.EnableEncryptionAtHost, 56 } 57 if properties.KubeletConfig != nil { 58 agentPool.KubeletConfig = properties.KubeletConfig 59 } 60 return agentPool 61 }