NewManagedBootstrapper creates a new bootstrapper for managed nodegroups based on the AMI family
(clusterConfig *api.ClusterConfig, ng *api.ManagedNodeGroup)
| 62 | |
| 63 | // NewManagedBootstrapper creates a new bootstrapper for managed nodegroups based on the AMI family |
| 64 | func NewManagedBootstrapper(clusterConfig *api.ClusterConfig, ng *api.ManagedNodeGroup) (Bootstrapper, error) { |
| 65 | clusterDNS, err := GetClusterDNS(clusterConfig) |
| 66 | if err != nil { |
| 67 | return nil, err |
| 68 | } |
| 69 | if api.IsWindowsImage(ng.AMIFamily) { |
| 70 | return &ManagedWindows{ |
| 71 | NodeGroup: ng, |
| 72 | }, nil |
| 73 | } |
| 74 | switch ng.AMIFamily { |
| 75 | case api.NodeImageFamilyAmazonLinux2023: |
| 76 | return NewManagedAL2023Bootstrapper(clusterConfig, ng, clusterDNS), nil |
| 77 | case api.NodeImageFamilyAmazonLinux2: |
| 78 | return NewManagedAL2Bootstrapper(ng), nil |
| 79 | case api.NodeImageFamilyBottlerocket: |
| 80 | return NewManagedBottlerocketBootstrapper(clusterConfig, ng), nil |
| 81 | case api.NodeImageFamilyUbuntu2004, api.NodeImageFamilyUbuntuPro2004, api.NodeImageFamilyUbuntu2204, api.NodeImageFamilyUbuntuPro2204, api.NodeImageFamilyUbuntu2404, api.NodeImageFamilyUbuntuPro2404, api.NodeImageFamilyUbuntu2604, api.NodeImageFamilyUbuntuPro2604: |
| 82 | return NewUbuntuBootstrapper(clusterConfig, ng, clusterDNS), nil |
| 83 | } |
| 84 | return nil, nil |
| 85 | } |
| 86 | |
| 87 | // GetClusterDNS returns the DNS address to use |
| 88 | func GetClusterDNS(clusterConfig *api.ClusterConfig) (string, error) { |