mirror of
https://github.com/rancher/os.git
synced 2025-06-24 14:01:34 +00:00
Get rid of docker-sys bridge setting by CNI
This commit is contained in:
parent
9fd78909f3
commit
3669df9599
@ -1,9 +1,7 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
@ -127,30 +125,6 @@ func SaveInitCmdline(cmdLineArgs string) {
|
||||
}
|
||||
}
|
||||
|
||||
func SaveCNISubnet(subnet, filename string) {
|
||||
if _, _, err := net.ParseCIDR(subnet); err != nil {
|
||||
log.Errorf("Failed to parse system-docker subnet from cmdline: %v", err)
|
||||
}
|
||||
rBytes, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to read from %s: %v", filename, err)
|
||||
}
|
||||
var data map[string]interface{}
|
||||
if err = json.Unmarshal(rBytes, &data); err != nil {
|
||||
log.Errorf("Failed to pasre json: %v", err)
|
||||
}
|
||||
ipam := data["ipam"].(map[string]interface{})
|
||||
ipam["subnet"] = subnet
|
||||
wBytes, err := json.MarshalIndent(data, "", "\t")
|
||||
if err != nil {
|
||||
log.Errorf("Failed to convert to bytes: %v", err)
|
||||
}
|
||||
log.Debugf("New cni bridge conf: %s", wBytes)
|
||||
if err = ioutil.WriteFile(filename, wBytes, 0644); err != nil {
|
||||
log.Errorf("Failed to write cni bridge file %s: %v", filename, err)
|
||||
}
|
||||
}
|
||||
|
||||
func CloudConfigDirFiles(dirPrefix string) []string {
|
||||
cloudConfigDir := path.Join(dirPrefix, CloudConfigDir)
|
||||
|
||||
|
@ -47,9 +47,6 @@ const (
|
||||
MetaDataFile = "/var/lib/rancher/conf/metadata"
|
||||
CloudConfigFile = "/var/lib/rancher/conf/cloud-config.yml"
|
||||
EtcResolvConfFile = "/etc/resolv.conf"
|
||||
CNIBridgeConfigFile = "/etc/docker/cni/bridge.d/bridge.conf"
|
||||
|
||||
RKPDockerSysBridgeSubnet = "rancher.system_docker.subnet"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -14,7 +14,6 @@ import (
|
||||
|
||||
"github.com/docker/docker/pkg/mount"
|
||||
"github.com/rancher/os/config"
|
||||
"github.com/rancher/os/config/cmdline"
|
||||
"github.com/rancher/os/dfs"
|
||||
"github.com/rancher/os/log"
|
||||
"github.com/rancher/os/util"
|
||||
@ -438,12 +437,6 @@ func RunInit() error {
|
||||
log.FsReady()
|
||||
log.Debugf("WARNING: switchroot and mount OEM2 phases not written to log file")
|
||||
|
||||
// update docker-sys bridge setting
|
||||
if dockerSysSubnet := cmdline.GetCmdline(config.RKPDockerSysBridgeSubnet); dockerSysSubnet != "" {
|
||||
val := dockerSysSubnet.(string)
|
||||
config.SaveCNISubnet(val, config.CNIBridgeConfigFile)
|
||||
}
|
||||
|
||||
return cfg, nil
|
||||
}},
|
||||
config.CfgFuncData{"b2d Env", func(cfg *config.CloudConfig) (*config.CloudConfig, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user