Add network.topology into conf.ToMap()
Signed-off-by: Zhengyi Lai <zheng1@yunify.com>
This commit is contained in:
@@ -170,6 +170,7 @@ func (conf *Config) ToMap() map[string]bool {
|
|||||||
if name == "network" {
|
if name == "network" {
|
||||||
ippoolName := "network.ippool"
|
ippoolName := "network.ippool"
|
||||||
nsnpName := "network"
|
nsnpName := "network"
|
||||||
|
networkTopologyName := "network.topology"
|
||||||
if conf.NetworkOptions == nil {
|
if conf.NetworkOptions == nil {
|
||||||
result[nsnpName] = false
|
result[nsnpName] = false
|
||||||
result[ippoolName] = false
|
result[ippoolName] = false
|
||||||
@@ -185,6 +186,12 @@ func (conf *Config) ToMap() map[string]bool {
|
|||||||
} else {
|
} else {
|
||||||
result[ippoolName] = true
|
result[ippoolName] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if conf.NetworkOptions.WeaveScopeHost == "" {
|
||||||
|
result[networkTopologyName] = false
|
||||||
|
} else {
|
||||||
|
result[networkTopologyName] = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -226,7 +233,7 @@ func (conf *Config) stripEmptyOptions() {
|
|||||||
conf.OpenPitrixOptions = nil
|
conf.OpenPitrixOptions = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if conf.NetworkOptions != nil && conf.NetworkOptions.EnableNetworkPolicy == false {
|
if conf.NetworkOptions != nil && conf.NetworkOptions.IsEmpty() {
|
||||||
conf.NetworkOptions = nil
|
conf.NetworkOptions = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ package network
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
|
|
||||||
|
networkv1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
|
||||||
)
|
)
|
||||||
|
|
||||||
type NSNPOptions struct {
|
type NSNPOptions struct {
|
||||||
@@ -35,7 +37,7 @@ type Options struct {
|
|||||||
func NewNetworkOptions() *Options {
|
func NewNetworkOptions() *Options {
|
||||||
return &Options{
|
return &Options{
|
||||||
EnableNetworkPolicy: false,
|
EnableNetworkPolicy: false,
|
||||||
IPPoolType: "none",
|
IPPoolType: networkv1alpha1.IPPoolTypeNone,
|
||||||
NSNPOptions: NSNPOptions{
|
NSNPOptions: NSNPOptions{
|
||||||
AllowedIngressNamespaces: []string{},
|
AllowedIngressNamespaces: []string{},
|
||||||
},
|
},
|
||||||
@@ -43,6 +45,12 @@ func NewNetworkOptions() *Options {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Options) IsEmpty() bool {
|
||||||
|
return s.EnableNetworkPolicy == false &&
|
||||||
|
s.WeaveScopeHost == "" &&
|
||||||
|
s.IPPoolType == networkv1alpha1.IPPoolTypeNone
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Options) Validate() []error {
|
func (s *Options) Validate() []error {
|
||||||
var errors []error
|
var errors []error
|
||||||
return errors
|
return errors
|
||||||
|
|||||||
Reference in New Issue
Block a user