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

Add AZURE_TARGET_NAMESPACES to restrict the namespaces the operator watches #1559

Merged
merged 8 commits into from
Jun 16, 2021

Conversation

babbageclunk
Copy link
Member

What this PR does / why we need it:
Add a new configuration value AZURE_TARGET_NAMESPACES which restricts the operator to only reconciling Azure resources within the listed namespaces (comma-separated).
This enables running multiple operators that each watch their own set of namespaces and work with different credentials.

Special notes for your reviewer:
Testing is a pain for settings like this - I've used the same approach as the secret-naming version testing for now, but we need to come up with a better way to do this. The next part of the multitenancy work is a setting to put the operator into webhook-only mode, so that will have the same problem.

How does this PR make you feel:
gif

If applicable:

  • this PR contains documentation
  • this PR contains tests

@codecov-commenter
Copy link

codecov-commenter commented Jun 10, 2021

Codecov Report

Merging #1559 (1c8106d) into master (6bc381c) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1559   +/-   ##
=======================================
  Coverage   63.41%   63.41%           
=======================================
  Files         178      178           
  Lines       11739    11739           
=======================================
  Hits         7444     7444           
  Misses       3628     3628           
  Partials      667      667           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6bc381c...1c8106d. Read the comment docs.

Copy link
Member

@theunrepentantgeek theunrepentantgeek left a comment

Choose a reason for hiding this comment

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

Looks good.

azure-pipelines.yml Show resolved Hide resolved
controllers/targetnamespace_test.go Outdated Show resolved Hide resolved
pkg/resourcemanager/config/env.go Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
babbageclunk and others added 8 commits June 16, 2021 15:28
This is handled in the same way as the secret naming version setting,
but the more settings we add (some more are on the way), the more
unwieldy it's going to be. We need to come up with a better way of
making different settings testable.
Renamed them to install-tools and install-test-tools, since they're
installing binaries used in the build process rather than code
dependencies.

Run the `go get` commands in a temp directory and dummy module so that
they don't update the ASO go.mod and .sum files with dependencies that
our code doesn't actually depend on.
When target namespaces are set, there's no guarantee that the
operator's namespace is included. The identity finder always needs to
look in the operator namespace so pass it the API reader which
bypasses the filtered cache.
@babbageclunk
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@babbageclunk
Copy link
Member Author

Hmm, that doesn't seem good. Going to try one more time, otherwise I'm going to have to work something else out tomorrow.

@babbageclunk
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@matthchr matthchr merged commit a4d3a51 into Azure:master Jun 16, 2021
@babbageclunk babbageclunk deleted the target-namespace branch June 16, 2021 20:53
@babbageclunk
Copy link
Member Author

Yay, thanks for merging @matthchr!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants