diff --git a/examples/blueprint-construct/index.ts b/examples/blueprint-construct/index.ts index 971ec5f6d..93c4c6134 100644 --- a/examples/blueprint-construct/index.ts +++ b/examples/blueprint-construct/index.ts @@ -1,447 +1,469 @@ -import * as cdk from 'aws-cdk-lib'; +import * as cdk from "aws-cdk-lib"; import * as ec2 from "aws-cdk-lib/aws-ec2"; -import { CapacityType, KubernetesVersion, NodegroupAmiType } from 'aws-cdk-lib/aws-eks'; -import * as iam from 'aws-cdk-lib/aws-iam'; -import * as kms from 'aws-cdk-lib/aws-kms'; +import { + CapacityType, + KubernetesVersion, + NodegroupAmiType, +} from "aws-cdk-lib/aws-eks"; +import * as iam from "aws-cdk-lib/aws-iam"; +import * as kms from "aws-cdk-lib/aws-kms"; import { Construct } from "constructs"; -import * as blueprints from '../../lib'; -import * as team from '../teams'; -import { CfnWorkspace } from 'aws-cdk-lib/aws-aps'; +import * as blueprints from "../../lib"; +import * as addons from "../../lib/addons"; +import * as team from "../teams"; +import { CfnWorkspace } from "aws-cdk-lib/aws-aps"; import { - CreateEfsFileSystemProvider, - CreateRoleProvider, - CreateS3BucketProvider, - GenericClusterProvider, ManagedNodeGroup + CreateEfsFileSystemProvider, + CreateRoleProvider, + CreateS3BucketProvider, + GenericClusterProvider, + ManagedNodeGroup, } from "../../lib"; -const burnhamManifestDir = './examples/teams/team-burnham/'; -const rikerManifestDir = './examples/teams/team-riker/'; +const burnhamManifestDir = "./examples/teams/team-burnham/"; +const rikerManifestDir = "./examples/teams/team-riker/"; const teamManifestDirList = [burnhamManifestDir, rikerManifestDir]; -const blueprintID = 'blueprint-construct-dev'; +const blueprintID = "blueprint-construct-dev"; export interface BlueprintConstructProps { - /** - * Id - */ - id: string + /** + * Id + */ + id: string; } export default class BlueprintConstruct { - teams: Array; - nodeRole: CreateRoleProvider; - ampWorkspaceName: string; - ampWorkspace: CfnWorkspace; - apacheAirflowS3Bucket: CreateS3BucketProvider; - apacheAirflowEfs: CreateEfsFileSystemProvider; - addOns: Array; - clusterProvider: GenericClusterProvider; - dataTeam: blueprints.EmrEksTeamProps; - batchTeam: blueprints.BatchEksTeamProps; - nodeClassSpec: blueprints.Ec2NodeClassSpec; - nodePoolSpec: blueprints.NodePoolSpec; + teams: Array; + nodeRole: CreateRoleProvider; + ampWorkspaceName: string; + ampWorkspace: CfnWorkspace; + apacheAirflowS3Bucket: CreateS3BucketProvider; + apacheAirflowEfs: CreateEfsFileSystemProvider; + addOns: Array; + clusterProvider: GenericClusterProvider; + dataTeam: blueprints.EmrEksTeamProps; + batchTeam: blueprints.BatchEksTeamProps; + nodeClassSpec: blueprints.Ec2NodeClassSpec; + nodePoolSpec: blueprints.NodePoolSpec; + constructor(scope: Construct, props: cdk.StackProps) { + blueprints.HelmAddOn.validateHelmVersions = true; + blueprints.HelmAddOn.failOnVersionValidation = false; - constructor(scope: Construct, props: cdk.StackProps) { + this.teams = [ + new team.TeamTroi(), + new team.TeamRiker(scope, teamManifestDirList[1]), + new team.TeamBurnham(scope, teamManifestDirList[0]), + new team.TeamPlatform(process.env.CDK_DEFAULT_ACCOUNT!), + ]; - blueprints.HelmAddOn.validateHelmVersions = true; - blueprints.HelmAddOn.failOnVersionValidation = false; + this.nodeRole = new blueprints.CreateRoleProvider( + "blueprint-node-role", + new iam.ServicePrincipal("ec2.amazonaws.com"), + [ + iam.ManagedPolicy.fromAwsManagedPolicyName("AmazonEKSWorkerNodePolicy"), + iam.ManagedPolicy.fromAwsManagedPolicyName( + "AmazonEC2ContainerRegistryReadOnly" + ), + iam.ManagedPolicy.fromAwsManagedPolicyName( + "AmazonSSMManagedInstanceCore" + ), + ] + ); - this.teams = [ - new team.TeamTroi, - new team.TeamRiker(scope, teamManifestDirList[1]), - new team.TeamBurnham(scope, teamManifestDirList[0]), - new team.TeamPlatform(process.env.CDK_DEFAULT_ACCOUNT!) - ]; + this.ampWorkspaceName = "blueprints-amp-workspace"; + this.ampWorkspace = blueprints.getNamedResource(this.ampWorkspaceName); - this.nodeRole = new blueprints.CreateRoleProvider("blueprint-node-role", new iam.ServicePrincipal("ec2.amazonaws.com"), - [ - iam.ManagedPolicy.fromAwsManagedPolicyName("AmazonEKSWorkerNodePolicy"), - iam.ManagedPolicy.fromAwsManagedPolicyName("AmazonEC2ContainerRegistryReadOnly"), - iam.ManagedPolicy.fromAwsManagedPolicyName("AmazonSSMManagedInstanceCore") - ]); + this.apacheAirflowS3Bucket = new blueprints.CreateS3BucketProvider({ + id: "apache-airflow-s3-bucket-id", + s3BucketProps: { removalPolicy: cdk.RemovalPolicy.DESTROY }, + }); + this.apacheAirflowEfs = new blueprints.CreateEfsFileSystemProvider({ + name: "blueprints-apache-airflow-efs", + }); + this.nodeClassSpec = { + amiFamily: "AL2", + subnetSelectorTerms: [ + { tags: { Name: `${blueprintID}/${blueprintID}-vpc/PrivateSubnet*` } }, + ], + securityGroupSelectorTerms: [ + { tags: { "aws:eks:cluster-name": `${blueprintID}` } }, + ], + }; - this.ampWorkspaceName = "blueprints-amp-workspace"; - this.ampWorkspace = blueprints.getNamedResource(this.ampWorkspaceName); + this.nodePoolSpec = { + labels: { + type: "karpenter-test", + }, + annotations: { + "eks-blueprints/owner": "young", + }, + taints: [ + { + key: "workload", + value: "test", + effect: "NoSchedule", + }, + ], + requirements: [ + { + key: "node.kubernetes.io/instance-type", + operator: "In", + values: ["m5.2xlarge"], + }, + { + key: "topology.kubernetes.io/zone", + operator: "In", + values: [`${props?.env?.region}a`, `${props?.env?.region}b`], + }, + { + key: "kubernetes.io/arch", + operator: "In", + values: ["amd64", "arm64"], + }, + { key: "karpenter.sh/capacity-type", operator: "In", values: ["spot"] }, + ], + disruption: { + consolidationPolicy: "WhenEmpty", + consolidateAfter: "30s", + expireAfter: "20m", + }, + }; - this.apacheAirflowS3Bucket = new blueprints.CreateS3BucketProvider({ - id: 'apache-airflow-s3-bucket-id', - s3BucketProps: { removalPolicy: cdk.RemovalPolicy.DESTROY } - }); - this.apacheAirflowEfs = new blueprints.CreateEfsFileSystemProvider({ - name: 'blueprints-apache-airflow-efs', - }); - this.nodeClassSpec = { - amiFamily: "AL2", - subnetSelectorTerms: [{ tags: { "Name": `${blueprintID}/${blueprintID}-vpc/PrivateSubnet*` }}], - securityGroupSelectorTerms: [{ tags: { "aws:eks:cluster-name": `${blueprintID}` }}], - }; - - this.nodePoolSpec = { - labels: { - type: "karpenter-test" - }, - annotations: { - "eks-blueprints/owner": "young" - }, - taints: [{ - key: "workload", - value: "test", - effect: "NoSchedule", - }], - requirements: [ - { key: 'node.kubernetes.io/instance-type', operator: 'In', values: ['m5.2xlarge'] }, - { key: 'topology.kubernetes.io/zone', operator: 'In', values: [`${props?.env?.region}a`,`${props?.env?.region}b`]}, - { key: 'kubernetes.io/arch', operator: 'In', values: ['amd64','arm64']}, - { key: 'karpenter.sh/capacity-type', operator: 'In', values: ['spot']}, - ], - disruption: { - consolidationPolicy: "WhenEmpty", - consolidateAfter: "30s", - expireAfter: "20m", - } - }; + this.addOns = [ + // pre-reqs / core addons + new addons.AwsLoadBalancerControllerAddOn(), + new addons.CertManagerAddOn(), + new addons.AdotCollectorAddOn({ + namespace: "adot", + version: "auto", + }), + new addons.EfsCsiDriverAddOn({ + replicaCount: 1, + kmsKeys: [ + blueprints.getResource( + (context) => + new kms.Key(context.scope, "efs-csi-driver-key", { + alias: "efs-csi-driver-key", + }) + ), + ], + }), + new addons.KarpenterAddOn({ + nodePoolSpec: this.nodePoolSpec, + ec2NodeClassSpec: this.nodeClassSpec, + interruptionHandling: true, + installCRDs: false, + }), - this.addOns = [ - new blueprints.KubeRayAddOn(), - new blueprints.addons.AwsLoadBalancerControllerAddOn(), - new blueprints.addons.AppMeshAddOn(), - new blueprints.addons.CalicoOperatorAddOn(), - new blueprints.addons.CertManagerAddOn(), - new blueprints.addons.KubeStateMetricsAddOn(), - new blueprints.addons.PrometheusNodeExporterAddOn(), - new blueprints.addons.AdotCollectorAddOn({ - namespace:'adot', - version: 'auto' - }), - new blueprints.addons.AmpAddOn({ - ampPrometheusEndpoint: this.ampWorkspace.attrPrometheusEndpoint, - namespace: 'adot' - }), - new blueprints.addons.XrayAdotAddOn({ - namespace: 'adot' - }), - new blueprints.addons.XrayAddOn(), - // new blueprints.addons.CloudWatchAdotAddOn(), - // new blueprints.addons.ContainerInsightsAddOn(), - // new blueprints.addons.CloudWatchInsights(), - new blueprints.addons.IstioBaseAddOn(), - new blueprints.addons.IstioControlPlaneAddOn(), - new blueprints.addons.IstioCniAddon(), - new blueprints.addons.IstioIngressGatewayAddon(), - new blueprints.addons.MetricsServerAddOn(), - new blueprints.addons.SecretsStoreAddOn(), - new blueprints.addons.ArgoCDAddOn(), - new blueprints.addons.SSMAgentAddOn(), - new blueprints.addons.NginxAddOn({ - values: { - controller: { service: { create: false } } - } - }), - new blueprints.addons.IngressNginxAddOn({ - serviceType: 'ClusterIP' - }), - // new blueprints.addons.VeleroAddOn(), - new blueprints.addons.VpcCniAddOn({ - customNetworkingConfig: { - subnets: [ - blueprints.getNamedResource("secondary-cidr-subnet-0"), - blueprints.getNamedResource("secondary-cidr-subnet-1"), - blueprints.getNamedResource("secondary-cidr-subnet-2"), - ] - }, - awsVpcK8sCniCustomNetworkCfg: true, - eniConfigLabelDef: 'topology.kubernetes.io/zone', - serviceAccountPolicies: [iam.ManagedPolicy.fromAwsManagedPolicyName("AmazonEKS_CNI_Policy")] - }), - new blueprints.addons.CoreDnsAddOn(), - new blueprints.addons.KubeProxyAddOn(), - new blueprints.addons.OpaGatekeeperAddOn(), - new blueprints.addons.AckAddOn({ - id: "s3-ack", - createNamespace: true, - skipVersionValidation: true, - serviceName: blueprints.AckServiceName.S3 - }), - new blueprints.addons.KarpenterAddOn({ - nodePoolSpec: this.nodePoolSpec, - ec2NodeClassSpec: this.nodeClassSpec, - interruptionHandling: true, - installCRDs: false - }), - new blueprints.addons.AwsNodeTerminationHandlerAddOn(), - new blueprints.addons.KubeviousAddOn(), - new blueprints.addons.EbsCsiDriverAddOn({ - version: "auto", - kmsKeys: [ - blueprints.getResource( - (context) => - new kms.Key(context.scope, "ebs-csi-driver-key", { - alias: "ebs-csi-driver-key", - }) - ), - ], - storageClass: "gp3", - }), - new blueprints.addons.EfsCsiDriverAddOn({ - replicaCount: 1, - kmsKeys: [ - blueprints.getResource( context => new kms.Key(context.scope, "efs-csi-driver-key", { alias: "efs-csi-driver-key"})), - ], - }), - new blueprints.addons.KedaAddOn({ - podSecurityContextFsGroup: 1001, - securityContextRunAsGroup: 1001, - securityContextRunAsUser: 1001, - irsaRoles: ["CloudWatchFullAccess", "AmazonSQSFullAccess"] - }), - new blueprints.addons.AWSPrivateCAIssuerAddon(), - // new blueprints.addons.JupyterHubAddOn({ - // efsConfig: { - // pvcName: "efs-persist", - // removalPolicy: cdk.RemovalPolicy.DESTROY, - // capacity: '10Gi', - // }, - // serviceType: blueprints.JupyterHubServiceType.CLUSTERIP, - // notebookStack: 'jupyter/datascience-notebook', - // values: { prePuller: { hook: { enabled: false }}} - // }), - new blueprints.EmrEksAddOn(), - new blueprints.AwsBatchAddOn(), - // Commenting due to conflicts with `CloudWatchLogsAddon` - // new blueprints.AwsForFluentBitAddOn(), - new blueprints.FluxCDAddOn(), - new blueprints.GpuOperatorAddon({ - values:{ - driver: { - enabled: true - }, - mig: { - strategy: 'mixed' - }, - devicePlugin: { - enabled: true, - version: 'v0.13.0' - }, - migManager: { - enabled: true, - WITH_REBOOT: true - }, - toolkit: { - version: 'v1.13.1-centos7' - }, - operator: { - defaultRuntime: 'containerd' - }, - gfd: { - version: 'v0.8.0' - } - } - }), - new blueprints.GrafanaOperatorAddon(), - new blueprints.CloudWatchLogsAddon({ - logGroupPrefix: '/aws/eks/blueprints-construct-dev', - logRetentionDays: 30 - }), - new blueprints.ApacheAirflowAddOn({ - enableLogging: true, - s3Bucket: 'apache-airflow-s3-bucket-provider', - enableEfs: true, - efsFileSystem: 'apache-airflow-efs-provider' - }), - new blueprints.ExternalsSecretsAddOn(), - new blueprints.EksPodIdentityAgentAddOn(), - new blueprints.NeuronDevicePluginAddOn(), - new blueprints.NeuronMonitorAddOn(), - new blueprints.UpboundCrossplaneAddOn({ - skipVersionValidation: true, - clusterAccessRole: blueprints.getNamedResource("node-role") - }) - ]; + // other addons + new addons.AckAddOn({ + id: "s3-ack", + createNamespace: true, + skipVersionValidation: true, + serviceName: blueprints.AckServiceName.S3, + }), - // Instantiated to for helm version check. - new blueprints.ExternalDnsAddOn({ - hostedZoneResources: [ blueprints.GlobalResources.HostedZone ] - }); + new addons.AmpAddOn({ + ampPrometheusEndpoint: this.ampWorkspace.attrPrometheusEndpoint, + namespace: "adot", + }), + new addons.ApacheAirflowAddOn({ + enableLogging: true, + s3Bucket: "apache-airflow-s3-bucket-provider", + enableEfs: true, + efsFileSystem: "apache-airflow-efs-provider", + }), + new addons.AppMeshAddOn(), + new addons.ArgoCDAddOn(), + new addons.AwsBatchAddOn(), + new addons.AWSPrivateCAIssuerAddon(), + new addons.AwsNodeTerminationHandlerAddOn(), + new addons.CalicoOperatorAddOn(), + new addons.CloudWatchLogsAddon({ + logGroupPrefix: "/aws/eks/blueprints-construct-dev", + logRetentionDays: 30, + }), + new addons.CoreDnsAddOn(), + new addons.EbsCsiDriverAddOn({ + version: "auto", + kmsKeys: [ + blueprints.getResource( + (context) => + new kms.Key(context.scope, "ebs-csi-driver-key", { + alias: "ebs-csi-driver-key", + }) + ), + ], + storageClass: "gp3", + }), + new addons.EksPodIdentityAgentAddOn(), + new addons.EmrEksAddOn(), + new addons.ExternalsSecretsAddOn(), + new addons.FluxCDAddOn(), + new addons.GpuOperatorAddon({ + values: { + driver: { + enabled: true, + }, + mig: { + strategy: "mixed", + }, + devicePlugin: { + enabled: true, + version: "v0.13.0", + }, + migManager: { + enabled: true, + WITH_REBOOT: true, + }, + toolkit: { + version: "v1.13.1-centos7", + }, + operator: { + defaultRuntime: "containerd", + }, + gfd: { + version: "v0.8.0", + }, + }, + }), + new addons.GrafanaOperatorAddon(), + new addons.IngressNginxAddOn({ + serviceType: "ClusterIP", + }), + new addons.IstioBaseAddOn(), + new addons.IstioControlPlaneAddOn(), + new addons.IstioCniAddon(), + new addons.IstioIngressGatewayAddon(), + new addons.KedaAddOn({ + podSecurityContextFsGroup: 1001, + securityContextRunAsGroup: 1001, + securityContextRunAsUser: 1001, + irsaRoles: ["CloudWatchFullAccess", "AmazonSQSFullAccess"], + }), + new addons.KubeProxyAddOn(), + new addons.KubeRayAddOn(), + new addons.KubeStateMetricsAddOn(), + new addons.KubeviousAddOn(), + new addons.MetricsServerAddOn(), + new addons.NeuronDevicePluginAddOn(), + new addons.NeuronMonitorAddOn(), + new addons.NginxAddOn({ + values: { + controller: { service: { create: false } }, + }, + }), + new addons.OpaGatekeeperAddOn(), + new addons.PrometheusNodeExporterAddOn(), + new addons.S3CSIDriverAddOn({ + s3BucketName: "s3-csi-driver-for-blueprints-xbucket", + }), + new addons.SecretsStoreAddOn(), + new addons.SSMAgentAddOn(), + new addons.UpboundCrossplaneAddOn({ + skipVersionValidation: true, + clusterAccessRole: blueprints.getNamedResource("node-role"), + }), + new addons.VpcCniAddOn({ + customNetworkingConfig: { + subnets: [ + blueprints.getNamedResource("secondary-cidr-subnet-0"), + blueprints.getNamedResource("secondary-cidr-subnet-1"), + blueprints.getNamedResource("secondary-cidr-subnet-2"), + ], + }, + awsVpcK8sCniCustomNetworkCfg: true, + eniConfigLabelDef: "topology.kubernetes.io/zone", + serviceAccountPolicies: [ + iam.ManagedPolicy.fromAwsManagedPolicyName("AmazonEKS_CNI_Policy"), + ], + }), + new addons.XrayAddOn(), + new addons.XrayAdotAddOn({ + namespace: "adot", + }), + ]; - this.clusterProvider = getClusterProvider([ - addGenericNodeGroup(), - addCustomNodeGroup(), - addWindowsNodeGroup(), // commented out to check the impact on e2e - addGpuNodeGroup() - ]); + // Instantiated to for helm version check. + new blueprints.ExternalDnsAddOn({ + hostedZoneResources: [blueprints.GlobalResources.HostedZone], + }); - const executionRolePolicyStatement:iam. PolicyStatement [] = [ - new iam.PolicyStatement({ - resources: ['*'], - actions: ['s3:*'], - }), - new iam.PolicyStatement({ - resources: ['*'], - actions: ['glue:*'], - }), - new iam.PolicyStatement({ - resources: ['*'], - actions: [ - 'logs:*', - ], - }), - ]; + this.clusterProvider = getClusterProvider([ + addGenericNodeGroup(), + addCustomNodeGroup(), + addWindowsNodeGroup(), // commented out to check the impact on e2e + addGpuNodeGroup(), + ]); - this.dataTeam = { - name:'dataTeam', - virtualClusterName: 'batchJob', - virtualClusterNamespace: 'batchjob', - createNamespace: true, - executionRoles: [ - { - executionRoleIamPolicyStatement: executionRolePolicyStatement, - executionRoleName: 'myBlueprintExecRole' - } - ] - }; + const executionRolePolicyStatement: iam.PolicyStatement[] = [ + new iam.PolicyStatement({ + resources: ["*"], + actions: ["s3:*"], + }), + new iam.PolicyStatement({ + resources: ["*"], + actions: ["glue:*"], + }), + new iam.PolicyStatement({ + resources: ["*"], + actions: ["logs:*"], + }), + ]; - this.batchTeam = { - name: 'batch-a', - namespace: 'aws-batch', - envName: 'batch-a-comp-env', - computeResources: { - envType: blueprints.BatchEnvType.EC2, - allocationStrategy: blueprints.BatchAllocationStrategy.BEST, - priority: 10, - minvCpus: 0, - maxvCpus: 128, - instanceTypes: ["m5", "c4.4xlarge"] - }, - jobQueueName: 'team-a-job-queue', - }; - } + this.dataTeam = { + name: "dataTeam", + virtualClusterName: "batchJob", + virtualClusterNamespace: "batchjob", + createNamespace: true, + executionRoles: [ + { + executionRoleIamPolicyStatement: executionRolePolicyStatement, + executionRoleName: "myBlueprintExecRole", + }, + ], + }; + + this.batchTeam = { + name: "batch-a", + namespace: "aws-batch", + envName: "batch-a-comp-env", + computeResources: { + envType: blueprints.BatchEnvType.EC2, + allocationStrategy: blueprints.BatchAllocationStrategy.BEST, + priority: 10, + minvCpus: 0, + maxvCpus: 128, + instanceTypes: ["m5", "c4.4xlarge"], + }, + jobQueueName: "team-a-job-queue", + }; + } } -export function getClusterProvider(managedNodeGroups: ManagedNodeGroup[]){ - return new blueprints.GenericClusterProvider({ - version: KubernetesVersion.V1_30, - tags: { - "Name": "blueprints-example-cluster", - "Type": "generic-cluster" - }, - mastersRole: blueprints.getResource(context => { - return new iam.Role(context.scope, 'AdminRole', { assumedBy: new iam.AccountRootPrincipal() }); - }), - managedNodeGroups: managedNodeGroups - }); +export function getClusterProvider(managedNodeGroups: ManagedNodeGroup[]) { + return new blueprints.GenericClusterProvider({ + version: KubernetesVersion.V1_30, + tags: { + Name: "blueprints-example-cluster", + Type: "generic-cluster", + }, + mastersRole: blueprints.getResource((context) => { + return new iam.Role(context.scope, "AdminRole", { + assumedBy: new iam.AccountRootPrincipal(), + }); + }), + managedNodeGroups: managedNodeGroups, + }); } export function addGenericNodeGroup(): blueprints.ManagedNodeGroup { - - return { - id: "mng1", - amiType: NodegroupAmiType.AL2_X86_64, - instanceTypes: [new ec2.InstanceType('m5.4xlarge')], - desiredSize: 2, - maxSize: 3, - nodeRole: blueprints.getNamedResource("node-role") as iam.Role, - nodeGroupSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, - launchTemplate: { - // You can pass Custom Tags to Launch Templates which gets Propogated to worker nodes. - tags: { - "Name": "Mng1", - "Type": "Managed-Node-Group", - "LaunchTemplate": "Custom", - "Instance": "ONDEMAND" - }, - requireImdsv2: false - } - }; + return { + id: "mng1", + amiType: NodegroupAmiType.AL2_X86_64, + instanceTypes: [new ec2.InstanceType("m5.4xlarge")], + desiredSize: 2, + maxSize: 3, + nodeRole: blueprints.getNamedResource("node-role") as iam.Role, + nodeGroupSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, + launchTemplate: { + // You can pass Custom Tags to Launch Templates which gets Propogated to worker nodes. + tags: { + Name: "Mng1", + Type: "Managed-Node-Group", + LaunchTemplate: "Custom", + Instance: "ONDEMAND", + }, + requireImdsv2: false, + }, + }; } export function addCustomNodeGroup(): blueprints.ManagedNodeGroup { + const userData = ec2.UserData.forLinux(); + userData.addCommands(`/etc/eks/bootstrap.sh ${blueprintID}`); - const userData = ec2.UserData.forLinux(); - userData.addCommands(`/etc/eks/bootstrap.sh ${blueprintID}`); - - return { - id: "mng2-customami", - amiType: NodegroupAmiType.AL2_X86_64, - instanceTypes: [new ec2.InstanceType('t3.large')], - nodeGroupCapacityType: CapacityType.SPOT, - desiredSize: 0, - minSize: 0, - nodeRole: blueprints.getNamedResource("node-role") as iam.Role, - launchTemplate: { - tags: { - "Name": "Mng2", - "Type": "Managed-Node-Group", - "LaunchTemplate": "Custom", - "Instance": "SPOT" - }, - machineImage: ec2.MachineImage.genericLinux({ - 'eu-west-1': 'ami-00805477850d62b8c', - 'us-east-1': 'ami-08e520f5673ee0894', - 'us-west-2': 'ami-0403ff342ceb30967', - 'us-east-2': 'ami-07109d69738d6e1ee', - 'us-west-1': 'ami-07bda4b61dc470985', - 'us-gov-west-1': 'ami-0e9ebbf0d3f263e9b', - 'us-gov-east-1':'ami-033eb9bc6daf8bfb1' - }), - userData: userData, - } - }; + return { + id: "mng2-customami", + amiType: NodegroupAmiType.AL2_X86_64, + instanceTypes: [new ec2.InstanceType("t3.large")], + nodeGroupCapacityType: CapacityType.SPOT, + desiredSize: 0, + minSize: 0, + nodeRole: blueprints.getNamedResource("node-role") as iam.Role, + launchTemplate: { + tags: { + Name: "Mng2", + Type: "Managed-Node-Group", + LaunchTemplate: "Custom", + Instance: "SPOT", + }, + machineImage: ec2.MachineImage.genericLinux({ + "eu-west-1": "ami-00805477850d62b8c", + "us-east-1": "ami-08e520f5673ee0894", + "us-west-2": "ami-0403ff342ceb30967", + "us-east-2": "ami-07109d69738d6e1ee", + "us-west-1": "ami-07bda4b61dc470985", + "us-gov-west-1": "ami-0e9ebbf0d3f263e9b", + "us-gov-east-1": "ami-033eb9bc6daf8bfb1", + }), + userData: userData, + }, + }; } export function addWindowsNodeGroup(): blueprints.ManagedNodeGroup { - - return { - id: "mng3-windowsami", - amiType: NodegroupAmiType.WINDOWS_CORE_2019_X86_64, - instanceTypes: [new ec2.InstanceType('m5.4xlarge')], - desiredSize: 0, - minSize: 0, - nodeRole: blueprints.getNamedResource("node-role") as iam.Role, - diskSize: 50, - tags: { - "Name": "Mng3", - "Type": "Managed-WindowsNode-Group", - "LaunchTemplate": "WindowsLT", - "kubernetes.io/cluster/blueprint-construct-dev": "owned" - } - }; + return { + id: "mng3-windowsami", + amiType: NodegroupAmiType.WINDOWS_CORE_2019_X86_64, + instanceTypes: [new ec2.InstanceType("m5.4xlarge")], + desiredSize: 0, + minSize: 0, + nodeRole: blueprints.getNamedResource("node-role") as iam.Role, + diskSize: 50, + tags: { + Name: "Mng3", + Type: "Managed-WindowsNode-Group", + LaunchTemplate: "WindowsLT", + "kubernetes.io/cluster/blueprint-construct-dev": "owned", + }, + }; } export function addGpuNodeGroup(): blueprints.ManagedNodeGroup { - - return { - id: "mng-linux-gpu", - amiType: NodegroupAmiType.AL2_X86_64_GPU, - instanceTypes: [new ec2.InstanceType('g5.xlarge')], - desiredSize: 0, - minSize: 0, - maxSize: 1, - nodeGroupSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, - launchTemplate: { - tags: { - "Name": "Mng-linux-Gpu", - "Type": "Managed-linux-Gpu-Node-Group", - "LaunchTemplate": "Linux-Launch-Template", - }, - requireImdsv2: false - } - }; + return { + id: "mng-linux-gpu", + amiType: NodegroupAmiType.AL2_X86_64_GPU, + instanceTypes: [new ec2.InstanceType("g5.xlarge")], + desiredSize: 0, + minSize: 0, + maxSize: 1, + nodeGroupSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, + launchTemplate: { + tags: { + Name: "Mng-linux-Gpu", + Type: "Managed-linux-Gpu-Node-Group", + LaunchTemplate: "Linux-Launch-Template", + }, + requireImdsv2: false, + }, + }; } export function addInferentiaNodeGroup(): blueprints.ManagedNodeGroup { - - return { - id: "mng4-inferentia", - instanceTypes: [new ec2.InstanceType('inf1.2xlarge')], - desiredSize: 1, - minSize: 1, - nodeRole: blueprints.getNamedResource("node-role") as iam.Role, - diskSize: 50, - tags: { - "Name": "Mng4", - "Type": "Managed-InferentiaNode-Group", - "LaunchTemplate": "Inferentia", - "kubernetes.io/cluster/blueprint-construct-dev": "owned" - } - }; + return { + id: "mng4-inferentia", + instanceTypes: [new ec2.InstanceType("inf1.2xlarge")], + desiredSize: 1, + minSize: 1, + nodeRole: blueprints.getNamedResource("node-role") as iam.Role, + diskSize: 50, + tags: { + Name: "Mng4", + Type: "Managed-InferentiaNode-Group", + LaunchTemplate: "Inferentia", + "kubernetes.io/cluster/blueprint-construct-dev": "owned", + }, + }; } diff --git a/lib/addons/aws-loadbalancer-controller/index.ts b/lib/addons/aws-loadbalancer-controller/index.ts index ccd9b9974..0ed869324 100644 --- a/lib/addons/aws-loadbalancer-controller/index.ts +++ b/lib/addons/aws-loadbalancer-controller/index.ts @@ -57,7 +57,7 @@ const defaultProps: AwsLoadBalancerControllerProps = { chart: AWS_LOAD_BALANCER_CONTROLLER, repository: 'https://aws.github.io/eks-charts', release: AWS_LOAD_BALANCER_CONTROLLER, - version: '1.9.2', + version: '1.11.0', enableShield: false, enableWaf: false, enableWafv2: false, diff --git a/lib/addons/aws-privateca-issuer/index.ts b/lib/addons/aws-privateca-issuer/index.ts index 5a67f4f51..a93ac1fa1 100644 --- a/lib/addons/aws-privateca-issuer/index.ts +++ b/lib/addons/aws-privateca-issuer/index.ts @@ -30,7 +30,7 @@ const defaultProps: HelmAddOnProps & AWSPrivateCAIssuerAddonProps = { name: "blueprints-aws-pca-issuer-addon", chart: "aws-privateca-issuer", namespace:"aws-pca-issuer", - version: "1.3.0", + version: "1.4.0", release: "aws-pca-issuer", repository: "https://cert-manager.github.io/aws-privateca-issuer", values: {}, diff --git a/lib/addons/efs-csi-driver/index.ts b/lib/addons/efs-csi-driver/index.ts index 8ac886031..60c4b01d7 100644 --- a/lib/addons/efs-csi-driver/index.ts +++ b/lib/addons/efs-csi-driver/index.ts @@ -42,7 +42,7 @@ export interface EfsCsiDriverProps extends HelmAddOnUserProps { * Defaults options for the add-on */ const defaultProps: EfsCsiDriverProps = { - version: '3.0.8', + version: '3.1.3', namespace: "kube-system", repository: "https://kubernetes-sigs.github.io/aws-efs-csi-driver/", name: EFS_CSI_DRIVER, diff --git a/lib/addons/s3-csi-driver/index.ts b/lib/addons/s3-csi-driver/index.ts index 5e7da94e6..00e85fbf6 100644 --- a/lib/addons/s3-csi-driver/index.ts +++ b/lib/addons/s3-csi-driver/index.ts @@ -6,7 +6,7 @@ import { createNamespace, setPath, supportsALL } from "../../utils"; import { getS3DriverPolicyStatements } from "./iam-policy"; const S3_CSI_DRIVER_SA = 's3-csi-driver-sa'; -const S3_CSI_DRIVER = 's3-csi-driver'; +const S3_CSI_DRIVER = "aws-mountpoint-s3-csi-driver"; const S3_CSI_DRIVER_RELEASE = 's3-csi-driver-release'; const S3_DRIVER_POLICY = 's3-csi-driver-policy'; @@ -28,14 +28,14 @@ export interface S3CSIDriverAddOnProps extends HelmAddOnUserProps { * Defaults options for the add-on */ const defaultProps: HelmAddOnUserProps & S3CSIDriverAddOnProps = { - chart: S3_CSI_DRIVER, - name: S3_CSI_DRIVER, - namespace: 'kube-system', - release: S3_CSI_DRIVER_RELEASE, - version: 'v1.9.0', - repository: 'https://github.com/awslabs/mountpoint-s3-csi-driver', - createNamespace: false, - s3BucketName: '' + chart: S3_CSI_DRIVER, + name: S3_CSI_DRIVER, + namespace: "kube-system", + release: S3_CSI_DRIVER_RELEASE, + version: "v1.11.0", + repository: "https://awslabs.github.io/mountpoint-s3-csi-driver", + createNamespace: false, + s3BucketName: "", }; @supportsALL diff --git a/lib/utils/addon-utils.ts b/lib/utils/addon-utils.ts index b67db5ad3..a32844d0d 100644 --- a/lib/utils/addon-utils.ts +++ b/lib/utils/addon-utils.ts @@ -35,7 +35,10 @@ export function dependable(...addOns: string[]) { addOns.forEach( (addOn) => { const dep = clusterInfo.getScheduledAddOn(addOn); - assert(dep, `Missing a dependency for ${addOn} for ${stack}`); + + let targetString = target?.constructor?.toString().split("\n")[0] ?? "unknown"; + + assert(dep, `Missing a dependency for ${addOn} for ${stack} and target ${targetString}`); dependencies.push(dep!); });