-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Update vault ca provider namespace configuration #19095
Conversation
if len(c.namespaces) > 0 { | ||
// If explicit namespaces are provided, try to create the provider before any of the namespaces | ||
// have been created. Verify that the provider fails to initialize. | ||
provider, err := createVaultProviderE(t, true, testVault.Addr, token, providerConfig) | ||
require.Error(t, err) | ||
require.NotNil(t, provider) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check here isn't strictly necessary but it does duplicate the problem reported in the issue where the provider fails to initialize because the namespace doesn't exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good
type vaultRequirements struct { | ||
Enterprise bool | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this mechanism is overkill but it would allow us to have other tests be discriminant about what Vault features are available to test with. For example, we could skip tests for certain Vault versions if the feature isn't applicable. Maybe this falls in the category of YNGNI, but it was super easy to implement it this way, so I did.
if rune(leafPEM[len(leafPEM)-1]) != '\n' { | ||
t.Fatalf("cert does not end with a new line") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just cleaning up code flagged by go-static-check
. "Yoda" statements, like it does not.
434524e
to
d4cff3b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks for the thorough integration testing
d4cff3b
to
c55f1a4
Compare
c55f1a4
to
c721f5c
Compare
c721f5c
to
8868f67
Compare
Description
This PR fixes the regression described in #19051. The Vault CA provider has been updated to only set the namespace on the Vault client if it is not empty, otherwise it falls back to the base namespace configured for the provider.
Testing & Reproduction steps
A new unit test
TestVaultCAProvider_EnterpriseNamespace
has been created to exercise the update. This requires a local Vault Enterprise binary and license to run, otherwise the test will automatically be skipped.PR Checklist
external facing docs updated