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

feature: add plugin framework #919

Merged
merged 1 commit into from
Mar 20, 2018

Conversation

yyb196
Copy link
Collaborator

@yyb196 yyb196 commented Mar 19, 2018

Ⅰ. Describe what this PR did

which support executing custom code at plugin points like start and stop in life cyle of container and daemon

features:

  • at daemon start plugin point users can start dfget proxy and setup network plugins.
  • before daemon stop users can stop the assist processes we started
  • when creating container users can change some attriubute passed in by request body, which enables we in our company convert parameters that used by old scheduling system to pouch style.
  • before start a container users can add more pre-start hooks to runc which enables in our company we setup network qos rule and change some configration files in container at this point

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how you did it

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@allencloud @rudyfly @wangforthinker @Letty5411 PTAL

@yyb196 yyb196 force-pushed the feature-plugin branch 8 times, most recently from 6d36758 to 75f71ce Compare March 19, 2018 15:28
@codecov-io
Copy link

codecov-io commented Mar 19, 2018

Codecov Report

Merging #919 into master will decrease coverage by 0.06%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #919      +/-   ##
==========================================
- Coverage   13.59%   13.53%   -0.07%     
==========================================
  Files         121      121              
  Lines        7706     7742      +36     
==========================================
  Hits         1048     1048              
- Misses       6568     6604      +36     
  Partials       90       90
Impacted Files Coverage Δ
daemon/mgr/spec.go 0% <ø> (ø) ⬆️
daemon/mgr/spec_hook.go 0% <0%> (ø) ⬆️
daemon/mgr/container.go 2.38% <0%> (-0.04%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d2db13e...c60b536. Read the comment docs.

@yyb196 yyb196 force-pushed the feature-plugin branch 2 times, most recently from 985cc42 to e874dac Compare March 20, 2018 03:16
@yyb196 yyb196 force-pushed the feature-plugin branch 2 times, most recently from 29a6dbb to 97526d8 Compare March 20, 2018 04:20
… plugin points like start and stop in life cyle of container and daemon
@pouchrobot
Copy link
Collaborator

@yyb196 Thanks for your contribution. 🍻
Please sign off in each of your commits.

@yyb196
Copy link
Collaborator Author

yyb196 commented Mar 20, 2018

@allencloud @rudyfly @HusterWan @Letty5411 please take a look at your earliest convenience, i'm eager to implement inner-company requirement via this plugin framework.

@allencloud
Copy link
Collaborator

Thanks a lot for your work. @yyb196
I am impressed at the code and document. I think this is very essential and helpful feature to bring open source pouch to some customized scenarios.
LGTM

@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label Mar 20, 2018
@allencloud allencloud merged commit ffdd8b6 into AliyunContainerService:master Mar 20, 2018
@allencloud allencloud changed the title [feature] add plugin framework feature: add plugin framework Mar 20, 2018

// ContainerPlugin defines in which place a plugin will be triggered in container lifecycle
type ContainerPlugin interface {
// PreCreate defines plugin point where recevives an container create request, in this plugin point user
Copy link
Contributor

Choose a reason for hiding this comment

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

s/recevives/receives

if s.ContainerPlugin != nil {
logrus.Infof("invoke container pre-create hook in plugin")
if reader, ex = s.ContainerPlugin.PreCreate(req.Body); ex != nil {
return errors.Wrapf(ex, "pre-create plugin piont execute failed")
Copy link
Contributor

Choose a reason for hiding this comment

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

s/piont/point

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

these typo will be fixed in #929

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature LGTM one maintainer or community participant agrees to merge the pull reuqest. size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants