-
Notifications
You must be signed in to change notification settings - Fork 332
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 secret support for Provision and Delete from pvc name and namespace #274
Add secret support for Provision and Delete from pvc name and namespace #274
Conversation
Hi @ggriffiths. Thanks for your PR. I'm waiting for a kubernetes-csi or kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Verified that this change works on my k8s cluster with our CSI driver. Ready for review. |
/assign @msau42 |
/ok-to-test |
1184530
to
9625615
Compare
/lgtm |
e0ab76e
to
82727cc
Compare
01968e5
to
bad6c2d
Compare
pkg/controller/controller_test.go
Outdated
}, | ||
expectErr: true, | ||
}, | ||
"simple - valid": deleteTestcase{ |
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 should be failing since annotations is not supported?
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 wasn't failing because I was using PV Annotations instead of SC Parameters in the test.
pkg/controller/controller_test.go
Outdated
}, | ||
}, | ||
}, | ||
expectErr: false, |
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.
Is there a way to validate what secret reference we generated? And expect if it got set or ignored?
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 don't think easily from testing Delete at a high level. I think getSecretReference tests should cover that.
7ba682e
to
dc795ce
Compare
Just re-tested this on my local k8s cluster and Provision/delete are working. Also
|
pkg/controller/controller_test.go
Outdated
@@ -558,6 +558,17 @@ func TestGetSecretReference(t *testing.T) { | |||
pvc: nil, | |||
expectRef: &v1.SecretReference{Name: "name", Namespace: "ns"}, | |||
}, | |||
"simple - valid, pvc name and namespace": { | |||
secretParams: provisionerSecretParams, | |||
params: map[string]string{provisionerSecretNameKey: "name", provisionerSecretNamespaceKey: "ns"}, |
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.
Can you make the keys used in the params different from the values in the PVC? That way we make sure we're not accidentally using pvc values.
pkg/controller/controller_test.go
Outdated
"template - valid": { | ||
secretParams: nodePublishSecretParams, | ||
params: map[string]string{ | ||
nodePublishSecretNameKey: "static-${pv.name}-${pvc.namespace}-${pvc.name}-${pvc.annotations['akey']}", | ||
nodePublishSecretNameKey: "static-${pv.name}-${pvc.namespace}-${pvc.name}", |
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.
annotations are allowed for nodepublish right?
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.
Yeah, they are. Just made this into two unit tests - one for nodePublish secrets and one for provisioner secrets
}, | ||
expectErr: true, | ||
}, | ||
"simple - valid case": deleteTestcase{ |
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.
Also one more test case where claimRef is set
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.
Added this test case.
dc795ce
to
7ab6eeb
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.
Just one nit, otherwise lgtm!
/approve
pkg/controller/controller_test.go
Outdated
}, | ||
expectRef: &v1.SecretReference{Name: "static-provisioner-pvname-pvcnamespace-pvcname", Namespace: "static-provisioner-pvname-pvcnamespace"}, | ||
}, | ||
"template - invalid provisioner secret, annotations not supported": { |
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 is already at L589?
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 catch, removed this duplicate test.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ggriffiths, msau42 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Also please squash your commits |
Signed-off-by: Grant Griffiths <ggp493@gmail.com>
a5ef3a8
to
9b9bcc6
Compare
Squashed into one commit. Thanks for the review! |
/lgtm Thanks! |
"Add secret support for Provision and Delete from pvc name and namespace"
Backport kubernetes-csi#274 from the master
Signed-off-by: Grant Griffiths <ggp493@gmail.com> Backport kubernetes-csi#274 from the master
Backport kubernetes-csi#274 from the master
Signed-off-by: Grant Griffiths ggp493@gmail.com
What type of PR is this?
/kind feature
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #170
Fixes #233
Special notes for your reviewer:
Does this PR introduce a user-facing change?: