-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- tekton tasks for eks mng, fargate, workaround for irsa, eks pipelin…
…es with MNG and fargate (#203) - add sleep time for mng to workaround vas cool off time - add PD support Co-authored-by: Harish Kuna <[email protected]>
- Loading branch information
1 parent
3ff5c48
commit ede4336
Showing
14 changed files
with
457 additions
and
42 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
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,74 @@ | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Pipeline | ||
metadata: | ||
name: awscli-eks-cl2loadtest | ||
namespace: tekton-pipelines | ||
spec: | ||
params: | ||
- name: cluster-name | ||
- name: endpoint | ||
- name: servicerole | ||
- name: desired-nodes | ||
- name: host-cluster-node-role-arn | ||
- name: pods-per-node | ||
- name: nodes-per-namespace | ||
- name: cl2-load-test-throughput | ||
- name: results-bucket | ||
tasks: | ||
- name: create-eks-cluster | ||
params: | ||
- name: cluster-name | ||
value: $(params.cluster-name) | ||
- name: servicerole | ||
value: $(params.servicerole) | ||
- name: endpoint | ||
value: $(params.endpoint) | ||
taskRef: | ||
kind: Task | ||
name: awscli-eks-cluster-create | ||
workspaces: | ||
- name: config | ||
workspace: config | ||
- name: create-mng-nodes | ||
params: | ||
- name: cluster-name | ||
value: $(params.cluster-name) | ||
- name: desired-nodes | ||
value: $(params.desired-nodes) | ||
- name: host-cluster-node-role-arn | ||
value: $(params.host-cluster-node-role-arn) | ||
- name: endpoint | ||
value: $(params.endpoint) | ||
runAfter: | ||
- create-eks-cluster | ||
taskRef: | ||
kind: Task | ||
name: awscli-eks-nodegroup-create | ||
- name: generate | ||
params: | ||
- name: pods-per-node | ||
value: $(params.pods-per-node) | ||
- name: nodes-per-namespace | ||
value: $(params.nodes-per-namespace) | ||
- name: cl2-load-test-throughput | ||
value: $(params.cl2-load-test-throughput) | ||
- name: results-bucket | ||
value: $(params.results-bucket) | ||
- name: nodes | ||
value: $(params.desired-nodes) | ||
runAfter: | ||
- create-mng-nodes | ||
taskRef: | ||
kind: Task | ||
name: load | ||
workspaces: | ||
- name: source | ||
workspace: source | ||
- name: config | ||
workspace: config | ||
- name: results | ||
workspace: results | ||
workspaces: | ||
- name: config | ||
- name: source | ||
- name: results |
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,34 @@ | ||
--- | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Pipeline | ||
metadata: | ||
name: awscli-eks-fargate | ||
namespace: tekton-pipelines | ||
spec: | ||
workspaces: | ||
- name: config | ||
params: | ||
- name: cluster-name | ||
- name: desired-nodes | ||
- name: host-cluster-node-role-arn | ||
tasks: | ||
- name: setup-control-plane | ||
taskRef: | ||
name: awscli-eks-cluster-create | ||
params: | ||
- name: cluster-name | ||
value: '$(params.cluster-name)' | ||
workspaces: | ||
- name: config | ||
workspace: config | ||
- name: setup-data-plane | ||
runAfter: [setup-control-plane] | ||
taskRef: | ||
name: awscli-eks-fargate-create | ||
params: | ||
- name: cluster-name | ||
value: '$(params.cluster-name)' | ||
- name: desired-nodes | ||
value: '$(params.desired-nodes)' | ||
- name: host-cluster-node-role-arn | ||
value: '$(params.host-cluster-node-role-arn)' |
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,55 @@ | ||
--- | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Task | ||
metadata: | ||
name: awscli-eks-cluster-create | ||
namespace: tekton-pipelines | ||
spec: | ||
description: | | ||
Create an EKS cluster. | ||
This Task can be used to create an EKS cluster for a given service role in an AWS account and write a kubeconfig to a desired location that | ||
can be used by other tasks (in a context with kubectl) to make requests to the cluster. | ||
params: | ||
- name: cluster-name | ||
description: The name of the EKS cluster you want to spin. | ||
- name: kubernetes-version | ||
default: "1.21" | ||
description: The EKS version to install. | ||
- name: region | ||
default: "us-west-2" | ||
description: The region where the cluster is in. | ||
- name: endpoint | ||
default: "" | ||
description: "aws eks enpoint to create clusters against" | ||
- name: servicerole | ||
description: servicerole arn to be used for eks cluster to perform operations in customer account to setup cluster | ||
workspaces: | ||
- name: config | ||
description: | | ||
A workspace into which a kubeconfig file called `kubeconfig` will be written that will contain the information required to access the cluster. The `kubeconfig` will expect to use [aws-iam-authenticator](https://github.com/kubernetes-sigs/aws-iam-authenticator/) to authenticate, so in order for it to be used it must be run in a container which contains both `kubectl` and `aws-iam-authenticator`. | ||
steps: | ||
- name: write-kubeconfig | ||
image: alpine/k8s:1.22.6 | ||
script: | | ||
echo "Approving KCM requests" | ||
kubectl certificate approve $(kubectl get csr | grep "Pending" | awk '{print $1}') 2>/dev/null || true | ||
ENDPOINT_FLAG="" | ||
if [ -n "$(params.endpoint)" ]; then | ||
ENDPOINT_FLAG="--endpoint $(params.endpoint)" | ||
fi | ||
CREATED_CLUSTER=$(aws eks $ENDPOINT_FLAG list-clusters --region $(params.region) --query 'clusters[?@==`'$(params.cluster-name)'`]' --output text ) | ||
echo "CREATED_CLUSTER=$CREATED_CLUSTER" | ||
TAG=$(kubectl get provisioner -oyaml | grep karpenter.sh/discovery | awk 'NR==1{ print $2}') | ||
subnets=$(aws ec2 describe-subnets --region $(params.region) --filters Name=tag:kit.aws/substrate,Values=$TAG --query 'Subnets[].SubnetId' | jq -r ' [.[]] | join(",")') | ||
echo "subnets=$subnets" | ||
sg=$(aws ec2 describe-security-groups --region $(params.region) --filters Name=tag:kit.aws/substrate,Values=$TAG --query 'SecurityGroups[].GroupId' | jq -r ' .[0] ') | ||
echo "securitygroup=$sg" | ||
if [ "$CREATED_CLUSTER" == "" ]; then | ||
aws eks create-cluster --name $(params.cluster-name) --region $(params.region) --kubernetes-version $(params.kubernetes-version) --role-arn $(params.servicerole) --resources-vpc-config subnetIds=$subnets,securityGroupIds=$sg $ENDPOINT_FLAG | ||
fi | ||
aws eks $ENDPOINT_FLAG --region $(params.region) wait cluster-active --name $(params.cluster-name) | ||
aws eks $ENDPOINT_FLAG update-kubeconfig --name $(params.cluster-name) --region $(params.region) | ||
cp /root/.kube/config $(workspaces.config.path)/kubeconfig | ||
# enable PD on the cluster | ||
kubectl set env ds aws-node -n kube-system ENABLE_PREFIX_DELEGATION=true |
Oops, something went wrong.