Skip to content

Instantly share code, notes, and snippets.

@sttts
Last active October 27, 2017 09:42
Show Gist options
  • Save sttts/fa5d9d63dc1077c90005aa3fe2fc052d to your computer and use it in GitHub Desktop.
Save sttts/fa5d9d63dc1077c90005aa3fe2fc052d to your computer and use it in GitHub Desktop.
// Register registers a plugin
func Register(plugins *admission.Plugins) {
plugins.Register("LimitPodHardAntiAffinityTopology", func(config io.Reader) (admission.Interface, error) {
return NewInterPodAntiAffinity(), nil
})
}
// plugin contains the client used by the admission controller
type plugin struct {
*admission.Handler
}
// NewInterPodAntiAffinity creates a new instance of the LimitPodHardAntiAffinityTopology admission controller
func NewInterPodAntiAffinity() *plugin {
return &plugin{
Handler: admission.NewHandler(admission.Create, admission.Update),
}
}
// Register registers a Plugin
func Register(plugins *admission.Plugins) {
plugins.Register("LimitPodHardAntiAffinityTopology", func(config io.Reader) (admission.Interface, error) {
return NewInterPodAntiAffinity(), nil
})
}
type hiddenHandler struct{ admission.Handler }
// Plugin contains the client used by the admission controller
type Plugin struct {
hiddenHandler
}
// NewInterPodAntiAffinity creates a new instance of the LimitPodHardAntiAffinityTopology admission controller
func NewInterPodAntiAffinity() *Plugin {
return &Plugin{
hiddenHandler: hiddenHandler{Handler: *admission.NewHandler(admission.Create, admission.Update)},
}
}
// Register registers a plugin
func Register(plugins *admission.Plugins) {
plugins.Register("LimitPodHardAntiAffinityTopology", func(config io.Reader) (admission.Interface, error) {
return NewInterPodAntiAffinity(), nil
})
}
type Plugin interface {
admission.Interface
// here more interfaces will follow:
// admission.MutatingInterface
// admission.ValidatingInterface
}
// plugin contains the client used by the admission controller
type plugin struct {
*admission.Handler
}
// NewInterPodAntiAffinity creates a new instance of the LimitPodHardAntiAffinityTopology admission controller
func NewInterPodAntiAffinity() Plugin {
return &plugin{
Handler: admission.NewHandler(admission.Create, admission.Update),
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment