@@ -757,6 +757,13 @@ export interface ClusterProps extends ClusterOptions {
757
757
* @default - none
758
758
*/
759
759
readonly tags ?: { [ key : string ] : string } ;
760
+
761
+ /**
762
+ * The cluster log types which you want to enable.
763
+ *
764
+ * @default - none
765
+ */
766
+ readonly clusterLogging ?: ClusterLoggingTypes [ ] ;
760
767
}
761
768
762
769
/**
@@ -815,6 +822,32 @@ export class KubernetesVersion {
815
822
private constructor ( public readonly version : string ) { }
816
823
}
817
824
825
+ /**
826
+ * EKS cluster logging types
827
+ */
828
+ export enum ClusterLoggingTypes {
829
+ /**
830
+ * Logs pertaining to API requests to the cluster.
831
+ */
832
+ API = 'api' ,
833
+ /**
834
+ * Logs pertaining to cluster access via the Kubernetes API.
835
+ */
836
+ AUDIT = 'audit' ,
837
+ /**
838
+ * Logs pertaining to authentication requests into the cluster.
839
+ */
840
+ AUTHENTICATOR = 'authenticator' ,
841
+ /**
842
+ * Logs pertaining to state of cluster controllers.
843
+ */
844
+ CONTROLLER_MANAGER = 'controllerManager' ,
845
+ /**
846
+ * Logs pertaining to scheduling decisions.
847
+ */
848
+ SCHEDULER = 'scheduler' ,
849
+ }
850
+
818
851
abstract class ClusterBase extends Resource implements ICluster {
819
852
public abstract readonly connections : ec2 . Connections ;
820
853
public abstract readonly vpc : ec2 . IVpc ;
@@ -1253,6 +1286,8 @@ export class Cluster extends ClusterBase {
1253
1286
1254
1287
private readonly version : KubernetesVersion ;
1255
1288
1289
+ private readonly logging ?: { [ key : string ] : [ { [ key : string ] : any } ] } ;
1290
+
1256
1291
/**
1257
1292
* A dummy CloudFormation resource that is used as a wait barrier which
1258
1293
* represents that the cluster is ready to receive "kubectl" commands.
@@ -1313,6 +1348,14 @@ export class Cluster extends ClusterBase {
1313
1348
// Get subnetIds for all selected subnets
1314
1349
const subnetIds = Array . from ( new Set ( flatten ( selectedSubnetIdsPerGroup ) ) ) ;
1315
1350
1351
+ this . logging = props . clusterLogging ? {
1352
+ clusterLogging : [
1353
+ {
1354
+ enabled : true ,
1355
+ types : Object . values ( props . clusterLogging ) ,
1356
+ } ,
1357
+ ] ,
1358
+ } : undefined ;
1316
1359
1317
1360
this . endpointAccess = props . endpointAccess ?? EndpointAccess . PUBLIC_AND_PRIVATE ;
1318
1361
this . kubectlEnvironment = props . kubectlEnvironment ;
@@ -1379,6 +1422,7 @@ export class Cluster extends ClusterBase {
1379
1422
clusterHandlerSecurityGroup : this . clusterHandlerSecurityGroup ,
1380
1423
onEventLayer : this . onEventLayer ,
1381
1424
tags : props . tags ,
1425
+ logging : this . logging ,
1382
1426
} ) ;
1383
1427
1384
1428
if ( this . endpointAccess . _config . privateAccess && privateSubnets . length !== 0 ) {
0 commit comments