aws / aws/eks-anywhere

Avoid building the snow aws client map for all snow machine configs

Open
#2,809 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.1k
Forks
328
Avg merge
1d 4h
Merged PRs (30d)
9

Description

Currently, we build the aws clients per device based on the creds that are passed in. For this CLI, this is the credentials file that gets passed in as an env var while for the [controller](https://github.com/aws/eks-anywhere/blob/main/pkg/providers/snow/reconciler/clientbuilder.go), it is the creds that are stored in the secret.

These creds look like the following (example from https://github.com/aws/eks-anywhere/blob/main/pkg/aws/testdata/valid_credentials):
```
[1.2.3.4]
aws_access_key_id = ABCDEFGHIJKLMNOPQR2T
aws_secret_access_key = mysecretkey
region = snow

[1.2.3.5]
aws_access_key_id = ABCDEFGHIJKLMNOPQR2T
aws_secret_access_key = mysecretkey
region = snow
```

If the user specifies a machine config with these device ips, the validations for each device will happen for each of the machines here: https://github.com/aws/eks-anywhere/blob/main/pkg/providers/snow/validator.go.

However, there is no need to build the client map based on the creds file if we can just pull the ones we need based on the devices that the user specified in the machine config. By only building this client map based on the devices specified, we can have a client map based on the machine config or cluster that we are dealing with, if the user has extra ips defined in the file.

Contributor guide

Open the contributing guide

Research direction

Start with pkg/providers/snow/validator.go and the controller client builder at pkg/providers/snow/reconciler/clientbuilder.go, then inspect how the CLI credentials file and machine config devices are used. The change is complete when client construction is limited to device IPs specified by the machine config or cluster, while validation still works for each device.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, go
Domain
cli, infrastructure
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.