|
@@ -75,6 +75,9 @@ type NetworkController interface {
|
|
|
// ID provides a unique identity for the controller
|
|
|
ID() string
|
|
|
|
|
|
+ // BuiltinDrivers returns list of builtin drivers
|
|
|
+ BuiltinDrivers() []string
|
|
|
+
|
|
|
// Config method returns the bootup configuration for the controller
|
|
|
Config() config.Config
|
|
|
|
|
@@ -324,27 +327,7 @@ func (c *controller) clusterAgentInit() {
|
|
|
c.agentClose()
|
|
|
c.cleanupServiceBindings("")
|
|
|
|
|
|
- c.Lock()
|
|
|
- ingressSandbox := c.ingressSandbox
|
|
|
- c.ingressSandbox = nil
|
|
|
- c.Unlock()
|
|
|
-
|
|
|
- if ingressSandbox != nil {
|
|
|
- if err := ingressSandbox.Delete(); err != nil {
|
|
|
- log.Warnf("Could not delete ingress sandbox while leaving: %v", err)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- n, err := c.NetworkByName("ingress")
|
|
|
- if err != nil {
|
|
|
- log.Warnf("Could not find ingress network while leaving: %v", err)
|
|
|
- }
|
|
|
-
|
|
|
- if n != nil {
|
|
|
- if err := n.Delete(); err != nil {
|
|
|
- log.Warnf("Could not delete ingress network while leaving: %v", err)
|
|
|
- }
|
|
|
- }
|
|
|
+ c.clearIngress(true)
|
|
|
|
|
|
return
|
|
|
}
|
|
@@ -483,6 +466,17 @@ func (c *controller) ID() string {
|
|
|
return c.id
|
|
|
}
|
|
|
|
|
|
+func (c *controller) BuiltinDrivers() []string {
|
|
|
+ drivers := []string{}
|
|
|
+ for _, i := range getInitializers() {
|
|
|
+ if i.ntype == "remote" {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ drivers = append(drivers, i.ntype)
|
|
|
+ }
|
|
|
+ return drivers
|
|
|
+}
|
|
|
+
|
|
|
func (c *controller) validateHostDiscoveryConfig() bool {
|
|
|
if c.cfg == nil || c.cfg.Cluster.Discovery == "" || c.cfg.Cluster.Address == "" {
|
|
|
return false
|
|
@@ -1108,7 +1102,32 @@ func (c *controller) getIPAMDriver(name string) (ipamapi.Ipam, *ipamapi.Capabili
|
|
|
}
|
|
|
|
|
|
func (c *controller) Stop() {
|
|
|
+ c.clearIngress(false)
|
|
|
c.closeStores()
|
|
|
c.stopExternalKeyListener()
|
|
|
osl.GC()
|
|
|
}
|
|
|
+
|
|
|
+func (c *controller) clearIngress(clusterLeave bool) {
|
|
|
+ c.Lock()
|
|
|
+ ingressSandbox := c.ingressSandbox
|
|
|
+ c.ingressSandbox = nil
|
|
|
+ c.Unlock()
|
|
|
+
|
|
|
+ if ingressSandbox != nil {
|
|
|
+ if err := ingressSandbox.Delete(); err != nil {
|
|
|
+ log.Warnf("Could not delete ingress sandbox while leaving: %v", err)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ n, err := c.NetworkByName("ingress")
|
|
|
+ if err != nil && clusterLeave {
|
|
|
+ log.Warnf("Could not find ingress network while leaving: %v", err)
|
|
|
+ }
|
|
|
+
|
|
|
+ if n != nil {
|
|
|
+ if err := n.Delete(); err != nil {
|
|
|
+ log.Warnf("Could not delete ingress network while leaving: %v", err)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|