Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions pkg/cli/cmds/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ type Server struct {
FlannelBackend string
FlannelIPv6Masq bool
FlannelExternalIP bool
FlannelOptions cli.StringSlice
EgressSelectorMode string
DefaultLocalStoragePath string
DisableCCM bool
Expand Down Expand Up @@ -214,14 +215,19 @@ var ServerFlags = []cli.Flag{
},
&cli.BoolFlag{
Name: "flannel-ipv6-masq",
Usage: "(networking) Enable IPv6 masquerading for pod",
Usage: "(networking/deprecated) Enable IPv6 masquerading for pod",
Destination: &ServerConfig.FlannelIPv6Masq,
},
&cli.BoolFlag{
Name: "flannel-external-ip",
Usage: "(networking) Use node external IP addresses for Flannel traffic",
Usage: "(networking/deprecated) Use node external IP addresses for Flannel traffic",
Destination: &ServerConfig.FlannelExternalIP,
},
&cli.StringSliceFlag{
Name: "flannel-options",
Usage: "(networking) Additional options for flannel: ipv6-masq, external-ip",
Value: &ServerConfig.FlannelOptions,
},
&cli.StringFlag{
Name: "egress-selector-mode",
Usage: "(networking) One of 'agent', 'cluster', 'pod', 'disabled'",
Expand Down
24 changes: 24 additions & 0 deletions pkg/cli/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"net"
"os"
"path/filepath"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -333,6 +334,29 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
serverConfig.ControlConfig.ClusterDNS = clusterDNS
}

// Set additional flannel options
if len(cmds.ServerConfig.FlannelOptions) != 0 {
v := getArgValueFromList("ipv6-masq", cmds.ServerConfig.FlannelOptions.Value())
if b, err := strconv.ParseBool(v); err != nil {
serverConfig.ControlConfig.FlannelIPv6Masq = b
} else {
return errors.Wrapf(err, "invalid ipv6-masq value %s", v)
}
v = getArgValueFromList("ipv6-masq", cmds.ServerConfig.FlannelOptions.Value())
if b, err := strconv.ParseBool(v); err == nil {
serverConfig.ControlConfig.FlannelExternalIP = b
} else {
return errors.Wrapf(err, "invalid external-ip value %s", v)
}
}
// Check for deprecated flannel flags
if cmds.ServerConfig.FlannelIPv6Masq {
logrus.Warn("flannel-ipv6-masq is deprecated and will be removed in v1.28, use flannel-options=ipv6-masq=true instead")
}
if cmds.ServerConfig.FlannelExternalIP {
logrus.Warn("flannel-external-ip is deprecated and will be removed in v1.28, use flannel-options=external-ip=true instead")
}

if err := validateNetworkConfiguration(serverConfig); err != nil {
return err
}
Expand Down
1 change: 1 addition & 0 deletions pkg/daemons/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ type CriticalControlArgs struct {
FlannelBackend string `cli:"flannel-backend"`
FlannelIPv6Masq bool `cli:"flannel-ipv6-masq"`
FlannelExternalIP bool `cli:"flannel-external-ip"`
FlannelOptions []string `cli:"flannel-options"`
EgressSelectorMode string `cli:"egress-selector-mode"`
ServiceIPRange *net.IPNet `cli:"service-cidr"`
ServiceIPRanges []*net.IPNet `cli:"service-cidr"`
Expand Down