Skip to content

fix: check for double definition (cherry-pick #15670)#16272

Merged
ishitasequeira merged 1 commit intorelease-2.8from
cherry-pick-b6c0b0-release-2.8
Nov 9, 2023
Merged

fix: check for double definition (cherry-pick #15670)#16272
ishitasequeira merged 1 commit intorelease-2.8from
cherry-pick-b6c0b0-release-2.8

Conversation

@gcp-cherry-pick-bot
Copy link

Cherry-picked fix: check for double definition (#15670)

  • fix: check for double definition

As found in #13965 (and as a follow-up to #13999), we also need to
define what happens if both managedNamespaceMetadata and an
Application manifest are both defined for the same namespace.

The idea here is that if that happens, we emit an
ApplicationConditionRepeatedResourceWarning, and set the sync status
to Unknown, since it's unclear what is supposed to happen.

The user will then have the option of removing one of the two
definitions.

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

  • fix: check for double definition

A simpler fix - don't add a managed namespace to the targetObjs list if
a namespace already exists in the application source.

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

  • test: add test cases

This adds a test case showing that an ns manifest will override
managedNamespaceMetadata without failing horribly (as it currently
does on HEAD), as well as a "standard" mNMd diff vs live.

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


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

* fix: check for double definition

As found in #13965 (and as a follow-up to #13999), we also need to
define what happens if _both_ managedNamespaceMetadata _and_ an
Application manifest are both defined for the same namespace.

The idea here is that if that happens, we emit an
`ApplicationConditionRepeatedResourceWarning`, and set the sync status
to `Unknown`, since it's unclear what is supposed to happen.

The user will then have the option of removing one of the two
definitions.

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

* fix: check for double definition

A simpler fix - don't add a managed namespace to the targetObjs list if
a namespace already exists in the application source.

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

* test: add test cases

This adds a test case showing that an ns manifest will override
`managedNamespaceMetadata` without failing horribly (as it currently
does on `HEAD`), as well as a "standard" mNMd diff vs live.

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

---------

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
@ishitasequeira ishitasequeira enabled auto-merge (squash) November 9, 2023 22:29
@ishitasequeira ishitasequeira merged commit b87a3a8 into release-2.8 Nov 9, 2023
@ishitasequeira ishitasequeira deleted the cherry-pick-b6c0b0-release-2.8 branch November 9, 2023 22:29
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