Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Fix mergeCredentials namespace reference #2622

Merged
merged 1 commit into from
Nov 21, 2019
Merged

Fix mergeCredentials namespace reference #2622

merged 1 commit into from
Nov 21, 2019

Conversation

denysvitali
Copy link
Contributor

@denysvitali denysvitali commented Nov 20, 2019

On certain setups, the following error appears (and the deploy is not successful?) even though the manifest is correct:

ts=2019-11-20T08:56:10.472306948Z caller=images.go:78 resource=:deployment/dep-product-backend err="getting secret \"regcred\" from namespace \"\": an empty namespace may not be set when a resource name is provided"

This issue is caused by the fact that the ns variable may be set to "" (meaning "all namespaces", see meta_v1.NamespaceAll), therefore in mergeCredentials(...) the "" namespace is forwarded and used for looking at the imagePullSecrets.

Related commit: 1dbeff3 .

Please do not merge yet, I'm testing it (nanosapp/flux:feature-namespace-regcred-fix-e1276641-wip)

Seems to be fixed, ready to be merged 🚀

@denysvitali denysvitali changed the title WIP: Fix mergeCredentials namespace reference (DO NOT MERGE) Fix mergeCredentials namespace reference Nov 20, 2019
Copy link
Contributor

@2opremio 2opremio left a comment

Choose a reason for hiding this comment

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

Nice catch!!! Thanks!

For extra points, could you add a test? (it's OK if you don't have time or simply don't want to)

@2opremio
Copy link
Contributor

2opremio commented Nov 20, 2019

I have re-checked all the invocations of getAllowedAndExistingNamespaces and I haven't found any other leftovers from #2539 but, to be sure, @squaremo could you also check?

We need more coverage in the e2e tests

@2opremio
Copy link
Contributor

(@denysvitali sorry, I initially selected the request changes option)

@squaremo
Copy link
Member

On certain setups

On the face of it, this looks like it would break most setups (because by default all namespaces are allowed, therefore the sentinel value will usually be used). For the benefit of my understanding, what are the factors that make it only certain setups?

Copy link
Member

@squaremo squaremo left a comment

Choose a reason for hiding this comment

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

Looks correct to me!

@2opremio 2opremio merged commit 732228a into fluxcd:master Nov 21, 2019
@2opremio 2opremio added this to the 1.16.0 milestone Nov 21, 2019
@2opremio 2opremio added the bug label Nov 22, 2019
@denysvitali
Copy link
Contributor Author

By certain I meant my setup 😅
I discovered this problem by looking at FluxCD's logs, then I did a little bit of troubleshooting and found out that it is not an intended behaviour. Hopefully this PR won't break anybody's workflow (relevant XKCD).

@denysvitali denysvitali deleted the feature/namespace-regcred-fix branch November 26, 2019 12:55
@squaremo
Copy link
Member

Bonus points for finding a relevant xkcd (there's one for every situation! well, every computer situation) 👍

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

Successfully merging this pull request may close these issues.

3 participants