createIAMServiceAccountTask creates the iamserviceaccount in CloudFormation
(ctx context.Context, errs chan error, spec *api.ClusterIAMServiceAccount, oidc *iamoidc.OpenIDConnectManager)
| 20 | |
| 21 | // createIAMServiceAccountTask creates the iamserviceaccount in CloudFormation |
| 22 | func (c *StackCollection) createIAMServiceAccountTask(ctx context.Context, errs chan error, spec *api.ClusterIAMServiceAccount, oidc *iamoidc.OpenIDConnectManager) error { |
| 23 | name := c.makeIAMServiceAccountStackName(spec.Namespace, spec.Name) |
| 24 | logger.Info("building iamserviceaccount stack %q", name) |
| 25 | stack := builder.NewIAMRoleResourceSetForServiceAccount(spec, oidc) |
| 26 | if err := stack.AddAllResources(); err != nil { |
| 27 | return err |
| 28 | } |
| 29 | |
| 30 | if spec.Tags == nil { |
| 31 | spec.Tags = make(map[string]string) |
| 32 | } |
| 33 | spec.Tags[api.IAMServiceAccountNameTag] = spec.NameString() |
| 34 | |
| 35 | if err := c.CreateStack(ctx, name, stack, spec.Tags, nil, errs); err != nil { |
| 36 | logger.Info("an error occurred creating the stack, to cleanup resources, run 'eksctl delete iamserviceaccount --region=%s --name=%s --namespace=%s'", c.spec.Metadata.Region, spec.Name, spec.Namespace) |
| 37 | return err |
| 38 | } |
| 39 | return nil |
| 40 | } |
| 41 | |
| 42 | // DescribeIAMServiceAccountStacks calls ListStacks and filters out iamserviceaccounts |
| 43 | func (c *StackCollection) DescribeIAMServiceAccountStacks(ctx context.Context) ([]*Stack, error) { |
no test coverage detected