Skip to content

Commit 8fe0cf4

Browse files
authored
Enable cluster logging when creating (#784)
This PR updates `Setup()` so that all the CloudWatch logging is enabled for an EKS cluster when created via the func. * https://docs.aws.amazon.com/eks/latest/eksctl/cloudwatch-cluster-logging.html#:~:text=To%20enable%20all%20types%20of%20logs%2C%20run If there are patterns where `eksctl create cluster` is being invoked and passed a cluster config `YAML` the `YAMLs` being passed in can and probably should be updated to account for having logging enabled: ```yaml # Enable all (api, audit, authenticator, controllerManager, scheduler) log types cloudWatch: clusterLogging: enableTypes: ["*"] ``` * https://docs.aws.amazon.com/eks/latest/eksctl/cloudwatch-cluster-logging.html --------- Signed-off-by: Matthew Lorimor <matt@m5wl5r.com>
1 parent e65c516 commit 8fe0cf4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

internal/drivers/eks_with_eksctl/driver.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,22 @@ func (k *driver) Setup(ctx context.Context) error {
492492
}
493493
log.Infof("Created cluster %s without nodegroups", k.clusterName)
494494
span.AddEvent("eks.cluster.created")
495+
496+
log.Infof("Enabling all cluster logging for %s", k.clusterName)
497+
updateArgs := []string{
498+
"utils", "update-cluster-logging",
499+
"--cluster=" + k.clusterName,
500+
"--region=" + k.region,
501+
"--enable-types=all",
502+
// per AWS: Note this command runs in plan mode by default,
503+
// you will need to specify --approve flag to apply the
504+
// changes to your cluster.
505+
"--approve",
506+
}
507+
if err := k.eksctl(ctx, updateArgs...); err != nil {
508+
return fmt.Errorf("eksctl update-cluster-logging: %w", err)
509+
}
510+
log.Infof("Enabled all cluster logging for %s", k.clusterName)
495511
}
496512

497513
if err := k.createNodeGroup(ctx); err != nil {

0 commit comments

Comments
 (0)