Actually pass cluster-cidr on to server

This commit is contained in:
Darren Shepherd 2019-03-03 22:25:02 -07:00
parent 10f48f4f3f
commit e5b7d36c55
2 changed files with 12 additions and 0 deletions

View File

@ -57,6 +57,7 @@ func NewServerCommand(action func(*cli.Context) error) cli.Command {
Name: "cluster-cidr",
Usage: "Network CIDR to use for pod IPs",
Destination: &ServerConfig.ClusterCIDR,
Value: "10.42.0.0/16",
},
cli.StringFlag{
Name: "cluster-secret",

View File

@ -4,6 +4,7 @@ import (
"context"
"flag"
"fmt"
net2 "net"
"os"
"path/filepath"
"strings"
@ -11,6 +12,7 @@ import (
systemd "github.com/coreos/go-systemd/daemon"
"github.com/docker/docker/pkg/reexec"
"github.com/natefinch/lumberjack"
"github.com/pkg/errors"
"github.com/rancher/k3s/pkg/agent"
"github.com/rancher/k3s/pkg/cli/cmds"
"github.com/rancher/k3s/pkg/server"
@ -56,6 +58,10 @@ func Run(app *cli.Context) error {
}
func run(app *cli.Context, cfg *cmds.Server) error {
var (
err error
)
if cfg.Log != "" && os.Getenv("_RIO_REEXEC_") == "" {
return runWithLogging(app, cfg)
}
@ -75,6 +81,11 @@ func run(app *cli.Context, cfg *cmds.Server) error {
serverConfig.TLSConfig.HTTPPort = cfg.HTTPPort
serverConfig.TLSConfig.KnownIPs = knownIPs()
_, serverConfig.ControlConfig.ClusterIPRange, err = net2.ParseCIDR(cfg.ClusterCIDR)
if err != nil {
return errors.Wrapf(err, "Invalid CIDR %s: %v", cfg.ClusterCIDR, err)
}
// TODO: support etcd
serverConfig.ControlConfig.NoLeaderElect = true