-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds changes for using custom launch template
This commit adds changes for using custom launch template for worker nodes to PVRE and IMDSV2 issues. Signed-off-by: Ashish Ranjan <rnshis@amazon.com>
- Loading branch information
1 parent
04e3a4e
commit 597cd30
Showing
8 changed files
with
214 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"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" | ||
} | ||
}, | ||
"Resources": { | ||
"NodeGroupLaunchTemplate": { | ||
"Type": "AWS::EC2::LaunchTemplate", | ||
"Properties": { | ||
"LaunchTemplateName": { "Ref": "LaunchTemplateName" }, | ||
"LaunchTemplateData": { | ||
"BlockDeviceMappings": [ | ||
{ | ||
"DeviceName": "/dev/xvda", | ||
"Ebs": { | ||
"VolumeSize": 20, | ||
"VolumeType": "gp2" | ||
} | ||
} | ||
], | ||
"MetadataOptions": { | ||
"HttpPutResponseHopLimit": 2, | ||
"HttpEndpoint": "enabled", | ||
"HttpTokens": "required" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"Outputs": { | ||
"NodeGroupLaunchTemplateName": { | ||
"Description": "Name of the Node Group Launch Template", | ||
"Value": { "Ref": "NodeGroupLaunchTemplate" } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
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: | | ||
set -x | ||
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 | ||
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=ClusterName,ParameterValue=$(params.cluster-name)\ | ||
--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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters