Skip to content
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

Tag templating #7506

Open
sylr opened this issue Dec 9, 2024 · 2 comments · May be fixed by #7516
Open

Tag templating #7506

sylr opened this issue Dec 9, 2024 · 2 comments · May be fixed by #7516
Labels
feature New feature or request

Comments

@sylr
Copy link
Contributor

sylr commented Dec 9, 2024

Description

What problem are you trying to solve?

I would like to be able to use go templates to generate dynamic AWS tags for the EC2 instances generated by karpenter, e.g:

---
apiVersion: karpenter.k8s.aws/v1
kind: EC2NodeClass
metadata:
  name: al2023-default
spec:
  # Required, resolves a default ami and userdata
  amiFamily: AL2023
  amiSelectorTerms:
  - alias: al2023@v20241121

  ...

  # Optional, propagates tags to underlying EC2 resources
  tags:
    Name: eks.amazonaws.com/{{ .ClusterName }}/{{ .EC2NodeClassName }}

How important is this feature to you?

Nice to have.

@sylr sylr added feature New feature or request needs-triage Issues that need to be triaged labels Dec 9, 2024
@jonathan-innis
Copy link
Contributor

Can you template this at the level above the NodeClass? I'm curious if rather than us supporting templating directly in our spec, if you can use something like Helm/Kustomize with GitOps to auto-template this out for you so the resultant manifests just have hard data.

In general, I think it's pretty abnormal to see templated values in K8s resources that are directly applied to the cluster.

@jonathan-innis jonathan-innis removed the needs-triage Issues that need to be triaged label Dec 10, 2024
@sylr
Copy link
Contributor Author

sylr commented Dec 11, 2024

I do use flux and kustomize to template things but in this case I don't think it would work as what I would really do is to use the NodePool name, e.g.:

  # Optional, propagates tags to underlying EC2 resources
  tags:
    Name: eks.amazonaws.com/{{ .ClusterName }}/{{ .NodePoolName }}

@sylr sylr linked a pull request Dec 11, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants