aws-load-balancer-controller icon indicating copy to clipboard operation
aws-load-balancer-controller copied to clipboard

feat: Add target-group-prefix annotation to change target group names

Open frankh opened this issue 9 months ago • 27 comments

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 the docs 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:

frankh avatar Sep 27 '23 16:09 frankh

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:

k8s-ci-robot avatar Sep 27 '23 16:09 k8s-ci-robot

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.

k8s-ci-robot avatar Sep 27 '23 16:09 k8s-ci-robot

/ok-to-test

oliviassss avatar Jan 25 '24 00:01 oliviassss

/retest

frankh avatar Jan 25 '24 15:01 frankh

/approve

AndrewCharlesHay avatar Jan 25 '24 15:01 AndrewCharlesHay

@frankh I'm not an official maintainer or anything that was just a suggestion but thanks 😄

AndrewCharlesHay avatar Jan 25 '24 15:01 AndrewCharlesHay

/lgtm

AndrewCharlesHay avatar Jan 25 '24 15:01 AndrewCharlesHay

@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.

k8s-ci-robot avatar Jan 25 '24 15:01 k8s-ci-robot

I'll fix the test. Those were my bad

AndrewCharlesHay avatar Jan 25 '24 18:01 AndrewCharlesHay

@frankh Fixed it there ☝️

AndrewCharlesHay avatar Jan 25 '24 19:01 AndrewCharlesHay

/retest

AndrewCharlesHay avatar Jan 25 '24 20:01 AndrewCharlesHay

@frankh The e2e tests are failing because you dropped the - here but my PR should fix it 😃

AndrewCharlesHay avatar Jan 26 '24 19:01 AndrewCharlesHay

/retest

frankh avatar Jan 29 '24 15:01 frankh

@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.

k8s-ci-robot avatar Jan 29 '24 16:01 k8s-ci-robot

@oliviassss Look good to you?

AndrewCharlesHay avatar Jan 29 '24 19:01 AndrewCharlesHay

Or @M00nF1sh 🥺

AndrewCharlesHay avatar Jan 31 '24 00:01 AndrewCharlesHay

@frankh Can you rebase? I don't think I have permission to

AndrewCharlesHay avatar Feb 01 '24 15:02 AndrewCharlesHay

/retest

AndrewCharlesHay avatar Feb 05 '24 18:02 AndrewCharlesHay

Thanks for the contribution /lgtm assign @M00nF1sh

oliviassss avatar Feb 05 '24 20:02 oliviassss

@M00nF1sh can we get some 👀 please 🙏

AndrewCharlesHay avatar Feb 22 '24 00:02 AndrewCharlesHay

/approve

oliviassss avatar Feb 22 '24 00:02 oliviassss

[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

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

k8s-ci-robot avatar Feb 22 '24 00:02 k8s-ci-robot

@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:
    1. seems more flexible for all kinds of pattern you want.
    2. avoid need to specify the annotation on every service
    3. less intrusive to Kubernetes service resources. (no need to modify the Service resource's annotation)
  • Cons:
    1. 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:

  1. use regex to replace {<id>:.<number>s} to be %.<number>s, so it becames k8s-%.8s-%.8s-%.10s
  2. 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?

M00nF1sh avatar Feb 22 '24 00:02 M00nF1sh

@frankh Did you want to take on those changes? I can if you don't want to

AndrewCharlesHay avatar Mar 15 '24 17:03 AndrewCharlesHay

When can we expect this feature will be released?

frederiksf avatar Apr 16 '24 14:04 frederiksf

/retest

oliviassss avatar Apr 17 '24 22:04 oliviassss

New changes are detected. LGTM label has been removed.

k8s-ci-robot avatar Apr 18 '24 09:04 k8s-ci-robot