Skip to content

Attach Detach Controller Business Logic #25457

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

Merged

Conversation

saad-ali
Copy link
Member

This PR adds the meat of the attach/detach controller proposed in #20262.

The PR splits the in-memory cache into a desired and actual state of the world.

@saad-ali saad-ali assigned ghost May 11, 2016
@saad-ali saad-ali added the release-note-none Denotes a PR that doesn't merit a release note. label May 11, 2016
@saad-ali saad-ali added this to the v1.3 milestone May 11, 2016
@saad-ali
Copy link
Member Author

saad-ali commented May 11, 2016

This PR is not yet complete. But I wanted to give you a chance to start looking at it.

What's left:

  • Add reconciliation loop between desired and actual state of world.
  • Fix detach code path to not require deviceMountPath.
  • Add logic to check if volume is safe to detach before detaching.
  • Add node population logic (check if annotation present and add to expected state of world data structure).

@k8s-github-robot k8s-github-robot added kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels May 11, 2016
@saad-ali saad-ali force-pushed the expectedStateOfWorldDataStructure branch from 98f03e6 to d583987 Compare May 11, 2016 19:48
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 11, 2016
@saad-ali saad-ali force-pushed the expectedStateOfWorldDataStructure branch from d583987 to 62cc762 Compare May 11, 2016 19:59
@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 12, 2016
@saad-ali saad-ali force-pushed the expectedStateOfWorldDataStructure branch from 62cc762 to 4e7b676 Compare May 12, 2016 03:59
@k8s-github-robot k8s-github-robot added kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/old-docs and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels May 12, 2016
@saad-ali saad-ali force-pushed the expectedStateOfWorldDataStructure branch 2 times, most recently from fcf1e70 to cc104eb Compare May 12, 2016 08:01
pvInformer,
ResyncPeriod(s)(),
cloud,
ProbeAttachableVolumePlugins(s.VolumeConfiguration.FlexVolumePluginDir))
Copy link

@ghost ghost May 12, 2016

Choose a reason for hiding this comment

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

This feels a bit awkward.. perhaps pass the whole VolumeConfig struct and fish out the settings needed for each plugin in ProbeAttachableVolumePlugins. It is only FlexVolume now but may expand in the future

Copy link
Member Author

Choose a reason for hiding this comment

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

Ack, changed.

@saad-ali saad-ali force-pushed the expectedStateOfWorldDataStructure branch 2 times, most recently from e9fff2d to 918e1e2 Compare May 13, 2016 01:14
@saad-ali saad-ali changed the title [WIP] Attach Detach Controller Business Logic Attach Detach Controller Business Logic May 13, 2016
@saad-ali
Copy link
Member Author

Ready to review.

allPlugins = append(allPlugins, gce_pd.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, git_repo.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, host_path.ProbeVolumePlugins(volume.VolumeConfig{})...)
allPlugins = append(allPlugins, nfs.ProbeVolumePlugins(volume.VolumeConfig{})...)
Copy link

Choose a reason for hiding this comment

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

So it looks like nfs and probably hostPath expect a non-empty configuration... it shouldn't really matter anyways because they are not attachable which makes me think: do we need to probe all plugins here or only the ones which have the potential of being attachable ? If someone wants to make NFS attachable in the future they can add a line here and properly construct a configuration object.

Copy link
Member Author

Choose a reason for hiding this comment

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

I could go either way. I hate this code, the plugin initialization mechanism needs to be redesigned... someday. I'll reduce this to: gce, aws, cinder, and flex.

selfCreatedPodInformer = true
}
if nodeInformer == nil {
nodeInformer = informers.CreateSharedNodeIndexInformer(kubeClient, resyncPeriod)
selfCreatedNodeInformer = true
}
if pvcInformer == nil {
Copy link
Member

Choose a reason for hiding this comment

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

Is there a legitimate reason to ever pass nil to this function? I dislike this pattern, and I'd rather not have the fallback

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed it's ugly. It would be passed in nil for testing, but we could move this responsibility to the test. Will remove it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@saad-ali saad-ali force-pushed the expectedStateOfWorldDataStructure branch from 6303cf9 to 523a541 Compare May 25, 2016 03:59
@thockin
Copy link
Member

thockin commented May 25, 2016

probably should squash before commit

@saad-ali
Copy link
Member Author

probably should squash before commit

Yep, will squash on LGTM. Just wanted to make it easy to see the diffs for code review.

@thockin
Copy link
Member

thockin commented May 25, 2016

LGTM - just make sure not to lose track of the follow-up work.

@thockin thockin added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 25, 2016
@saad-ali
Copy link
Member Author

LGTM - just make sure not to lose track of the follow-up work.

I've got a list =)

Split controller cache into actual and desired state of world.
Controller will only operate on volumes scheduled to nodes that
have the "volumes.kubernetes.io/controller-managed-attach" annotation.
@saad-ali saad-ali force-pushed the expectedStateOfWorldDataStructure branch from 523a541 to 92500a2 Compare May 25, 2016 06:02
@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 25, 2016
@saad-ali saad-ali added lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/backlog Higher priority than priority/awaiting-more-evidence. labels May 25, 2016
@saad-ali
Copy link
Member Author

Setting priority to P2 to bump in the submit queue, other 1.3 work is dependent on this.

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented May 26, 2016

GCE e2e build/test passed for commit 92500a2.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit bda0dc8 into kubernetes:master May 26, 2016
@saad-ali saad-ali deleted the expectedStateOfWorldDataStructure branch August 15, 2016 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. priority/backlog Higher priority than priority/awaiting-more-evidence. release-note-none Denotes a PR that doesn't merit a release note. 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.

5 participants