Skip to content

Commit

Permalink
Merge pull request #66 from stuartwdouglas/aws-logging
Browse files Browse the repository at this point in the history
Log all AWS requests
  • Loading branch information
stuartwdouglas authored Oct 30, 2023
2 parents e1aed31 + 6ae9ece commit 1101156
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 @@ -36,6 +36,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 @@ -82,6 +83,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 @@ -109,6 +111,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 @@ -145,6 +148,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 1101156

Please sign in to comment.