MCPcopy Create free account
hub / github.com/eksctl-io/eksctl / createNodeGroup

Method createNodeGroup

pkg/cfn/manager/nodegroup.go:115–150  ·  view source on GitHub ↗
(ctx context.Context, ng *api.NodeGroup, options CreateNodeGroupOptions, createAccessEntryInStack bool)

Source from the content-addressed store, hash-verified

113}
114
115func (t *UnmanagedNodeGroupTask) createNodeGroup(ctx context.Context, ng *api.NodeGroup, options CreateNodeGroupOptions, createAccessEntryInStack bool) error {
116 name := makeNodeGroupStackName(t.ClusterConfig.Metadata.Name, ng.Name)
117
118 logger.Info("building nodegroup stack %q", name)
119 bootstrapper, err := t.NewBootstrapper(t.ClusterConfig, ng)
120 if err != nil {
121 return fmt.Errorf("error creating bootstrapper: %w", err)
122 }
123
124 resourceSet := t.CreateNodeGroupResourceSet(builder.NodeGroupOptions{
125 ClusterConfig: t.ClusterConfig,
126 NodeGroup: ng,
127 Bootstrapper: bootstrapper,
128 ForceAddCNIPolicy: options.ForceAddCNIPolicy,
129 VPCImporter: options.VPCImporter,
130 SkipEgressRules: options.SkipEgressRules,
131 DisableAccessEntry: options.DisableAccessEntryCreation,
132 DisableAccessEntryResource: !createAccessEntryInStack,
133 })
134 if err := resourceSet.AddAllResources(ctx); err != nil {
135 return err
136 }
137
138 if ng.Tags == nil {
139 ng.Tags = make(map[string]string)
140 }
141 ng.Tags[api.NodeGroupNameTag] = ng.Name
142 ng.Tags[api.OldNodeGroupNameTag] = ng.Name
143 ng.Tags[api.NodeGroupTypeTag] = string(api.NodeGroupTypeUnmanaged)
144
145 errCh := make(chan error)
146 if err := t.StackManager.CreateStack(ctx, name, resourceSet, ng.Tags, nil, errCh); err != nil {
147 return err
148 }
149 return <-errCh
150}
151
152func (t *UnmanagedNodeGroupTask) maybeCreateAccessEntry(ctx context.Context, ng *api.NodeGroup) error {
153 roleARN := ng.IAM.InstanceRoleARN

Callers 1

CreateMethod · 0.95

Calls 3

makeNodeGroupStackNameFunction · 0.85
AddAllResourcesMethod · 0.65
CreateStackMethod · 0.65

Tested by

no test coverage detected