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

Method Create

pkg/cfn/manager/nodegroup.go:84–113  ·  view source on GitHub ↗

Create creates a TaskTree for creating nodegroups.

(ctx context.Context, options CreateNodeGroupOptions)

Source from the content-addressed store, hash-verified

82
83// Create creates a TaskTree for creating nodegroups.
84func (t *UnmanagedNodeGroupTask) Create(ctx context.Context, options CreateNodeGroupOptions) *tasks.TaskTree {
85 taskTree := &tasks.TaskTree{Parallel: true, Limit: options.Parallelism}
86
87 for _, ng := range t.NodeGroups {
88 ng := ng
89 createAccessEntryInStack := ng.IAM.InstanceRoleARN == ""
90 createNodeGroupTask := &tasks.GenericTask{
91 Description: fmt.Sprintf("create nodegroup %q", ng.NameString()),
92 Doer: func() error {
93 return t.createNodeGroup(ctx, ng, options, createAccessEntryInStack)
94 },
95 }
96
97 if options.DisableAccessEntryCreation || createAccessEntryInStack {
98 taskTree.Append(createNodeGroupTask)
99 } else {
100 var ngTask tasks.TaskTree
101 ngTask.Append(createNodeGroupTask)
102 ngTask.Append(&tasks.GenericTask{
103 Description: fmt.Sprintf("create access entry for nodegroup %q", ng.NameString()),
104 Doer: func() error {
105 return t.maybeCreateAccessEntry(ctx, ng)
106 },
107 })
108 taskTree.Append(&ngTask)
109 }
110 }
111
112 return taskTree
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)

Callers 1

Calls 4

createNodeGroupMethod · 0.95
AppendMethod · 0.95
NameStringMethod · 0.65

Tested by

no test coverage detected