-
Notifications
You must be signed in to change notification settings - Fork 34
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
Add volumecontext
package for accessing volume context from CSI
#340
Conversation
@@ -96,7 +89,7 @@ func (c *CredentialProvider) Provide(ctx context.Context, volumeID string, volum | |||
return nil, status.Error(codes.InvalidArgument, "Missing volume context") | |||
} | |||
|
|||
authenticationSource := volumeContext[VolumeCtxAuthenticationSource] | |||
authenticationSource := volumeContext[volumecontext.AuthenticationSource] |
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.
Not blocking: The only difference here being capitalisation makes this more challenging to read at first glance.
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.
I can rename variables to volumeCtx
, to have similar naming convention to built-in context
package and ctx
variable used widely.
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.
Addressed with 5da88fc
Signed-off-by: Burak Varlı <[email protected]>
This is to have same naming convention with built-in `context` package and `ctx` variable name used widely. Updated with `sg --pattern 'volumeContext' --rewrite 'volumeCtx' --lang go`. Signed-off-by: Burak Varlı <[email protected]>
cb6e302
to
5da88fc
Compare
Splitted out of #328.
This might not make sense since it's moved out of its original context, but the original motivation was that these constants was spread out to different packages and that was causing circular dependencies.
For example, if you need to use
VolumeCtxBucketName
inpkg/driver/node/mounter
package, you'd need to importpkg/driver/node
package which would cause a circular dependency aspkg/driver/node
importspkg/driver/node/mounter
. In situations like that, it's best to extract common things into a leaf package that doesn't import anything, which is what this PR does withpkg/driver/node/volumecontext
package.It also makes finding these volume context keys easier by placing them into a singular place.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.