Commit fcd7d1f6 authored by kaiyou's avatar kaiyou
Browse files

Contetualize the flannel subnet env file

parent 8bcb9b1e
Pipeline #726 passed with stage
in 2 minutes and 49 seconds
......@@ -402,6 +402,7 @@ func get(envInfo *cmds.Agent) (*config.Node, error) {
FlannelBackend: controlConfig.FlannelBackend,
}
nodeConfig.FlannelIface = flannelIface
nodeConfig.FlannelSubnetFile = filepath.Join(envInfo.DataDir, "subnet.env")
nodeConfig.Images = filepath.Join(envInfo.DataDir, "images")
nodeConfig.AgentConfig.NodeIP = nodeIP
nodeConfig.AgentConfig.NodeName = nodeName
......
......@@ -35,11 +35,7 @@ import (
_ "github.com/coreos/flannel/backend/vxlan"
)
const (
subnetFile = "/run/flannel/subnet.env"
)
func flannel(ctx context.Context, flannelIface *net.Interface, flannelConf, kubeConfigFile string) error {
func flannel(ctx context.Context, flannelIface *net.Interface, flannelConf, subnetFile, kubeConfigFile string) error {
extIface, err := LookupExtIface(flannelIface)
if err != nil {
return err
......
......@@ -94,7 +94,7 @@ func Run(ctx context.Context, nodeConfig *config.Node, nodes v1.NodeInterface) e
}
go func() {
err := flannel(ctx, nodeConfig.FlannelIface, nodeConfig.FlannelConf, nodeConfig.AgentConfig.KubeConfigKubelet)
err := flannel(ctx, nodeConfig.FlannelIface, nodeConfig.FlannelConf, nodeConfig.FlannelSubnetFile, nodeConfig.AgentConfig.KubeConfigKubelet)
logrus.Fatalf("flannel exited: %v", err)
}()
......
......@@ -29,6 +29,7 @@ type Node struct {
FlannelConf string
FlannelConfOverride bool
FlannelIface *net.Interface
FlannelSubnetFile string
Containerd Containerd
Images string
AgentConfig Agent
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment