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

Apply labels and annotations only in the correct paths #1499

Merged
merged 2 commits into from
May 8, 2020

Conversation

ANeumann82
Copy link
Member

Adding labels/annotations in all possible paths and relying on conversion to typed objects to remove invalid paths obviously only works for resources where we have the typed objects available. For almost all CRDs this leaves the resources with unwanted labels and annotations in multiple locations.

We now have custom lists for locations based on the G(V)K.

Signed-off-by: Andreas Neumann aneumann@mesosphere.com

Fixes #1498

…n the GVK

Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Copy link
Member

@zmalik zmalik left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@zen-dog zen-dog left a comment

Choose a reason for hiding this comment

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

One nit but otherwise 👍

@@ -107,6 +107,9 @@ func TestSetDependenciesHash(t *testing.T) {
assert.NilError(t, err)
assert.DeepEqual(t, pod("somename", "namespace"), p)
}},
{name: "no change in unstructured CRD", obj: unstructuredCrd("crd", "namespace"), assert: func(us *unstructured.Unstructured) {
Copy link
Contributor

Choose a reason for hiding this comment

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

So there is no easy way to collect the CRDs as part of the diagnostics (or cleanup for that matter) 😞

Copy link
Member Author

Choose a reason for hiding this comment

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

You mean because it didn't change? That's not correct, this test is specifically about the dependencies hash - no dependencies for CRDs, therefore no change.

I've extended one test in enhancer_test.go to verify that and make it more obvious that the top-level annotations in metadata/annotations and metadata/labels are always added.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it!

pkg/test/fake/client.go Show resolved Hide resolved
Copy link
Member

@nfnt nfnt left a comment

Choose a reason for hiding this comment

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

LGTM!

Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
@kensipe kensipe merged commit 9a0e297 into master May 8, 2020
@kensipe kensipe deleted the an/fix-unwanted-labelsannotations branch May 8, 2020 14:59
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.

Unable to create Custom Resource as part of deploy
5 participants