diff --git a/.gitignore b/.gitignore index 770eddcb9..af10553ca 100644 --- a/.gitignore +++ b/.gitignore @@ -32,4 +32,5 @@ env cdk.out -.envrc \ No newline at end of file +.envrc +node_modules diff --git a/lab/cfn/eks-workshop-ide-cfn.yaml b/lab/cfn/eks-workshop-ide-cfn.yaml index 1ece7632d..c8dbc787b 100644 --- a/lab/cfn/eks-workshop-ide-cfn.yaml +++ b/lab/cfn/eks-workshop-ide-cfn.yaml @@ -44,6 +44,10 @@ Parameters: Type: String Description: Name of the Cloud9 instance Default: "none" + Cloud9Subnet: + Type: String + Description: If you want Cloud9 in a specific subnet + Default: "none" ResourcesPrecreated: Type: String Description: Whether lab infrastructure has been pre-provisioned @@ -55,6 +59,7 @@ Parameters: Conditions: Create3rdPartyResources: !Equals [ !Ref EksWorkshopC9EnvType, 3rdParty ] IsCloud9NotNamed: !Equals [ !Ref Cloud9Name, none ] + IsCloud9SubnetSpecified: !Not [ !Equals [ !Ref Cloud9Subnet, none ]] Resources: EksWorkshopC9Role: @@ -124,12 +129,8 @@ Resources: Resource: "*" EksWorkshopC9BootstrapInstanceLambda: - Description: Bootstrap Cloud9 instance Type: Custom::EksWorkshopC9BootstrapInstanceLambda DependsOn: - - EksWorkshopC9BootstrapInstanceLambdaFunction - - EksWorkshopC9Instance - - EksWorkshopC9InstanceProfile - EksWorkshopC9LambdaExecutionRole Properties: ServiceToken: @@ -159,6 +160,10 @@ Resources: - EksWorkshopC9LambdaExecutionRole - Arn Runtime: python3.9 + Environment: + Variables: + DiskSize: + Ref: EksWorkshopC9InstanceVolumeSize MemorySize: 256 Timeout: '600' Code: @@ -170,10 +175,12 @@ Resources: import time import traceback import cfnresponse + import logging + logger = logging.getLogger(__name__) def lambda_handler(event, context): print(event.values()) - # logger.info('context: {}'.format(context)) + logger.info('context: {}'.format(context)) responseData = {} status = cfnresponse.SUCCESS @@ -189,7 +196,7 @@ Resources: # Get the InstanceId of the Cloud9 IDE instance = ec2.describe_instances(Filters=[{'Name': 'tag:Name','Values': ['aws-cloud9-'+event['ResourceProperties']['Cloud9Name']+'-'+event['ResourceProperties']['EnvironmentId']]}])['Reservations'][0]['Instances'][0] - # logger.info('instance: {}'.format(instance)) + logger.info('instance: {}'.format(instance)) instance_id = instance['InstanceId'] # Create the IamInstanceProfile request object @@ -197,17 +204,17 @@ Resources: 'Arn': event['ResourceProperties']['LabIdeInstanceProfileArn'], 'Name': event['ResourceProperties']['LabIdeInstanceProfileName'] } - # logger.info('iam_instance_profile: {}'.format(iam_instance_profile)) + logger.info('iam_instance_profile: {}'.format(iam_instance_profile)) time.sleep(10) # Wait for Instance to become ready before adding Role instance_state = instance['State']['Name'] - # logger.info('instance_state: {}'.format(instance_state)) + logger.info('instance_state: {}'.format(instance_state)) while instance_state != 'running': time.sleep(5) instance_state = ec2.describe_instances(InstanceIds=[instance_id]) - # logger.info('instance_state: {}'.format(instance_state)) + logger.info('instance_state: {}'.format(instance_state)) associations = ec2.describe_iam_instance_profile_associations( Filters=[ @@ -230,8 +237,11 @@ Resources: block_device = ec2.describe_volumes(VolumeIds=[block_volume_id])['Volumes'][0] - if block_device['Size'] != 30: - ec2.modify_volume(VolumeId=block_volume_id,Size=30) + DiskSize = int(os.environ['DiskSize']) + if block_device['Size'] < DiskSize: + ec2.modify_volume(VolumeId=block_volume_id,Size=DiskSize) + logger.info('Modifying block volume: {}'.format(block_volume_id)) + time.sleep(10) for i in range(1, 30): response = ssm.describe_instance_information(Filters=[{'Key': 'InstanceIds', 'Values': [instance_id]}]) @@ -286,34 +296,6 @@ Resources: - !Sub | set -e - STR=$(cat /etc/os-release) - SUB="VERSION_ID=\"2\"" - - marker_file="/root/resized.mark" - - if [[ ! -f "$marker_file" ]]; then - if [ $(readlink -f /dev/xvda) = "/dev/xvda" ] - then - sudo growpart /dev/xvda 1 - if [[ "$STR" == *"$SUB"* ]] - then - sudo xfs_growfs -d / - else - sudo resize2fs /dev/xvda1 - fi - else - sudo growpart /dev/nvme0n1 1 - if [[ "$STR" == *"$SUB"* ]] - then - sudo xfs_growfs -d / - else - sudo resize2fs /dev/nvme0n1p1 - fi - fi - fi - - touch $marker_file - export AWS_REGION="${AWS::Region}" export REPOSITORY_OWNER="${RepositoryOwner}" export REPOSITORY_NAME="${RepositoryName}" @@ -325,6 +307,9 @@ Resources: sudo -E -H -u ec2-user bash -c "curl -fsSL https://raw.githubusercontent.com/${RepositoryOwner}/${RepositoryName}/${RepositoryRef}/lab/scripts/setup.sh | bash" + echo 'Rebooting...' + reboot + EksWorkshopC9InstanceProfile: Type: AWS::IAM::InstanceProfile Properties: @@ -333,7 +318,6 @@ Resources: - Ref: EksWorkshopC9Role EksWorkshopC9Instance: - Description: "-" Type: AWS::Cloud9::EnvironmentEC2 Properties: Description: AWS Cloud9 instance for EKS Workshop @@ -341,6 +325,7 @@ Resources: AutomaticStopTimeMinutes: 3600 InstanceType: Ref: EksWorkshopC9InstanceType + SubnetId: !If [ IsCloud9SubnetSpecified, !Ref Cloud9Subnet, !Ref "AWS::NoValue" ] Name: !If [ IsCloud9NotNamed, !Ref AWS::StackName, !Ref Cloud9Name ] OwnerArn: !If [ Create3rdPartyResources, !Ref WorkshopOwnerArn, !Ref "AWS::NoValue" ] Tags: diff --git a/manifests/modules/automation/controlplanes/ack/rds/application/kustomization.yaml b/manifests/modules/automation/controlplanes/ack/rds/application/kustomization.yaml index ba5518880..37a45c569 100644 --- a/manifests/modules/automation/controlplanes/ack/rds/application/kustomization.yaml +++ b/manifests/modules/automation/controlplanes/ack/rds/application/kustomization.yaml @@ -5,4 +5,4 @@ bases: resources: - nlb.yaml patches: -- deployment.yaml +- path: deployment.yaml diff --git a/manifests/modules/automation/controlplanes/crossplane/application/kustomization.yaml b/manifests/modules/automation/controlplanes/crossplane/application/kustomization.yaml index 49d186779..991d48aec 100644 --- a/manifests/modules/automation/controlplanes/crossplane/application/kustomization.yaml +++ b/manifests/modules/automation/controlplanes/crossplane/application/kustomization.yaml @@ -5,4 +5,4 @@ bases: resources: - nlb.yaml patches: -- deployment.yaml +- path: deployment.yaml diff --git a/manifests/modules/automation/controlplanes/crossplane/compositions/application/kustomization.yaml b/manifests/modules/automation/controlplanes/crossplane/compositions/application/kustomization.yaml index ba5518880..37a45c569 100644 --- a/manifests/modules/automation/controlplanes/crossplane/compositions/application/kustomization.yaml +++ b/manifests/modules/automation/controlplanes/crossplane/compositions/application/kustomization.yaml @@ -5,4 +5,4 @@ bases: resources: - nlb.yaml patches: -- deployment.yaml +- path: deployment.yaml diff --git a/manifests/modules/automation/gitops/argocd/update-application/kustomization.yaml b/manifests/modules/automation/gitops/argocd/update-application/kustomization.yaml index a3e552e8a..7f66d1cce 100644 --- a/manifests/modules/automation/gitops/argocd/update-application/kustomization.yaml +++ b/manifests/modules/automation/gitops/argocd/update-application/kustomization.yaml @@ -5,4 +5,4 @@ bases: # HIGHLIGHT patches: # HIGHLIGHT -- deployment-patch.yaml +- path: deployment-patch.yaml diff --git a/manifests/modules/autoscaling/compute/karpenter/consolidation/kustomization.yaml b/manifests/modules/autoscaling/compute/karpenter/consolidation/kustomization.yaml index 33cf4e54b..d3f2628de 100644 --- a/manifests/modules/autoscaling/compute/karpenter/consolidation/kustomization.yaml +++ b/manifests/modules/autoscaling/compute/karpenter/consolidation/kustomization.yaml @@ -3,4 +3,4 @@ kind: Kustomization bases: - ../provisioner patches: -- provisioner.yaml +- path: provisioner.yaml diff --git a/manifests/modules/autoscaling/workloads/hpa/kustomization.yaml b/manifests/modules/autoscaling/workloads/hpa/kustomization.yaml index e2e6c40fc..f148f91a1 100644 --- a/manifests/modules/autoscaling/workloads/hpa/kustomization.yaml +++ b/manifests/modules/autoscaling/workloads/hpa/kustomization.yaml @@ -5,4 +5,4 @@ bases: resources: - hpa.yaml patches: -- deployment.yaml +- path: deployment.yaml diff --git a/manifests/modules/exposing/load-balancer/ip-mode/kustomization.yaml b/manifests/modules/exposing/load-balancer/ip-mode/kustomization.yaml index c707829c1..79f736542 100644 --- a/manifests/modules/exposing/load-balancer/ip-mode/kustomization.yaml +++ b/manifests/modules/exposing/load-balancer/ip-mode/kustomization.yaml @@ -3,4 +3,4 @@ kind: Kustomization bases: - ../nlb patches: -- nlb.yaml +- path: nlb.yaml diff --git a/manifests/modules/fundamentals/affinity/checkout-redis/kustomization.yaml b/manifests/modules/fundamentals/affinity/checkout-redis/kustomization.yaml index b2fca98d6..0445323d2 100644 --- a/manifests/modules/fundamentals/affinity/checkout-redis/kustomization.yaml +++ b/manifests/modules/fundamentals/affinity/checkout-redis/kustomization.yaml @@ -3,5 +3,5 @@ kind: Kustomization bases: - ../checkout patches: -- checkout-redis.yaml -- checkout.yaml +- path: checkout-redis.yaml +- path: checkout.yaml diff --git a/manifests/modules/fundamentals/affinity/checkout/kustomization.yaml b/manifests/modules/fundamentals/affinity/checkout/kustomization.yaml index b09d91cb5..96d3e269b 100644 --- a/manifests/modules/fundamentals/affinity/checkout/kustomization.yaml +++ b/manifests/modules/fundamentals/affinity/checkout/kustomization.yaml @@ -3,4 +3,4 @@ kind: Kustomization bases: - ../../../../base-application/checkout/ patches: -- checkout.yaml +- path: checkout.yaml diff --git a/manifests/modules/fundamentals/fargate/enabling/kustomization.yaml b/manifests/modules/fundamentals/fargate/enabling/kustomization.yaml index 118f80502..58c312422 100644 --- a/manifests/modules/fundamentals/fargate/enabling/kustomization.yaml +++ b/manifests/modules/fundamentals/fargate/enabling/kustomization.yaml @@ -3,4 +3,4 @@ kind: Kustomization bases: - ../../../../base-application/checkout patches: -- deployment.yaml +- path: deployment.yaml diff --git a/manifests/modules/fundamentals/fargate/scaling/kustomization.yaml b/manifests/modules/fundamentals/fargate/scaling/kustomization.yaml index ba56ab275..9db298de1 100644 --- a/manifests/modules/fundamentals/fargate/scaling/kustomization.yaml +++ b/manifests/modules/fundamentals/fargate/scaling/kustomization.yaml @@ -3,4 +3,4 @@ kind: Kustomization bases: - ../sizing patches: -- deployment.yaml +- path: deployment.yaml diff --git a/manifests/modules/fundamentals/fargate/sizing/kustomization.yaml b/manifests/modules/fundamentals/fargate/sizing/kustomization.yaml index 206c8efc4..86587a8b0 100644 --- a/manifests/modules/fundamentals/fargate/sizing/kustomization.yaml +++ b/manifests/modules/fundamentals/fargate/sizing/kustomization.yaml @@ -3,4 +3,4 @@ kind: Kustomization bases: - ../enabling patches: -- deployment.yaml +- path: deployment.yaml diff --git a/manifests/modules/fundamentals/mng/taints/nodeselector-w-toleration/kustomization.yaml b/manifests/modules/fundamentals/mng/taints/nodeselector-w-toleration/kustomization.yaml index 42bf833d4..0fd555687 100644 --- a/manifests/modules/fundamentals/mng/taints/nodeselector-w-toleration/kustomization.yaml +++ b/manifests/modules/fundamentals/mng/taints/nodeselector-w-toleration/kustomization.yaml @@ -3,4 +3,4 @@ kind: Kustomization bases: - ../../../../../base-application/ui patches: -- deployment.yaml +- path: deployment.yaml diff --git a/manifests/modules/fundamentals/mng/taints/nodeselector-wo-toleration/kustomization.yaml b/manifests/modules/fundamentals/mng/taints/nodeselector-wo-toleration/kustomization.yaml index 42bf833d4..0fd555687 100644 --- a/manifests/modules/fundamentals/mng/taints/nodeselector-wo-toleration/kustomization.yaml +++ b/manifests/modules/fundamentals/mng/taints/nodeselector-wo-toleration/kustomization.yaml @@ -3,4 +3,4 @@ kind: Kustomization bases: - ../../../../../base-application/ui patches: -- deployment.yaml +- path: deployment.yaml diff --git a/manifests/modules/fundamentals/storage/efs/deployment/kustomization.yaml b/manifests/modules/fundamentals/storage/efs/deployment/kustomization.yaml index c675f4971..8d5b1463e 100644 --- a/manifests/modules/fundamentals/storage/efs/deployment/kustomization.yaml +++ b/manifests/modules/fundamentals/storage/efs/deployment/kustomization.yaml @@ -5,4 +5,4 @@ bases: resources: - efspvclaim.yaml patches: -- deployment.yaml +- path: deployment.yaml diff --git a/manifests/modules/fundamentals/storage/fsxn/deployment/kustomization.yaml b/manifests/modules/fundamentals/storage/fsxn/deployment/kustomization.yaml index 8ec26aba4..70430eaf0 100644 --- a/manifests/modules/fundamentals/storage/fsxn/deployment/kustomization.yaml +++ b/manifests/modules/fundamentals/storage/fsxn/deployment/kustomization.yaml @@ -5,4 +5,4 @@ bases: resources: - fsxnpvclaim.yaml patches: -- deployment.yaml +- path: deployment.yaml diff --git a/manifests/modules/introduction/kustomize/kustomization.yaml b/manifests/modules/introduction/kustomize/kustomization.yaml index 08f713e3c..b753e3edf 100644 --- a/manifests/modules/introduction/kustomize/kustomization.yaml +++ b/manifests/modules/introduction/kustomize/kustomization.yaml @@ -3,4 +3,4 @@ kind: Kustomization bases: - ../../../base-application/checkout patches: -- deployment.yaml +- path: deployment.yaml diff --git a/manifests/modules/networking/custom-networking/sampleapp/kustomization.yaml b/manifests/modules/networking/custom-networking/sampleapp/kustomization.yaml index b09d91cb5..96d3e269b 100644 --- a/manifests/modules/networking/custom-networking/sampleapp/kustomization.yaml +++ b/manifests/modules/networking/custom-networking/sampleapp/kustomization.yaml @@ -3,4 +3,4 @@ kind: Kustomization bases: - ../../../../base-application/checkout/ patches: -- checkout.yaml +- path: checkout.yaml diff --git a/manifests/modules/networking/securitygroups-for-pods/rds/kustomization.yaml b/manifests/modules/networking/securitygroups-for-pods/rds/kustomization.yaml index 4a00eaee8..500ecd5ce 100644 --- a/manifests/modules/networking/securitygroups-for-pods/rds/kustomization.yaml +++ b/manifests/modules/networking/securitygroups-for-pods/rds/kustomization.yaml @@ -22,8 +22,8 @@ vars: fieldref: fieldpath: data.CATALOG_RDS_PASSWORD patches: -- catalog-configMap.yaml -- secrets.yaml +- path: catalog-configMap.yaml +- path: secrets.yaml resources: - nlb.yaml configurations: diff --git a/manifests/modules/networking/vpc-lattice/abtesting/kustomization.yaml b/manifests/modules/networking/vpc-lattice/abtesting/kustomization.yaml index f574a41c0..29311e3d1 100644 --- a/manifests/modules/networking/vpc-lattice/abtesting/kustomization.yaml +++ b/manifests/modules/networking/vpc-lattice/abtesting/kustomization.yaml @@ -4,7 +4,7 @@ namespace: checkoutv2 resources: - ../../../../base-application/checkout patches: - - deploymentv2.yaml - - servicev2.yaml - - delete-deployment-redis.yaml - - delete-service-redis.yaml +- path: deploymentv2.yaml +- path: servicev2.yaml +- path: delete-deployment-redis.yaml +- path: delete-service-redis.yaml diff --git a/manifests/modules/security/irsa/service-account/kustomization.yaml b/manifests/modules/security/irsa/service-account/kustomization.yaml index 5ef079951..19776b071 100644 --- a/manifests/modules/security/irsa/service-account/kustomization.yaml +++ b/manifests/modules/security/irsa/service-account/kustomization.yaml @@ -15,4 +15,4 @@ vars: fieldref: fieldpath: data.CARTS_IAM_ROLE patches: -- carts-serviceAccount.yaml +- path: carts-serviceAccount.yaml diff --git a/manifests/modules/security/pss-psa/baseline-namespace/kustomization.yaml b/manifests/modules/security/pss-psa/baseline-namespace/kustomization.yaml index 3f16893fb..1ec8c493d 100644 --- a/manifests/modules/security/pss-psa/baseline-namespace/kustomization.yaml +++ b/manifests/modules/security/pss-psa/baseline-namespace/kustomization.yaml @@ -3,5 +3,5 @@ kind: Kustomization bases: - ../base patches: -- namespace.yaml -- deployment.yaml +- path: namespace.yaml +- path: deployment.yaml diff --git a/manifests/modules/security/pss-psa/baseline-workload/kustomization.yaml b/manifests/modules/security/pss-psa/baseline-workload/kustomization.yaml index bc3e361ba..4e7376341 100644 --- a/manifests/modules/security/pss-psa/baseline-workload/kustomization.yaml +++ b/manifests/modules/security/pss-psa/baseline-workload/kustomization.yaml @@ -3,4 +3,4 @@ kind: Kustomization bases: - ../base patches: -- namespace.yaml +- path: namespace.yaml diff --git a/manifests/modules/security/pss-psa/privileged-workload/kustomization.yaml b/manifests/modules/security/pss-psa/privileged-workload/kustomization.yaml index 3a4b9c3b9..e6975afce 100644 --- a/manifests/modules/security/pss-psa/privileged-workload/kustomization.yaml +++ b/manifests/modules/security/pss-psa/privileged-workload/kustomization.yaml @@ -3,4 +3,4 @@ kind: Kustomization bases: - ../base patches: -- deployment.yaml +- path: deployment.yaml diff --git a/manifests/modules/security/pss-psa/restricted-namespace/kustomization.yaml b/manifests/modules/security/pss-psa/restricted-namespace/kustomization.yaml index bc3e361ba..4e7376341 100644 --- a/manifests/modules/security/pss-psa/restricted-namespace/kustomization.yaml +++ b/manifests/modules/security/pss-psa/restricted-namespace/kustomization.yaml @@ -3,4 +3,4 @@ kind: Kustomization bases: - ../base patches: -- namespace.yaml +- path: namespace.yaml diff --git a/manifests/modules/security/pss-psa/restricted-workload/kustomization.yaml b/manifests/modules/security/pss-psa/restricted-workload/kustomization.yaml index 3f16893fb..1ec8c493d 100644 --- a/manifests/modules/security/pss-psa/restricted-workload/kustomization.yaml +++ b/manifests/modules/security/pss-psa/restricted-workload/kustomization.yaml @@ -3,5 +3,5 @@ kind: Kustomization bases: - ../base patches: -- namespace.yaml -- deployment.yaml +- path: namespace.yaml +- path: deployment.yaml diff --git a/manifests/modules/security/sealed-secrets/kustomization.yaml b/manifests/modules/security/sealed-secrets/kustomization.yaml index 8e63958a0..64247acfa 100644 --- a/manifests/modules/security/sealed-secrets/kustomization.yaml +++ b/manifests/modules/security/sealed-secrets/kustomization.yaml @@ -3,4 +3,4 @@ kind: Kustomization bases: - ../../../base-application/catalog patches: -- deployment.yaml +- path: deployment.yaml diff --git a/test/Dockerfile b/test/Dockerfile index 1448b4d75..cb03a59fd 100644 --- a/test/Dockerfile +++ b/test/Dockerfile @@ -2,9 +2,8 @@ FROM eks-workshop-environment USER root -RUN curl -sL https://rpm.nodesource.com/setup_16.x | bash - && \ - yum install -y nodejs npm aws-cli procps && \ - yum clean all +RUN yum install https://rpm.nodesource.com/pub_16.x/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm -y && \ + yum install nodejs -y --setopt=nodesource-nodejs.module_hotfixes=1 WORKDIR /app diff --git a/website/.gitignore b/website/.gitignore index b2d6de306..4d8604572 100644 --- a/website/.gitignore +++ b/website/.gitignore @@ -18,3 +18,4 @@ npm-debug.log* yarn-debug.log* yarn-error.log* +yarn.lock