Merge pull request #2001 from pixiake/master

Support enable calico typha in configuration
This commit is contained in:
KubeSphere CI Bot 2023-09-25 14:42:40 +08:00 committed by GitHub
commit 7db9ae6fb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -33,6 +33,7 @@ type CalicoCfg struct {
VethMTU int `yaml:"vethMTU" json:"vethMTU,omitempty"`
Ipv4NatOutgoing *bool `yaml:"ipv4NatOutgoing" json:"ipv4NatOutgoing,omitempty"`
DefaultIPPOOL *bool `yaml:"defaultIPPOOL" json:"defaultIPPOOL,omitempty"`
EnableTypha *bool `yaml:"enableTypha" json:"enableTypha,omitempty"`
}
type FlannelCfg struct {
@ -183,6 +184,14 @@ func (c *CalicoCfg) EnableDefaultIPPOOL() bool {
return *c.DefaultIPPOOL
}
// Typha is used to determine whether to enable calico Typha
func (c *CalicoCfg) Typha() bool {
if c.EnableTypha == nil {
return false
}
return *c.EnableTypha
}
// EnableInit is used to determine whether to create default network
func (h *HybridnetCfg) EnableInit() bool {
if h.Init == nil {

View File

@ -109,7 +109,7 @@ func deployCalico(d *DeployNetworkPluginModule) []task.Interface {
"CalicoNodeImage": images.GetImage(d.Runtime, d.KubeConf, "calico-node").ImageName(),
"CalicoFlexvolImage": images.GetImage(d.Runtime, d.KubeConf, "calico-flexvol").ImageName(),
"CalicoControllersImage": images.GetImage(d.Runtime, d.KubeConf, "calico-kube-controllers").ImageName(),
"TyphaEnabled": len(d.Runtime.GetHostsByRole(common.K8s)) > 50,
"TyphaEnabled": len(d.Runtime.GetHostsByRole(common.K8s)) > 50 || d.KubeConf.Cluster.Network.Calico.Typha(),
"VethMTU": d.KubeConf.Cluster.Network.Calico.VethMTU,
"NodeCidrMaskSize": d.KubeConf.Cluster.Kubernetes.NodeCidrMaskSize,
"IPIPMode": d.KubeConf.Cluster.Network.Calico.IPIPMode,
@ -137,7 +137,7 @@ func deployCalico(d *DeployNetworkPluginModule) []task.Interface {
"CalicoFlexvolImage": images.GetImage(d.Runtime, d.KubeConf, "calico-flexvol").ImageName(),
"CalicoControllersImage": images.GetImage(d.Runtime, d.KubeConf, "calico-kube-controllers").ImageName(),
"CalicoTyphaImage": images.GetImage(d.Runtime, d.KubeConf, "calico-typha").ImageName(),
"TyphaEnabled": len(d.Runtime.GetHostsByRole(common.K8s)) > 50,
"TyphaEnabled": len(d.Runtime.GetHostsByRole(common.K8s)) > 50 || d.KubeConf.Cluster.Network.Calico.Typha(),
"VethMTU": d.KubeConf.Cluster.Network.Calico.VethMTU,
"NodeCidrMaskSize": d.KubeConf.Cluster.Kubernetes.NodeCidrMaskSize,
"IPIPMode": d.KubeConf.Cluster.Network.Calico.IPIPMode,