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

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

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

Conversation

frankh
Copy link

@frankh frankh commented Sep 27, 2023

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

  • Added tests that cover your change (if possible)
  • Added/modified documentation as required (such as the README.md, or the docs directory)
  • Manually tested
  • 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?! 🤯

  • Backfilled missing tests for code in same general area 🎉
  • Refactored something and made the world a better place 🌟

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Sep 27, 2023
@k8s-ci-robot
Copy link
Contributor

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

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 27, 2023
@frankh frankh changed the title Add target-group-prefix to allow controlling target group names feat: Add target-group-prefix to allow controlling target group names Sep 27, 2023
@k8s-ci-robot
Copy link
Contributor

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 k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Sep 27, 2023
@frankh frankh changed the title feat: Add target-group-prefix to allow controlling target group names feat: Add target-group-prefix annotation to change target group names Sep 27, 2023
@frankh frankh force-pushed the feat/target-group-prefix-annotation branch 2 times, most recently from 95226e5 to 85722f5 Compare September 27, 2023 19:38
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 27, 2023
@frankh frankh force-pushed the feat/target-group-prefix-annotation branch from 85722f5 to ac22674 Compare September 28, 2023 07:51
@frankh frankh marked this pull request as ready for review September 28, 2023 07:51
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 28, 2023
!!!example
- set the target group prefix to "my-service-", the full name will look like "my-service-8f5fe20735"
```
alb.ingress.kubernetes.io/target-group-prefix: my-service-

Choose a reason for hiding this comment

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

I think it would make sense to imply the trailing dash. So instead of my-service- it would just be my-service and the dash would be added in the concatenation statement

@oliviassss
Copy link
Collaborator

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 25, 2024
@frankh
Copy link
Author

frankh commented Jan 25, 2024

/retest

@frankh frankh force-pushed the feat/target-group-prefix-annotation branch 2 times, most recently from 29bf83a to a825fa5 Compare January 25, 2024 15:27
@AndrewCharlesHay
Copy link

/approve

@frankh frankh force-pushed the feat/target-group-prefix-annotation branch from a825fa5 to cd14986 Compare January 25, 2024 15:33
@AndrewCharlesHay
Copy link

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

@AndrewCharlesHay
Copy link

/lgtm

@AndrewCharlesHay
Copy link

/retest

@oliviassss
Copy link
Collaborator

Thanks for the contribution
/lgtm
assign @M00nF1sh

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 5, 2024
@oliviassss oliviassss added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Feb 5, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 5, 2024
@AndrewCharlesHay
Copy link

@M00nF1sh can we get some 👀 please 🙏

@oliviassss
Copy link
Collaborator

/approve

@k8s-ci-robot
Copy link
Contributor

[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 k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 22, 2024
@M00nF1sh
Copy link
Collaborator

M00nF1sh commented Feb 22, 2024

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

@oliviassss oliviassss removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 22, 2024
@AndrewCharlesHay
Copy link

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

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 4, 2024
@frederiksf
Copy link

When can we expect this feature will be released?

@oliviassss
Copy link
Collaborator

/retest

@frankh frankh force-pushed the feat/target-group-prefix-annotation branch from eae620b to 5475a63 Compare April 18, 2024 09:08
@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Apr 18, 2024
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 31, 2024
frankh and others added 5 commits June 10, 2024 14:17
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
@frankh frankh force-pushed the feat/target-group-prefix-annotation branch from 5475a63 to 5ad172f Compare June 10, 2024 13:18
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants