Skip to content

fix(controller): make managed namespaces more 'prune-proof' (cherry-pick #13999)#15488

Merged
jannfis merged 1 commit intorelease-2.8from
cherry-pick-dd25d3-release-2.8
Sep 13, 2023
Merged

fix(controller): make managed namespaces more 'prune-proof' (cherry-pick #13999)#15488
jannfis merged 1 commit intorelease-2.8from
cherry-pick-dd25d3-release-2.8

Conversation

@gcp-cherry-pick-bot
Copy link

Cherry-picked fix(controller): make managed namespaces more 'prune-proof' (#13999)

  • fix: make managed namespaces more 'prune-proof'

In the cases where someone would want to set resource tracking on a
managed namespace, or if someone would want to migrate from having a
namespace in Git to using managedNamespaceMetadata, we need to take
steps to ensure that the namespace does not get pruned.

In order to do that, we add the live namespace to the list of
targetObjs (so that it's considered a part of the source even though
it's not).

Finally, we need to also ensure that the managed namespace is not
considered OutOfSync (due to the same reason as above).

This is a subset of #11350, the main difference being that this commit
does not set resource tracking on its own, but can be opted into if
people choose to do so.

Signed-off-by: Blake Pettersson blake.pettersson@gmail.com

  • refactor: extract managed namespace check

Signed-off-by: Blake Pettersson blake.pettersson@gmail.com


Signed-off-by: Blake Pettersson blake.pettersson@gmail.com

* fix: make managed namespaces more 'prune-proof'

In the cases where someone would want to set resource tracking on a
managed namespace, or if someone would want to migrate from having a
namespace in Git to using `managedNamespaceMetadata`, we need to take
steps to ensure that the namespace does not get pruned.

In order to do that, we add the live namespace to the list of
`targetObjs` (so that it's considered a part of the source even though
it's not).

Finally, we need to also ensure that the managed namespace is not
considered `OutOfSync` (due to the same reason as above).

This is a subset of #11350, the main difference being that this commit
does not set resource tracking on its own, but can be opted into if
people choose to do so.

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>

* refactor: extract managed namespace check

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>

---------

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
@codecov
Copy link

codecov bot commented Sep 13, 2023

Codecov Report

Patch coverage: 60.00% and no project coverage change.

Comparison is base (7b89ae4) 49.95% compared to head (6d88362) 49.95%.
Report is 1 commits behind head on release-2.8.

Additional details and impacted files
@@             Coverage Diff              @@
##           release-2.8   #15488   +/-   ##
============================================
  Coverage        49.95%   49.95%           
============================================
  Files              263      263           
  Lines            45061    45080   +19     
============================================
+ Hits             22508    22521   +13     
- Misses           20345    20349    +4     
- Partials          2208     2210    +2     
Files Changed Coverage Δ
controller/state.go 70.92% <60.00%> (-0.41%) ⬇️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@jannfis jannfis left a comment

Choose a reason for hiding this comment

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

LGTM

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.

2 participants