Commit e5b7d36c authored by Darren Shepherd's avatar Darren Shepherd

Actually pass cluster-cidr on to server

parent 10f48f4f
...@@ -57,6 +57,7 @@ func NewServerCommand(action func(*cli.Context) error) cli.Command { ...@@ -57,6 +57,7 @@ func NewServerCommand(action func(*cli.Context) error) cli.Command {
Name: "cluster-cidr", Name: "cluster-cidr",
Usage: "Network CIDR to use for pod IPs", Usage: "Network CIDR to use for pod IPs",
Destination: &ServerConfig.ClusterCIDR, Destination: &ServerConfig.ClusterCIDR,
Value: "10.42.0.0/16",
}, },
cli.StringFlag{ cli.StringFlag{
Name: "cluster-secret", Name: "cluster-secret",
......
...@@ -4,6 +4,7 @@ import ( ...@@ -4,6 +4,7 @@ import (
"context" "context"
"flag" "flag"
"fmt" "fmt"
net2 "net"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
...@@ -11,6 +12,7 @@ import ( ...@@ -11,6 +12,7 @@ import (
systemd "github.com/coreos/go-systemd/daemon" systemd "github.com/coreos/go-systemd/daemon"
"github.com/docker/docker/pkg/reexec" "github.com/docker/docker/pkg/reexec"
"github.com/natefinch/lumberjack" "github.com/natefinch/lumberjack"
"github.com/pkg/errors"
"github.com/rancher/k3s/pkg/agent" "github.com/rancher/k3s/pkg/agent"
"github.com/rancher/k3s/pkg/cli/cmds" "github.com/rancher/k3s/pkg/cli/cmds"
"github.com/rancher/k3s/pkg/server" "github.com/rancher/k3s/pkg/server"
...@@ -56,6 +58,10 @@ func Run(app *cli.Context) error { ...@@ -56,6 +58,10 @@ func Run(app *cli.Context) error {
} }
func run(app *cli.Context, cfg *cmds.Server) error { func run(app *cli.Context, cfg *cmds.Server) error {
var (
err error
)
if cfg.Log != "" && os.Getenv("_RIO_REEXEC_") == "" { if cfg.Log != "" && os.Getenv("_RIO_REEXEC_") == "" {
return runWithLogging(app, cfg) return runWithLogging(app, cfg)
} }
...@@ -75,6 +81,11 @@ func run(app *cli.Context, cfg *cmds.Server) error { ...@@ -75,6 +81,11 @@ func run(app *cli.Context, cfg *cmds.Server) error {
serverConfig.TLSConfig.HTTPPort = cfg.HTTPPort serverConfig.TLSConfig.HTTPPort = cfg.HTTPPort
serverConfig.TLSConfig.KnownIPs = knownIPs() 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 // TODO: support etcd
serverConfig.ControlConfig.NoLeaderElect = true serverConfig.ControlConfig.NoLeaderElect = true
......
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