NewBootstrapper returns the correct bootstrapper for the AMI family
(clusterConfig *api.ClusterConfig, ng *api.NodeGroup)
| 34 | |
| 35 | // NewBootstrapper returns the correct bootstrapper for the AMI family |
| 36 | func NewBootstrapper(clusterConfig *api.ClusterConfig, ng *api.NodeGroup) (Bootstrapper, error) { |
| 37 | clusterDNS := ng.ClusterDNS |
| 38 | if clusterDNS == "" { |
| 39 | var err error |
| 40 | clusterDNS, err = GetClusterDNS(clusterConfig) |
| 41 | if err != nil { |
| 42 | return nil, err |
| 43 | } |
| 44 | } |
| 45 | if api.IsWindowsImage(ng.AMIFamily) { |
| 46 | return NewWindowsBootstrapper(clusterConfig, ng, clusterDNS), nil |
| 47 | } |
| 48 | switch ng.AMIFamily { |
| 49 | case api.NodeImageFamilyUbuntuPro2604, api.NodeImageFamilyUbuntu2604, api.NodeImageFamilyUbuntuPro2404, api.NodeImageFamilyUbuntu2404, api.NodeImageFamilyUbuntuPro2204, api.NodeImageFamilyUbuntu2204, api.NodeImageFamilyUbuntuPro2004, api.NodeImageFamilyUbuntu2004: |
| 50 | return NewUbuntuBootstrapper(clusterConfig, ng, clusterDNS), nil |
| 51 | case api.NodeImageFamilyBottlerocket: |
| 52 | return NewBottlerocketBootstrapper(clusterConfig, ng), nil |
| 53 | case api.NodeImageFamilyAmazonLinux2023: |
| 54 | return NewAL2023Bootstrapper(clusterConfig, ng, clusterDNS), nil |
| 55 | case api.NodeImageFamilyAmazonLinux2: |
| 56 | return NewAL2Bootstrapper(clusterConfig, ng, clusterDNS), nil |
| 57 | default: |
| 58 | return nil, fmt.Errorf("unrecognized AMI family %q for creating bootstrapper", ng.AMIFamily) |
| 59 | |
| 60 | } |
| 61 | } |
| 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) { |