1
0
mirror of https://github.com/rancher/os.git synced 2025-09-02 07:15:41 +00:00

Get rid of docker-sys bridge setting by CNI

This commit is contained in:
niusmallnan
2018-05-11 15:10:15 +08:00
parent 9fd78909f3
commit 3669df9599
3 changed files with 0 additions and 36 deletions

View File

@@ -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)