Send PodCIDR to network plugins as an event

This commit is contained in:
Dan Williams
2016-01-26 22:02:59 -06:00
parent fc2929ed05
commit 67414afd11
6 changed files with 40 additions and 10 deletions

View File

@@ -33,12 +33,21 @@ import (
const DefaultPluginName = "kubernetes.io/no-op"
// Called when the node's Pod CIDR is known when using the
// controller manager's --allocate-node-cidrs=true option
const NET_PLUGIN_EVENT_POD_CIDR_CHANGE = "pod-cidr-change"
const NET_PLUGIN_EVENT_POD_CIDR_CHANGE_DETAIL_CIDR = "pod-cidr"
// Plugin is an interface to network plugins for the kubelet
type NetworkPlugin interface {
// Init initializes the plugin. This will be called exactly once
// before any other methods are called.
Init(host Host) error
// Called on various events like:
// NET_PLUGIN_EVENT_POD_CIDR_CHANGE
Event(name string, details map[string]interface{})
// Name returns the plugin's name. This will be used when searching
// for a plugin by name, e.g.
Name() string
@@ -130,6 +139,9 @@ func (plugin *noopNetworkPlugin) Init(host Host) error {
return nil
}
func (plugin *noopNetworkPlugin) Event(name string, details map[string]interface{}) {
}
func (plugin *noopNetworkPlugin) Name() string {
return DefaultPluginName
}