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 V1beta1 VolumeAttachment API #58462

Merged
merged 4 commits into from Feb 2, 2018

Conversation

NickrenREN
Copy link
Contributor

@NickrenREN NickrenREN commented Jan 18, 2018

What this PR does / why we need it:
Add V1beta1 VolumeAttachment API, co-existing with Alpha API object

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #58461

Special notes for your reviewer:

Release note:

Add V1beta1 VolumeAttachment API, co-existing with Alpha API object

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 18, 2018
@k8s-github-robot k8s-github-robot added the kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API label Jan 18, 2018
@k8s-github-robot k8s-github-robot removed the kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API label Jan 19, 2018
@NickrenREN NickrenREN force-pushed the va-to-beta branch 4 times, most recently from 989985a to 38a214b Compare January 23, 2018 08:12
@NickrenREN NickrenREN changed the title WIP: Move VolumeAttachment API to Beta Move VolumeAttachment API to Beta Jan 23, 2018
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 23, 2018
@NickrenREN
Copy link
Contributor Author

/assign @saad-ali @jsafrane @caesarxuchao

@NickrenREN
Copy link
Contributor Author

/unassign @gnufied @yifan-gu

@NickrenREN
Copy link
Contributor Author

NickrenREN commented Jan 23, 2018

Finally..... All checks turn green.
Many thanks for @jsafrane and @caesarxuchao 's help

@NickrenREN
Copy link
Contributor Author

/retest

Copy link
Member

@saad-ali saad-ali left a comment

Choose a reason for hiding this comment

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

Largely LGTM. A few comments.

@@ -255,7 +255,7 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
ServiceNodeExclusion: {Default: false, PreRelease: utilfeature.Alpha},
MountContainers: {Default: false, PreRelease: utilfeature.Alpha},
VolumeScheduling: {Default: false, PreRelease: utilfeature.Alpha},
CSIPersistentVolume: {Default: false, PreRelease: utilfeature.Alpha},
CSIPersistentVolume: {Default: false, PreRelease: utilfeature.Beta},
Copy link
Member

Choose a reason for hiding this comment

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

Let's turn it on by default, now that it is alpha.

Copy link
Member

Choose a reason for hiding this comment

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

Beta?

Copy link
Member

Choose a reason for hiding this comment

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

Right, beta not alpha, brain fart.

@@ -82,7 +82,7 @@ func (config AuthorizationConfig) New() (authorizer.Authorizer, authorizer.RuleR
graph,
config.InformerFactory.Core().InternalVersion().Pods(),
config.InformerFactory.Core().InternalVersion().PersistentVolumes(),
config.VersionedInformerFactory.Storage().V1alpha1().VolumeAttachments(),
config.VersionedInformerFactory.Storage().V1beta1().VolumeAttachments(),
Copy link
Member

Choose a reason for hiding this comment

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

NodeAuthorizer should handle BOTH V1alpha1().VolumeAttachments and V1beta1().VolumeAttachments not just one or the other.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we can get both versions VolumeAttachment objects by V1beta1 or V1alpha1 API, so any API version here will do ? Not sure. cc @liggitt

Copy link
Member

@liggitt liggitt Jan 24, 2018

Choose a reason for hiding this comment

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

NodeAuthorizer should handle BOTH V1alpha1().VolumeAttachments and V1beta1().VolumeAttachments not just one or the other.

No, it will only watch one to populate the authorizer graph (it uses the info to authorize requests for either version). The authorizer runs in process in the apiserver, so it is never version skewed. I'd expect it to watch v1beta1

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the clarification, disregard this comment @NickrenREN.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@@ -574,7 +574,7 @@ func BuildStorageFactory(s *options.ServerRunOptions) (*serverstorage.DefaultSto
// FIXME (soltysh): this GroupVersionResource override should be configurable
[]schema.GroupVersionResource{
batch.Resource("cronjobs").WithVersion("v1beta1"),
storage.Resource("volumeattachments").WithVersion("v1alpha1"),
storage.Resource("volumeattachments").WithVersion("v1beta1"),
Copy link
Member

Choose a reason for hiding this comment

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

What happens if we leave this v1alpha1? If we add new things to v1alpha1 but not to the v1beta1 will this handle it correctly?

Copy link
Member

Choose a reason for hiding this comment

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

There could only be one storage version. You have to keep the v1alpha1 and v1beta1 roundtrippable. It's an api requirement in the api conventions doc.

If you want to test new things in alpha, you can create a new struct and specify here to store it as v1alpha1.

Copy link
Member

Choose a reason for hiding this comment

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

If you store in v1alpha1, you have the option to downgrade and have VolumeAttachments keep working in alpha form, but you have alpha data in etcd, which means you cannot drop the alpha types until storage migration is solved.

If you store in beta, you are better positioned to drop alpha types sooner (since the only people who would have alpha data were people who upgraded from 1.9 with the alpha flag enabled)

Copy link
Member

Choose a reason for hiding this comment

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

I'd probably expect to store in v1beta1

Copy link
Member

Choose a reason for hiding this comment

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

Ok. I'm slightly concerned that doing so will require us to add new features to both v1beta1 but v1alpha1, but, we'll leave storage as v1beta1.

@@ -107,7 +107,7 @@ func TestNodeAuthorizer(t *testing.T) {
masterConfig.GenericConfig.AdmissionControl = nodeRestrictionAdmission

// enable testing volume attachments
masterConfig.ExtraConfig.APIResourceConfigSource.(*serverstorage.ResourceConfig).EnableVersions(storagev1alpha1.SchemeGroupVersion)
masterConfig.ExtraConfig.APIResourceConfigSource.(*serverstorage.ResourceConfig).EnableVersions(storagev1beta1.SchemeGroupVersion)
Copy link
Member

Choose a reason for hiding this comment

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

Should be able to remove this line if the beta version is enabled by default

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

@@ -294,13 +294,21 @@ var etcdStorageData = map[schema.GroupVersionResource]struct {
},
// --

// k8s.io/kubernetes/pkg/apis/storage/v1alpha1
Copy link
Member

Choose a reason for hiding this comment

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

For minimal diff, keep alpha first and add beta below?

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

@saad-ali
Copy link
Member

/lgtm
/approve

/assign @liggitt for API approval

@k8s-ci-robot
Copy link
Contributor

@saad-ali: GitHub didn't allow me to assign the following users: API, approval, for.

Note that only kubernetes members and repo collaborators can be assigned.

In response to this:

/lgtm
/approve

/assign @liggitt for API approval

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 the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 31, 2018
@NickrenREN
Copy link
Contributor Author

/assign @thockin @liggitt

@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 31, 2018
@NickrenREN
Copy link
Contributor Author

just rebase. @saad-ali

@saad-ali
Copy link
Member

/lgtm

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

@NickrenREN: GitHub didn't allow me to request PR reviews from the following users: brendanburns.

Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @brendanburns

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.

@NickrenREN
Copy link
Contributor Author

/cc @brendandburns

@brendandburns
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brendandburns, NickrenREN, saad-ali

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your 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 Feb 2, 2018
@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here.

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. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move VolumeAttachment API to Beta