aws-load-balancer-controller
aws-load-balancer-controller copied to clipboard
feat: Add target-group-prefix annotation to change target group names
Issue
#2553
Description
Currently all target groups start with a prefix of k8s-<namespace>-<name>
This is not particularly useful, allow us to override per ingress and service
Checklist
- [x] Added tests that cover your change (if possible)
- [x] Added/modified documentation as required (such as the
README.md
, or thedocs
directory) - [x] Manually tested
- [x] Made sure the title of the PR is a good description that can go into the release notes
BONUS POINTS checklist: complete for good vibes and maybe prizes?! :exploding_head:
- [x] Backfilled missing tests for code in same general area :tada:
- [ ] Refactored something and made the world a better place :star2:
Welcome @frankh!
It looks like this is your first PR to kubernetes-sigs/aws-load-balancer-controller 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.
You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.
You can also check if kubernetes-sigs/aws-load-balancer-controller has its own contribution guidelines.
You may want to refer to our testing guide if you run into trouble with your tests not passing.
If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!
Thank you, and welcome to Kubernetes. :smiley:
Hi @frankh. Thanks for your PR.
I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test
on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.
Once the patch is verified, the new status will be reflected by the ok-to-test
label.
I understand the commands that are listed here.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
/ok-to-test
/retest
/approve
@frankh I'm not an official maintainer or anything that was just a suggestion but thanks 😄
/lgtm
@AndrewCharlesHay: changing LGTM is restricted to collaborators
In response to this:
/lgtm
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
I'll fix the test. Those were my bad
@frankh Fixed it there ☝️
/retest
@frankh The e2e tests are failing because you dropped the -
here but my PR should fix it 😃
/retest
@AndrewCharlesHay: changing LGTM is restricted to collaborators
In response to this:
/lgtm
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
@oliviassss Look good to you?
Or @M00nF1sh 🥺
@frankh Can you rebase? I don't think I have permission to
/retest
Thanks for the contribution /lgtm assign @M00nF1sh
@M00nF1sh can we get some 👀 please 🙏
/approve
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: AndrewCharlesHay, frankh, oliviassss
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~OWNERS~~ [oliviassss]
Approvers can indicate their approval by writing /approve
in a comment
Approvers can cancel approval by writing /approve cancel
in a comment
@frankh @AndrewCharlesHay sorry for the late review. The change itself lgtm. However, i'm wondering do we really need to provide this override per Service for your use case? wondering whether it's better to provide this as a controller-level flag instead of annotation on Ingresses. Personally i prefer to minimize the annotations we expose if possible.
e.g. this could implemented as a controller flag like --tg-name-pattern="k8s-{serviceNamespace:.8s}-{serviceName:.8s}-{hash:10s}"
- Pros:
- seems more flexible for all kinds of pattern you want.
- avoid need to specify the annotation on every service
- less intrusive to Kubernetes service resources. (no need to modify the Service resource's annotation)
- Cons:
- unable to provide override per service. (But do we really need this? i doubt it)
note, i used python's format string syntax here, not sure whether there is Golang alternative. However, we can have a naive implementation for pattern like this such as below:
- use regex to replace
{<id>:.<number>s}
to be%.<number>s
, so it becamesk8s-%.8s-%.8s-%.10s
- then for each extracted
<id>
, find the value from a variable mapping(serviceNamespace, serviceName, hash), and render it via golang's string.format as additional args.
What do you think?
@frankh Did you want to take on those changes? I can if you don't want to
When can we expect this feature will be released?
/retest
New changes are detected. LGTM label has been removed.