MCPcopy Index your code
hub / github.com/eksctl-io/eksctl / NewBootstrapper

Function NewBootstrapper

pkg/nodebootstrap/userdata.go:36–61  ·  view source on GitHub ↗

NewBootstrapper returns the correct bootstrapper for the AMI family

(clusterConfig *api.ClusterConfig, ng *api.NodeGroup)

Source from the content-addressed store, hash-verified

34
35// NewBootstrapper returns the correct bootstrapper for the AMI family
36func 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
64func NewManagedBootstrapper(clusterConfig *api.ClusterConfig, ng *api.ManagedNodeGroup) (Bootstrapper, error) {

Callers 2

newBootstrapperFunction · 0.92

Calls 6

GetClusterDNSFunction · 0.85
NewWindowsBootstrapperFunction · 0.85
NewUbuntuBootstrapperFunction · 0.85
NewAL2023BootstrapperFunction · 0.85
NewAL2BootstrapperFunction · 0.85

Tested by 1

newBootstrapperFunction · 0.74