Skip to content

feature: Support Dynamic namespaces using Labels #3299

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

Merged
merged 11 commits into from
Nov 30, 2022
Merged

Conversation

ciarams87
Copy link
Contributor

@ciarams87 ciarams87 commented Nov 23, 2022

Proposed changes

Provide a new CLI arg watch-namespace-label which supports watching for a namespace label instead of for discrete namespace names - this allows the list of watched namespaces to change dynamically based on a selector. The IC will watch for namespaces with the label selector and will dynamically add or remove watched namespaces as namespaces have this label added or removed.

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

@ciarams87 ciarams87 force-pushed the dynamic-namespaces branch 2 times, most recently from 3f42285 to 22fbff7 Compare November 23, 2022 14:41
@github-actions github-actions bot added the tests Pull requests that update tests label Nov 24, 2022
@ciarams87 ciarams87 added enhancement Pull requests for new features/feature enhancements and removed tests Pull requests that update tests labels Nov 24, 2022
@github-actions github-actions bot added tests Pull requests that update tests and removed enhancement Pull requests for new features/feature enhancements labels Nov 25, 2022
@codecov-commenter
Copy link

codecov-commenter commented Nov 25, 2022

Codecov Report

Merging #3299 (ee0a427) into main (5d607dd) will decrease coverage by 1.22%.
The diff coverage is 0.39%.

❗ Current head ee0a427 differs from pull request most recent head 6112640. Consider uploading reports for the commit 6112640 to get more accurate results

@@            Coverage Diff             @@
##             main    #3299      +/-   ##
==========================================
- Coverage   52.86%   51.64%   -1.23%     
==========================================
  Files          59       59              
  Lines       16137    16520     +383     
==========================================
  Hits         8531     8531              
- Misses       7318     7701     +383     
  Partials      288      288              
Impacted Files Coverage Δ
cmd/nginx-ingress/flags.go 31.03% <0.00%> (-1.95%) ⬇️
cmd/nginx-ingress/main.go 0.00% <0.00%> (ø)
internal/configs/configurator.go 36.00% <0.00%> (-1.06%) ⬇️
internal/externaldns/controller.go 4.93% <0.00%> (-1.27%) ⬇️
internal/k8s/controller.go 11.90% <0.00%> (-0.96%) ⬇️
internal/k8s/handlers.go 6.49% <0.00%> (-0.34%) ⬇️
internal/k8s/task_queue.go 0.00% <0.00%> (ø)
internal/certmanager/cm_controller.go 12.12% <3.92%> (-3.15%) ⬇️
... and 2 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@github-actions github-actions bot added documentation Pull requests/issues for documentation helm_chart Pull requests that update the Helm Chart labels Nov 25, 2022
@ciarams87 ciarams87 added the enhancement Pull requests for new features/feature enhancements label Nov 25, 2022
@github-actions github-actions bot removed the enhancement Pull requests for new features/feature enhancements label Nov 25, 2022
@ciarams87 ciarams87 changed the title feat: Support Dynamic namespaces using Labels feature: Support Dynamic namespaces using Labels Nov 25, 2022
@ciarams87 ciarams87 added the enhancement Pull requests for new features/feature enhancements label Nov 25, 2022
@ciarams87 ciarams87 marked this pull request as ready for review November 25, 2022 15:13
@ciarams87 ciarams87 requested a review from a team as a code owner November 25, 2022 15:13
Copy link
Contributor

@hafe hafe left a comment

Choose a reason for hiding this comment

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

Why not have a fixed name namespace label? Reduces complexity of the change

@ciarams87
Copy link
Contributor Author

Why not have a fixed name namespace label? Reduces complexity of the change

@hafe I'm not sure what you mean here?

@github-actions github-actions bot removed the enhancement Pull requests for new features/feature enhancements label Nov 28, 2022
@hafe
Copy link
Contributor

hafe commented Nov 28, 2022

Why not have a fixed name namespace label? Reduces complexity of the change

@hafe I'm not sure what you mean here?

That you decide and use a hardcoded label name.

What is the purpose of being able to change the name on the command line?

@ciarams87
Copy link
Contributor Author

Why not have a fixed name namespace label? Reduces complexity of the change

@hafe I'm not sure what you mean here?

That you decide and use a hardcoded label name.

What is the purpose of being able to change the name on the command line?

Thanks for the feedback @hafe. The purpose here is so that the user can configure the Ingress Controller to watch whatever label makes sense for their environment. It cannot be changed during runtime, so it is effectively hardcoded in the deployment spec. If the label needs to be changed, a redeployment will be required to do so.

@hafe
Copy link
Contributor

hafe commented Nov 28, 2022

I was thinking that freedom to change the name is perhaps not needed

@ciarams87 ciarams87 force-pushed the dynamic-namespaces branch 2 times, most recently from ee0a427 to 6112640 Compare November 29, 2022 12:49
@brianehlert
Copy link
Collaborator

I think that one thing we were cognizant of when we were designing this, is that a customer could have multiple NGINX Ingress Controller deployments running within any cluster at the same time, and thus we could not have only one hard coded label as the two deployments would clash.
This way each deployment can have a unique label, just like they might have unique namespaces.

@hafe
Copy link
Contributor

hafe commented Nov 29, 2022

I think that one thing we were cognizant of when we were designing this, is that a customer could have multiple NGINX Ingress Controller deployments running within any cluster at the same time, and thus we could not have only one hard coded label as the two deployments would clash.
This way each deployment can have a unique label, just like they might have unique namespaces.

Of course, thanks for the explanation!

Copy link
Contributor

@shaun-nx shaun-nx left a comment

Choose a reason for hiding this comment

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

👏

Copy link
Contributor

@vepatel vepatel left a comment

Choose a reason for hiding this comment

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

Great stuff 👏🏼

@ciarams87 ciarams87 added the enhancement Pull requests for new features/feature enhancements label Nov 30, 2022
@github-actions github-actions bot removed the enhancement Pull requests for new features/feature enhancements label Nov 30, 2022
@ciarams87 ciarams87 added the enhancement Pull requests for new features/feature enhancements label Nov 30, 2022
@ciarams87 ciarams87 merged commit 363e697 into main Nov 30, 2022
@ciarams87 ciarams87 deleted the dynamic-namespaces branch November 30, 2022 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Pull requests/issues for documentation enhancement Pull requests for new features/feature enhancements helm_chart Pull requests that update the Helm Chart tests Pull requests that update tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants