Move config.env handling to go and rename the file
We should not be changing the contents of a file in /etc at runtime.
Move it to /run instead (along with the docker-network config).
@@ -4,6 +4,7 @@ import (
"encoding/hex"
"fmt"
"github.com/golang/glog"
+ "io/ioutil"
"net"
"os/exec"
"strings"
@@ -133,6 +134,11 @@ func (c *FlowController) Setup(localSubnetCIDR, clusterNetworkCIDR, servicesNetw
if alreadySetUp(c.multitenant, fmt.Sprintf("%s/%s", localSubnetGateway, localSubnetMaskLength)) {
return nil
}
+ config := fmt.Sprintf("export OPENSHIFT_CLUSTER_SUBNET=%s", clusterNetworkCIDR)
+ err = ioutil.WriteFile("/run/openshift-sdn/config.env", []byte(config), 0644)
+ if err != nil {
+ return err
+ }
out, err = exec.Command("openshift-sdn-ovs-setup.sh", localSubnetGateway, localSubnetCIDR, fmt.Sprint(localSubnetMaskLength), clusterNetworkCIDR, servicesNetworkCIDR, fmt.Sprint(c.multitenant)).CombinedOutput()
if err != nil {
glog.Errorf("Error executing setup script. \n\tOutput: %s\n\tError: %v\n", out, err)
