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

plumb service account token down to csi driver #93130

Merged
merged 1 commit into from
Nov 12, 2020

Conversation

zshihang
Copy link
Contributor

@zshihang zshihang commented Jul 16, 2020

What type of PR is this?

/kind api-change

What this PR does / why we need it:
KEP: kubernetes/enhancements#1855
Issue: #86448
release: kubernetes/enhancements#2047

Does this PR introduce a user-facing change?:

this PR will introduce a feature gate CSIServiceAccountToken with two additional fields in `CSIDriverSpec`.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

- [KEP]: https://github.com/kubernetes/enhancements/pull/1855

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jul 16, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @zshihang. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. area/kubelet area/test labels Jul 16, 2020
@k8s-ci-robot k8s-ci-robot added kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API sig/node Categorizes an issue or PR as relevant to SIG Node. sig/storage Categorizes an issue or PR as relevant to SIG Storage. sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jul 16, 2020
@zshihang
Copy link
Contributor Author

/assign @msau42 @liggitt @mikedanese

@fejta-bot
Copy link

This PR may require API review.

If so, when the changes are ready, complete the pre-review checklist and request an API review.

Status of requested reviews is tracked in the API Review project.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 16, 2020
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 16, 2020
@wongma7
Copy link
Contributor

wongma7 commented Jul 17, 2020

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 17, 2020
@msau42
Copy link
Member

msau42 commented Nov 10, 2020

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 10, 2020
@zshihang
Copy link
Contributor Author

/retest

@mikedanese
Copy link
Member

/lgtm

@liggitt liggitt added this to the v1.20 milestone Nov 11, 2020
pkg/apis/storage/validation/validation.go Show resolved Hide resolved
@@ -260,6 +260,11 @@ type volumeManager struct {
func (vm *volumeManager) Run(sourcesReady config.SourcesReady, stopCh <-chan struct{}) {
defer runtime.HandleCrash()

if vm.kubeClient != nil {
Copy link
Member

Choose a reason for hiding this comment

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

curious why this had to move

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not necessary here but the sooner to populate the csi driver lister cache before desire workload state populator starts the better. racing is still there tho. Michelle opened an issue to figure out the place to start WaitForCacheSync.

Copy link
Member

Choose a reason for hiding this comment

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

racing is still there though

what is the impact of losing the race? functional failure or longer startup time?

Copy link
Member

Choose a reason for hiding this comment

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

@zshihang and I discussed. The impact is NodePublish (mount) may be called without the token. The CSI driver is expected to fail if it expects one. The volume reconciler will retry NodePublish until successful.

pkg/printers/internalversion/printers.go Outdated Show resolved Hide resolved
pkg/registry/storage/csidriver/strategy.go Outdated Show resolved Hide resolved
@@ -1027,6 +1027,7 @@ func (pm *VolumePluginMgr) Run(stopCh <-chan struct{}) {
// start informer for CSIDriver
informerFactory := kletHost.GetInformerFactory()
informerFactory.Start(stopCh)
informerFactory.WaitForCacheSync(stopCh)
Copy link
Member

Choose a reason for hiding this comment

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

For this feature, if there isn't any negative effect from the informer being not in sync, then I'm ok with not waiting on it, and letting a retry resolve itself.

is this still outstanding? should WaitForCacheSync be removed?

pkg/volume/csi/csi_mounter.go Outdated Show resolved Hide resolved
pkg/apis/storage/types.go Show resolved Hide resolved
}

outputs := map[string]string{}
for _, tokenRequest := range csiDriver.Spec.TokenRequests {
Copy link
Member

Choose a reason for hiding this comment

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

how frequently is republish called? do we recreate all tokens on every republish call or do we reuse the previously requested one if it is still valid?

Copy link
Contributor Author

@zshihang zshihang Nov 11, 2020

Choose a reason for hiding this comment

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

100ms between republish calls. the tokens are cached in kubelet. it is using the same handler as projected tokens.

Copy link
Member

Choose a reason for hiding this comment

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

does that mean we're calling the CSI driver every 100ms?

Copy link
Contributor Author

@zshihang zshihang Nov 11, 2020

Choose a reason for hiding this comment

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

no because every reconciler loop takes some time and the reconciler loop calls republish.

// loopSleepDuration - the amount of time the reconciler loop sleeps between
// successive executions

from what i observed from e2e test, it is about 2~3/second.

pkg/volume/csi/csi_mounter.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 11, 2020
@zshihang
Copy link
Contributor Author

For this feature, if there isn't any negative effect from the informer being not in sync, then I'm ok with not waiting on it, and letting a retry resolve itself.

is this still outstanding? should WaitForCacheSync be removed?

no, this will be called in a go routine. it is better to have it happen sooner. @msau42

@liggitt
Copy link
Member

liggitt commented Nov 12, 2020

/approve

API and validation changes look good. I did not review the volume plugin changes.

Needs rebase, and storage reviewers have lgtm on remaining items.

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 12, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liggitt, msau42, zshihang

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 12, 2020
@zshihang
Copy link
Contributor Author

/retest

@msau42
Copy link
Member

msau42 commented Nov 12, 2020

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 12, 2020
@zshihang
Copy link
Contributor Author

/retest

1 similar comment
@zshihang
Copy link
Contributor Author

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review Categorizes an issue or PR as actively needing an API review. approved Indicates a PR has been approved by an approver from all required OWNERS files. area/apiserver area/e2e-test-framework Issues or PRs related to refactoring the kubernetes e2e test framework area/ipvs area/kubectl area/kubelet area/release-eng Issues or PRs related to the Release Engineering subproject area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/auth Categorizes an issue or PR as relevant to SIG Auth. sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/network Categorizes an issue or PR as relevant to SIG Network. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/storage Categorizes an issue or PR as relevant to SIG Storage. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
Status: API review completed, 1.20
Development

Successfully merging this pull request may close these issues.

None yet

8 participants