From 8ada27939ada2b9ce5e24f21783b3d6806ee9950 Mon Sep 17 00:00:00 2001 From: Myles Williams Date: Fri, 28 Jul 2023 12:57:03 -0600 Subject: [PATCH 1/8] Fix deprecated patches support with kustomize for k8s v1.27.0 release --- .../controlplanes/ack/rds/application/kustomization.yaml | 2 +- .../crossplane/application/kustomization.yaml | 2 +- .../compositions/application/kustomization.yaml | 2 +- .../gitops/argocd/update-application/kustomization.yaml | 2 +- .../compute/karpenter/consolidation/kustomization.yaml | 2 +- .../modules/autoscaling/workloads/hpa/kustomization.yaml | 2 +- .../exposing/load-balancer/ip-mode/kustomization.yaml | 2 +- .../affinity/checkout-redis/kustomization.yaml | 4 ++-- .../fundamentals/affinity/checkout/kustomization.yaml | 2 +- .../fundamentals/fargate/enabling/kustomization.yaml | 2 +- .../fundamentals/fargate/scaling/kustomization.yaml | 2 +- .../fundamentals/fargate/sizing/kustomization.yaml | 2 +- .../taints/nodeselector-w-toleration/kustomization.yaml | 2 +- .../taints/nodeselector-wo-toleration/kustomization.yaml | 2 +- .../storage/efs/deployment/kustomization.yaml | 2 +- .../storage/fsxn/deployment/kustomization.yaml | 2 +- .../modules/introduction/kustomize/kustomization.yaml | 2 +- .../custom-networking/sampleapp/kustomization.yaml | 2 +- .../securitygroups-for-pods/rds/kustomization.yaml | 4 ++-- .../networking/vpc-lattice/abtesting/kustomization.yaml | 8 ++++---- .../security/irsa/service-account/kustomization.yaml | 2 +- .../pss-psa/baseline-namespace/kustomization.yaml | 4 ++-- .../security/pss-psa/baseline-workload/kustomization.yaml | 2 +- .../pss-psa/privileged-workload/kustomization.yaml | 2 +- .../pss-psa/restricted-namespace/kustomization.yaml | 2 +- .../pss-psa/restricted-workload/kustomization.yaml | 4 ++-- .../modules/security/sealed-secrets/kustomization.yaml | 2 +- website/.gitignore | 1 + 28 files changed, 35 insertions(+), 34 deletions(-) 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 e8cf297b3..73b760237 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 6843148f4..08234fb34 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: - ../../../../manifests/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/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 From f01275993269d6c406ea8075643d9f5194f685bc Mon Sep 17 00:00:00 2001 From: Math Bruneau Date: Fri, 6 Oct 2023 15:15:39 -0400 Subject: [PATCH 2/8] SSM run root so no need for sudo Added logging to ease troubleshooting --- lab/cfn/eks-workshop-ide-cfn.yaml | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/lab/cfn/eks-workshop-ide-cfn.yaml b/lab/cfn/eks-workshop-ide-cfn.yaml index 1ece7632d..192164888 100644 --- a/lab/cfn/eks-workshop-ide-cfn.yaml +++ b/lab/cfn/eks-workshop-ide-cfn.yaml @@ -27,7 +27,7 @@ Parameters: EksWorkshopC9InstanceVolumeSize: Type: Number Description: The Size in GB of the Cloud9 Instance Volume. - Default: 30 + Default: "30" RepositoryOwner: Type: String Description: The owner of the GitHub repository to be used to bootstrap Cloud9 @@ -170,10 +170,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 +191,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 +199,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=[ @@ -232,6 +234,7 @@ Resources: if block_device['Size'] != 30: ec2.modify_volume(VolumeId=block_volume_id,Size=30) + logger.info('Modifying block volume: {}'.format(block_volume_id)) for i in range(1, 30): response = ssm.describe_instance_information(Filters=[{'Key': 'InstanceIds', 'Values': [instance_id]}]) @@ -294,20 +297,20 @@ Resources: if [[ ! -f "$marker_file" ]]; then if [ $(readlink -f /dev/xvda) = "/dev/xvda" ] then - sudo growpart /dev/xvda 1 + growpart /dev/xvda 1 if [[ "$STR" == *"$SUB"* ]] then - sudo xfs_growfs -d / + xfs_growfs -d / else - sudo resize2fs /dev/xvda1 + resize2fs /dev/xvda1 fi else - sudo growpart /dev/nvme0n1 1 + growpart /dev/nvme0n1 1 if [[ "$STR" == *"$SUB"* ]] then - sudo xfs_growfs -d / + xfs_growfs -d / else - sudo resize2fs /dev/nvme0n1p1 + resize2fs /dev/nvme0n1p1 fi fi fi From 7fff90260c9902f4633bad62d6c191aea372a812 Mon Sep 17 00:00:00 2001 From: Math Bruneau Date: Fri, 6 Oct 2023 15:18:58 -0400 Subject: [PATCH 3/8] Added node_modules to .gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 From bd276a8ac16c799f572724248cd8748bd7367e06 Mon Sep 17 00:00:00 2001 From: Math Bruneau Date: Fri, 6 Oct 2023 16:05:01 -0400 Subject: [PATCH 4/8] Cleanup a few of cfn-lint --- lab/cfn/eks-workshop-ide-cfn.yaml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lab/cfn/eks-workshop-ide-cfn.yaml b/lab/cfn/eks-workshop-ide-cfn.yaml index 192164888..87879fc59 100644 --- a/lab/cfn/eks-workshop-ide-cfn.yaml +++ b/lab/cfn/eks-workshop-ide-cfn.yaml @@ -25,9 +25,9 @@ Parameters: Description: The Arn of the Cloud9 Owner to be set if 3rdParty deployment. Default: "" EksWorkshopC9InstanceVolumeSize: - Type: Number + Type: String Description: The Size in GB of the Cloud9 Instance Volume. - Default: "30" + Default: "50" RepositoryOwner: Type: String Description: The owner of the GitHub repository to be used to bootstrap Cloud9 @@ -127,9 +127,6 @@ Resources: Description: Bootstrap Cloud9 instance Type: Custom::EksWorkshopC9BootstrapInstanceLambda DependsOn: - - EksWorkshopC9BootstrapInstanceLambdaFunction - - EksWorkshopC9Instance - - EksWorkshopC9InstanceProfile - EksWorkshopC9LambdaExecutionRole Properties: ServiceToken: @@ -159,6 +156,10 @@ Resources: - EksWorkshopC9LambdaExecutionRole - Arn Runtime: python3.9 + Environment: + Variables: + DiskSize: + Ref: EksWorkshopC9InstanceVolumeSize MemorySize: 256 Timeout: '600' Code: @@ -232,8 +233,9 @@ 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 = 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)) for i in range(1, 30): From a6a6b919c928a82e3f779ccfab13ef84a449df24 Mon Sep 17 00:00:00 2001 From: Math Bruneau Date: Fri, 6 Oct 2023 16:58:46 -0400 Subject: [PATCH 5/8] Added sleep for race condition --- lab/cfn/eks-workshop-ide-cfn.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lab/cfn/eks-workshop-ide-cfn.yaml b/lab/cfn/eks-workshop-ide-cfn.yaml index 87879fc59..7610a2920 100644 --- a/lab/cfn/eks-workshop-ide-cfn.yaml +++ b/lab/cfn/eks-workshop-ide-cfn.yaml @@ -25,9 +25,9 @@ Parameters: Description: The Arn of the Cloud9 Owner to be set if 3rdParty deployment. Default: "" EksWorkshopC9InstanceVolumeSize: - Type: String + Type: Number Description: The Size in GB of the Cloud9 Instance Volume. - Default: "50" + Default: 50 RepositoryOwner: Type: String Description: The owner of the GitHub repository to be used to bootstrap Cloud9 @@ -233,10 +233,11 @@ Resources: block_device = ec2.describe_volumes(VolumeIds=[block_volume_id])['Volumes'][0] - DiskSize = os.environ['DiskSize']; + 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]}]) From a05cf1b3d593c4a1e0d8f4d9f21c73003f04e109 Mon Sep 17 00:00:00 2001 From: Math Bruneau Date: Tue, 10 Oct 2023 10:58:20 -0400 Subject: [PATCH 6/8] Just do a reboot so Cloud9 automatically resize --- lab/cfn/eks-workshop-ide-cfn.yaml | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/lab/cfn/eks-workshop-ide-cfn.yaml b/lab/cfn/eks-workshop-ide-cfn.yaml index 7610a2920..f35165d68 100644 --- a/lab/cfn/eks-workshop-ide-cfn.yaml +++ b/lab/cfn/eks-workshop-ide-cfn.yaml @@ -292,34 +292,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 - growpart /dev/xvda 1 - if [[ "$STR" == *"$SUB"* ]] - then - xfs_growfs -d / - else - resize2fs /dev/xvda1 - fi - else - growpart /dev/nvme0n1 1 - if [[ "$STR" == *"$SUB"* ]] - then - xfs_growfs -d / - else - resize2fs /dev/nvme0n1p1 - fi - fi - fi - - touch $marker_file - export AWS_REGION="${AWS::Region}" export REPOSITORY_OWNER="${RepositoryOwner}" export REPOSITORY_NAME="${RepositoryName}" @@ -331,6 +303,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: From f604c5ab256962dd2e215860c0b090971975f5b4 Mon Sep 17 00:00:00 2001 From: Math Bruneau Date: Tue, 10 Oct 2023 13:43:16 -0400 Subject: [PATCH 7/8] Added possible subnet to override Cloud9 Remove description invalid based on cfn-lint --- lab/cfn/eks-workshop-ide-cfn.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lab/cfn/eks-workshop-ide-cfn.yaml b/lab/cfn/eks-workshop-ide-cfn.yaml index f35165d68..c8dbc787b 100644 --- a/lab/cfn/eks-workshop-ide-cfn.yaml +++ b/lab/cfn/eks-workshop-ide-cfn.yaml @@ -27,7 +27,7 @@ Parameters: EksWorkshopC9InstanceVolumeSize: Type: Number Description: The Size in GB of the Cloud9 Instance Volume. - Default: 50 + Default: 30 RepositoryOwner: Type: String Description: The owner of the GitHub repository to be used to bootstrap Cloud9 @@ -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,7 +129,6 @@ Resources: Resource: "*" EksWorkshopC9BootstrapInstanceLambda: - Description: Bootstrap Cloud9 instance Type: Custom::EksWorkshopC9BootstrapInstanceLambda DependsOn: - EksWorkshopC9LambdaExecutionRole @@ -314,7 +318,6 @@ Resources: - Ref: EksWorkshopC9Role EksWorkshopC9Instance: - Description: "-" Type: AWS::Cloud9::EnvironmentEC2 Properties: Description: AWS Cloud9 instance for EKS Workshop @@ -322,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: From 7eec27a0b94636ea460ceda2ca60440614494fe1 Mon Sep 17 00:00:00 2001 From: Niall Thomson Date: Tue, 10 Oct 2023 23:03:07 +0000 Subject: [PATCH 8/8] Migrate to new nodes install steps --- test/Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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