diff --git a/tests/assets/eks_nodeGroup_launch_template.json b/tests/assets/eks_nodeGroup_launch_template.json deleted file mode 100644 index 70cb8e29..00000000 --- a/tests/assets/eks_nodeGroup_launch_template.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "AWSTemplateFormatVersion": "2010-09-09", - "Description": "Create an EKS Node Group Launch Template", - "Parameters": { - "LaunchTemplateName": { - "Type": "String", - "Description": "Name of the Launch Template" - }, - "ClusterName": { - "Type": "String", - "Description": "Name of the Cluster" - }, - "ImageId": { - "Type": "String", - "Description": "Latest AMI for a given Kubernetes version" - }, - "ClusterCA": { - "Type": "String", - "Description": "Base64-encoded cluster CA certificate" - }, - "APIServerEndpoint": { - "Type": "String", - "Description": "API server endpoint URL" - }, - "DNSClusterIPRange": { - "Type": "String", - "Description": "DNS cluster IP range" - } - }, - "Resources": { - "NodeGroupLaunchTemplate": { - "Type": "AWS::EC2::LaunchTemplate", - "Properties": { - "LaunchTemplateName": { "Ref": "LaunchTemplateName" }, - "LaunchTemplateData": { - "ImageId": { "Ref": "ImageId" }, - "BlockDeviceMappings": [ - { - "DeviceName": "/dev/xvda", - "Ebs": { - "VolumeSize": 20, - "VolumeType": "gp2" - } - } - ], - "UserData": { - "Fn::Base64": { - "Fn::Sub": "MIME-Version: 1.0\nContent-Type: multipart/mixed; boundary=\"==MYBOUNDARY==\"\n\n--==MYBOUNDARY==\nContent-Type: text/x-shellscript; charset=\"us-ascii\"\n\n#!/bin/bash\nset -ex\n/etc/eks/bootstrap.sh ${ClusterName} --b64-cluster-ca ${ClusterCA} --apiserver-endpoint ${APIServerEndpoint} --dns-cluster-ip ${DNSClusterIPRange} --container-runtime containerd\n--==MYBOUNDARY==--" - } - }, - "MetadataOptions": { - "HttpPutResponseHopLimit": 2, - "HttpEndpoint": "enabled", - "HttpTokens": "required" - } - } - } - } - }, - "Outputs": { - "NodeGroupLaunchTemplateName": { - "Description": "Name of the Node Group Launch Template", - "Value": { "Ref": "NodeGroupLaunchTemplate" } - } - } -} \ No newline at end of file diff --git a/tests/pipelines/eks/awscli-cl2-load-with-addons.yaml b/tests/pipelines/eks/awscli-cl2-load-with-addons.yaml index ecd22845..66cc3bd8 100644 --- a/tests/pipelines/eks/awscli-cl2-load-with-addons.yaml +++ b/tests/pipelines/eks/awscli-cl2-load-with-addons.yaml @@ -16,9 +16,6 @@ spec: - name: slack-message - name: amp-workspace-id - name: vpc-cfn-url - default: "https://raw.githubusercontent.com/awslabs/kubernetes-iteration-toolkit/main/tests/assets/amazon-eks-vpc.json" - - name: ng-cfn-url - default: "https://raw.githubusercontent.com/awslabs/kubernetes-iteration-toolkit/main/tests/assets/eks_nodeGroup_launch_template.json" - name: kubernetes-version - name: service-role-cfn-url default: "https://raw.githubusercontent.com/awslabs/kubernetes-iteration-toolkit/main/tests/assets/eks_service_role.json" @@ -92,26 +89,6 @@ spec: workspaces: - name: config workspace: config - - name: create-launch-template - params: - - name: cluster-name - value: $(params.cluster-name) - - name: stack-name - value: $(params.cluster-name)-launch-template - - name: kubernetes-version - value: "$(params.kubernetes-version)" - - name: ng-cfn-url - value: "$(params.ng-cfn-url)" - - name: endpoint - value: $(params.endpoint) - runAfter: - - create-eks-cluster - taskRef: - kind: Task - name: awscli-eks-cfn-launch-template - workspaces: - - name: config - workspace: config - name: create-mng-monitoring-nodes params: - name: cluster-name @@ -131,7 +108,7 @@ spec: - name: nodegroup-prefix value: "monitoring-" runAfter: - - create-launch-template + - create-eks-cluster taskRef: kind: Task name: awscli-eks-nodegroup-create @@ -237,8 +214,6 @@ spec: value: $(params.cluster-name)-service-role - name: node-role-stack-name value: $(params.cluster-name)-node-role - - name: launch-template-stack-name - value: $(params.cluster-name)-launch-template taskRef: kind: Task name: awscli-eks-cluster-teardown diff --git a/tests/pipelines/eks/awscli-eks-cl2-load.yaml b/tests/pipelines/eks/awscli-eks-cl2-load.yaml index 1899fcde..aaef0c83 100644 --- a/tests/pipelines/eks/awscli-eks-cl2-load.yaml +++ b/tests/pipelines/eks/awscli-eks-cl2-load.yaml @@ -18,9 +18,6 @@ spec: - name: slack-hook - name: slack-message - name: vpc-cfn-url - default: "https://raw.githubusercontent.com/awslabs/kubernetes-iteration-toolkit/main/tests/assets/amazon-eks-vpc.json" - - name: ng-cfn-url - default: "https://raw.githubusercontent.com/awslabs/kubernetes-iteration-toolkit/main/tests/assets/eks_nodeGroup_launch_template.json" - name: kubernetes-version default: "1.23" - name: amp-workspace-id @@ -91,26 +88,6 @@ spec: workspaces: - name: config workspace: config - - name: create-cfn-launch-template - params: - - name: cluster-name - value: $(params.cluster-name) - - name: stack-name - value: $(params.cluster-name)-launch-template - - name: kubernetes-version - value: "$(params.kubernetes-version)" - - name: ng-cfn-url - value: "$(params.ng-cfn-url)" - - name: endpoint - value: $(params.endpoint) - runAfter: - - create-eks-cluster - taskRef: - kind: Task - name: awscli-eks-cfn-launch-template - workspaces: - - name: config - workspace: config - name: create-mng-monitoring-nodes params: - name: cluster-name @@ -130,7 +107,7 @@ spec: - name: nodegroup-prefix value: "monitoring-" runAfter: - - create-cfn-launch-template + - create-eks-cluster taskRef: kind: Task name: awscli-eks-nodegroup-create @@ -224,8 +201,6 @@ spec: value: $(params.cluster-name)-service-role - name: node-role-stack-name value: $(params.cluster-name)-node-role - - name: launch-template-stack-name - value: $(params.cluster-name)-launch-template taskRef: kind: Task name: awscli-eks-cluster-teardown diff --git a/tests/tasks/setup/eks/awscli-cfn-lt.yaml b/tests/tasks/setup/eks/awscli-cfn-lt.yaml deleted file mode 100644 index 235dfe37..00000000 --- a/tests/tasks/setup/eks/awscli-cfn-lt.yaml +++ /dev/null @@ -1,69 +0,0 @@ ---- -apiVersion: tekton.dev/v1beta1 -kind: Task -metadata: - name: awscli-eks-cfn-launch-template - namespace: scalability -spec: - description: | - Create an EKS CFN stack to output a launch template. - This Task can be used to create an EKS CFN stack that outputs a launch template. - params: - - name: cluster-name - description: EKS cluster you want to create CFN stack for. - - name: stack-name - description: Stack name you want to spin. - - name: region - default: "us-west-2" - description: The region where the cluster is in. - - name: kubernetes-version - default: "1.28" - description: The EKS version to install. - - name: ng-cfn-url - description: The url of the CFN YAML/JSON to create CFN stack for NG launch template - - name: endpoint - default: "" - workspaces: - - name: config - mountPath: /config/ - stepTemplate: - env: - - name: KUBECONFIG - value: /config/kubeconfig - steps: - - name: create-launch-template - image: alpine/k8s:1.23.7 - script: | - ENDPOINT_FLAG="" - if [ -n "$(params.endpoint)" ]; then - ENDPOINT_FLAG="--endpoint $(params.endpoint)" - fi - - curl -s $(params.ng-cfn-url) -o ./amazon-ng-cfn - - launch_template_name=$(params.cluster-name)-launchTemplate - certificate_authority=$(aws eks $ENDPOINT_FLAG describe-cluster --query "cluster.certificateAuthority.data" --output text --name $(params.cluster-name) --region $(params.region)) - api_server_endpoint=$(aws eks $ENDPOINT_FLAG describe-cluster --query "cluster.endpoint" --output text --name $(params.cluster-name) --region $(params.region)) - dns_cluster_ip=$(aws eks $ENDPOINT_FLAG describe-cluster --query "cluster.kubernetesNetworkConfig.serviceIpv4Cidr" --output text --name $(params.cluster-name) --region $(params.region)) - image_id=$(aws ssm get-parameter --name "/aws/service/eks/optimized-ami/$(params.kubernetes-version)/amazon-linux-2/recommended/image_id" --query "Parameter.Value" --output text) - - STACK_NAME=$(params.stack-name) - STACK_STATUS=$(aws cloudformation describe-stacks --query 'Stacks[?StackName==`'${STACK_NAME}'`].StackStatus' --output text --region $(params.region)) - - if [[ "$STACK_STATUS" == "" ]]; then - aws cloudformation create-stack \ - --stack-name $STACK_NAME \ - --template-body file://$(pwd)/amazon-ng-cfn \ - --parameters ParameterKey=LaunchTemplateName,ParameterValue=$launch_template_name\ - ParameterKey=ImageId,ParameterValue=$image_id\ - ParameterKey=ClusterName,ParameterValue=$(params.cluster-name)\ - ParameterKey=ClusterCA,ParameterValue=$certificate_authority\ - ParameterKey=APIServerEndpoint,ParameterValue=$api_server_endpoint\ - ParameterKey=DNSClusterIPRange,ParameterValue=$dns_cluster_ip\ - --region $(params.region) - - aws cloudformation wait stack-create-complete --stack-name $STACK_NAME --region $(params.region) - echo "CREATED_CFN_STACK=$STACK_NAME" - else - echo "$STACK_NAME Already exists" - fi \ No newline at end of file diff --git a/tests/tasks/setup/eks/awscli-mng.yaml b/tests/tasks/setup/eks/awscli-mng.yaml index ab38b7f5..0a2561b7 100644 --- a/tests/tasks/setup/eks/awscli-mng.yaml +++ b/tests/tasks/setup/eks/awscli-mng.yaml @@ -75,11 +75,9 @@ spec: asgs=$((nodes/max_nodes)) echo "asgs: $asgs" node_group=$(params.nodegroup-prefix)$(params.cluster-name)-nodes - create_and_validate_dp_nodes() { node_group_name=$node_group-$1 - launch_template_name=$(params.cluster-name)-launchTemplate CREATED_NODEGROUP=$(aws eks $ENDPOINT_FLAG --region $(params.region) list-nodegroups --cluster-name $(params.cluster-name) --query 'nodegroups[?@==`'$node_group_name'`]' --output text) EC2_INSTANCES=$3 if [ "$CREATED_NODEGROUP" == "" ]; then @@ -88,7 +86,6 @@ spec: --cluster-name $(params.cluster-name) \ --nodegroup-name $node_group_name \ --node-role $NODE_ROLE_ARN \ - --launch-template name=$launch_template_name\ --region $(params.region) \ --instance-types $EC2_INSTANCES \ --scaling-config minSize=$(params.min-nodes),maxSize=$2,desiredSize=$2 \ diff --git a/tests/tasks/teardown/awscli-eks.yaml b/tests/tasks/teardown/awscli-eks.yaml index 579eb6de..3d6714c7 100644 --- a/tests/tasks/teardown/awscli-eks.yaml +++ b/tests/tasks/teardown/awscli-eks.yaml @@ -22,7 +22,6 @@ spec: default: "Job is completed" - name: service-role-stack-name - name: node-role-stack-name - - name: launch-template-stack-name steps: - name: delete-cluster image: alpine/k8s:1.23.7 @@ -43,7 +42,6 @@ spec: script: | aws cloudformation delete-stack --stack-name $(params.service-role-stack-name) aws cloudformation delete-stack --stack-name $(params.node-role-stack-name) - aws cloudformation delete-stack --stack-name $(params.launch-template-stack-name) - name: send-slack-notification image: alpine/k8s:1.23.7 script: | diff --git a/tests/tasks/teardown/awscli-vpc-delete.yaml b/tests/tasks/teardown/awscli-vpc-delete.yaml index d4173aa7..328d90e6 100644 --- a/tests/tasks/teardown/awscli-vpc-delete.yaml +++ b/tests/tasks/teardown/awscli-vpc-delete.yaml @@ -29,4 +29,4 @@ spec: aws cloudformation delete-stack --region $(params.region) --stack-name $(params.stack-name) # Wait for the stack to be deleted aws cloudformation wait stack-delete-complete --region $(params.region) --stack-name $(params.stack-name) - echo "Stack deleted successfully!" \ No newline at end of file + echo "Stack deleted successfully!"