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

add doc for TokenRequests and RequiresRepublish fields #383

Merged
merged 1 commit into from
Nov 17, 2020

Conversation

zshihang
Copy link
Contributor

@zshihang zshihang commented Nov 12, 2020

CSIServiceAccountToken is Alpha in 1.20 with two additional fields in CSIDriver spec: `TokenRequests` and `RequiresRepublish`.

@k8s-ci-robot k8s-ci-robot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 12, 2020
@k8s-ci-robot
Copy link
Contributor

Welcome @zshihang!

It looks like this is your first PR to kubernetes-csi/docs 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-csi/docs has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Nov 12, 2020
@zshihang
Copy link
Contributor Author

/cc @msau42

@@ -70,6 +75,19 @@ There are four important fields:
The default is `Persistent`, which is the normal PVC/PV mechanism. `Ephemeral` enables
[inline ephemeral volumes](ephemeral-local-volumes.md) in addition (when both
are listed) or instead of normal volumes (when it is the only entry in the list).
* `tokenRequests`
* This field was added in Kubernetes 1.20 and cannot be set when using an older Kubernetes release.
* This field is alpha.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you specify the feature gate that is required as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

* If this field is specified, Kubelet will plumb down the bound service acocunt tokens of the pod as `volume_context` in the `NodePublishVolume`:
* `"csi.storage.k8s.io/serviceAccount.tokens": {"gcp":{"token":"<token>","expirationTimestamp":"<expiration timestamp in RFC3339>"}}`
* If CSI driver doesn't find token recorded in the `volume_context`, it should return error in `NodePublishVolume` to inform Kubelet to retry.
* Audiences should be distinct, otherwise the validation will fail. If the audience is "", it means the issued token has the same audience as kube-apiserver.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there some general documentation on tokens and audiences that we can point to from here? It may be good to specify what kinds of drivers/use cases this would be used for

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually this kind of information might be useful under a feature page: https://kubernetes-csi.github.io/docs/features.html, rather than hidden inside this object page, wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, https://tools.ietf.org/html/rfc7519#section-4.1.3. i'll include this in the feature page.

* Audiences should be distinct, otherwise the validation will fail. If the audience is "", it means the issued token has the same audience as kube-apiserver.
* `requiresRepublish`
* This field was added in Kubernetes 1.20 and cannot be set when using an older Kubernetes release.
* This field is alpha.
Copy link
Collaborator

Choose a reason for hiding this comment

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

mention the feature gate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

* This field is alpha.
* If this field is `true`, Kubelet will periodically call `NodePublishVolume`. This is useful in the following scenarios:
* If the volume mounted by CSI driver is short-lived.
* If CSI driver requires valid service account tokens (enabled by the field `tokenRequests`) repeatedly.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add that note about how the republish should only update data, and not remount?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

@msau42
Copy link
Collaborator

msau42 commented Nov 12, 2020

cc @mikedanese

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 13, 2020
- **`RequiresRepublish`**:

- This field is optional.
- If this is true, `NodePublishVolume` will be periodically called.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also mention that when used with TokenRequest, the token will be updated when it expires

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


```go
"csi.storage.k8s.io/serviceAccount.tokens": {
'audience': {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the value actually "audience" or is it something like "gcp", "vault"?

Copy link
Contributor Author

@zshihang zshihang Nov 16, 2020

Choose a reason for hiding this comment

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

right. change it to <audience>

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Nov 16, 2020
@msau42
Copy link
Collaborator

msau42 commented Nov 16, 2020

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 16, 2020
@zshihang
Copy link
Contributor Author

/retest

mdbook hash matched locally. re-run in case transient failure.

@k8s-ci-robot
Copy link
Contributor

@zshihang: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

mdbook hash matched locally. re-run in case transient failure.

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.

@zshihang
Copy link
Contributor Author

/ok-to-test

@k8s-ci-robot
Copy link
Contributor

@zshihang: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/ok-to-test

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.

@msau42
Copy link
Collaborator

msau42 commented Nov 16, 2020

/ok-to-test

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Nov 16, 2020
@msau42
Copy link
Collaborator

msau42 commented Nov 16, 2020

/retest

@msau42
Copy link
Collaborator

msau42 commented Nov 16, 2020

@zshihang can you try force pushing to retry the ci?

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 16, 2020
@msau42
Copy link
Collaborator

msau42 commented Nov 17, 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 17, 2020
@k8s-ci-robot k8s-ci-robot merged commit 9278e2c into kubernetes-csi:master Nov 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. 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. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants