Skip to content

Commit

Permalink
Log all AWS requests
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas committed Oct 30, 2023
1 parent 729a76b commit 6ae9ece
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/aws/ec2.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func Ec2Provider(platformName string, config map[string]string, systemNamespace
}

func (configMapInfo AwsDynamicConfig) LaunchInstance(kubeClient client.Client, log *logr.Logger, ctx context.Context, name string, instanceTag string) (cloud.InstanceIdentifier, error) {
log.Info(fmt.Sprintf("attempting to launch AWS instance for %s", name))
// Load AWS credentials and configuration

cfg, err := config.LoadDefaultConfig(ctx,
Expand Down Expand Up @@ -76,6 +77,7 @@ func (configMapInfo AwsDynamicConfig) LaunchInstance(kubeClient client.Client, l
}

func (configMapInfo AwsDynamicConfig) CountInstances(kubeClient client.Client, log *logr.Logger, ctx context.Context, instanceTag string) (int, error) {
log.Info("attempting to count AWS instances")
cfg, err := config.LoadDefaultConfig(ctx,
config.WithCredentialsProvider(SecretCredentialsProvider{Name: configMapInfo.Secret, Namespace: configMapInfo.SystemNamespace, Client: kubeClient}),
config.WithRegion(configMapInfo.Region))
Expand Down Expand Up @@ -103,6 +105,7 @@ func (configMapInfo AwsDynamicConfig) CountInstances(kubeClient client.Client, l
}

func (configMapInfo AwsDynamicConfig) GetInstanceAddress(kubeClient client.Client, log *logr.Logger, ctx context.Context, instanceId cloud.InstanceIdentifier) (string, error) {
log.Info(fmt.Sprintf("attempting to get AWS instance address %s", instanceId))
// Load AWS credentials and configuration

cfg, err := config.LoadDefaultConfig(ctx,
Expand Down Expand Up @@ -139,6 +142,7 @@ func (configMapInfo AwsDynamicConfig) GetInstanceAddress(kubeClient client.Clien
}

func (configMapInfo AwsDynamicConfig) TerminateInstance(kubeClient client.Client, log *logr.Logger, ctx context.Context, instance cloud.InstanceIdentifier) error {
log.Info(fmt.Sprintf("attempting to terminate AWS instance %s", instance))

// Load AWS credentials and configuration

Expand Down

0 comments on commit 6ae9ece

Please sign in to comment.