Skip to content

Add Tekton tasks to install and scale Karpenter #538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

DerekFrank
Copy link

Issue #, if available:

Description of changes:

This change introduces the tasks necessary to install and leverage Karpenter to scale a cluster. This was tested in a dev cluster

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

- name: create-role
image: alpine/k8s:1.23.7
script: |
aws iam create-instance-profile --instance-profile-name "KarpenterNodeInstanceProfile-$(params.cluster-name)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets create it only if doesn't exist please.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This raises a larger question I had around idempotency and error handling. I was planning to tear down the instance profile every time and re-create it every time (in case the instance profile details change). If teardown starts failing, won't we want subsequent runs to fail?

description: The name of the cluster
steps:
- name: create-role
image: alpine/k8s:1.23.7
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please update the image to most recent version.

- name: create-role
image: alpine/k8s:1.23.7
script: |
aws iam create-role --role-name "KarpenterNodeRole-$(params.cluster-name)" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should create them only if it is not available (or) delete them before recreating them to ensure resources are cleaned up from previous run.


# kubectl taint nodes -l dedicated=karpenter dedicated=karpenter:NoSchedule

helm upgrade --install karpenter oci://$(params.karpenter-ecr-repo)/karpenter/karpenter --version $(params.karpenter-version) \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are changes public ? if not, and they are being hosted internally ? does the underlying task have permissions to pull it ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can discuss this offline

- name: create-role
image: alpine/k8s:1.23.7
script: |
aws iam delete-instance-profile --instance-profile-name "KarpenterNodeInstanceProfile-$(params.cluster-name)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a check to ensure it deletes only if it exists

- name: replicas
description: Number of replicas to scale to
- name: nodepool
description: Name of the nodepool to drift
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is generically used, you may want to remove drift here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants