-
Notifications
You must be signed in to change notification settings - Fork 950
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: add plugin framework which supports executing custom code at…
… plugin points like start and stop in life cyle of container and daemon
- Loading branch information
Showing
11 changed files
with
226 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package plugins | ||
|
||
import "io" | ||
|
||
// 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 | ||
// could change the container create body passed-in by http request body | ||
PreCreate(io.ReadCloser) (io.ReadCloser, error) | ||
|
||
// PreStart returns an array of PreStartHook which will pass to runc, in PreStartHook there is a Priority which | ||
// used to sort the pre start array that pass to runc, network plugin hook has priority value 0. | ||
PreStart(interface{}) (PreStartHook, error) | ||
} | ||
|
||
// PreStartHook defines the hook wrapper which will return priority and the hook info | ||
type PreStartHook interface { | ||
// Priority returns priority of this hook, the bigger one will run first | ||
Priority() []int | ||
// Hook returns the real hook command | ||
Hook() [][]string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package plugins | ||
|
||
// DaemonPlugin defines in which place does pouch daemon support plugin | ||
type DaemonPlugin interface { | ||
// PreStartHook is invoked by pouch daemon before real start, in this hook user could start dfget proxy or other | ||
// standalone process plugins | ||
PreStartHook() error | ||
|
||
// PreStopHook is invoked by pouch daemon before daemon process exit, not a promise if daemon is killed, in this | ||
// hook user could stop the process or plugin started by PreStartHook | ||
PreStopHook() error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.