Skip to content

Commit

Permalink
Renamed NodeConfig.NodeIP to NodeConfig.PodTrafficNodeIP
Browse files Browse the repository at this point in the history
Prep work for segregating pod and management traffic.
To support traffic segregation, NodeConfig need to have multiple node IPs:
one for pod to pod traffic, master to node traffic, etc.
NodeConfig.NodeIP doesn't tell which traffic we are referring to.
NodeConfig.PodTrafficNodeIP is the node IP to be used for
pod to pod traffic.
  • Loading branch information
Ravi Sankar Penta committed May 8, 2017
1 parent b859d78 commit 6557c81
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
5 changes: 4 additions & 1 deletion pkg/cmd/server/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,12 @@ type NodeConfig struct {
// If you're describing a set of static nodes to the master, this value must match one of the values in the list
NodeName string

// Deprecated and maintained for backward compatibility, use PodTrafficNodeIP instead
DeprecatedNodeIP string

// Node may have multiple IPs, specify the IP to use for pod traffic routing
// If not specified, network parse/lookup on the nodeName is performed and the first non-loopback address is used
NodeIP string
PodTrafficNodeIP string

// ServingInfo describes how to start serving
ServingInfo ServingInfo
Expand Down
3 changes: 3 additions & 0 deletions pkg/cmd/server/api/v1/conversions.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ func addDefaultingFuncs(scheme *runtime.Scheme) error {
}
setDefault_ClientConnectionOverrides(obj.MasterClientConnectionOverrides)

if len(obj.PodTrafficNodeIP) == 0 {
obj.PodTrafficNodeIP = obj.DeprecatedNodeIP
}
// Defaults/migrations for NetworkConfig
if len(obj.NetworkConfig.NetworkPluginName) == 0 {
obj.NetworkConfig.NetworkPluginName = obj.DeprecatedNetworkPluginName
Expand Down
4 changes: 3 additions & 1 deletion pkg/cmd/server/api/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ type NodeConfig struct {
// If you're describing a set of static nodes to the master, this value must match one of the values in the list
NodeName string `json:"nodeName"`

// Deprecated and maintained for backward compatibility, use podTrafficNodeIP instead
DeprecatedNodeIP string `json:"nodeIP,omitempty"`
// Node may have multiple IPs, specify the IP to use for pod traffic routing
// If not specified, network parse/lookup on the nodeName is performed and the first non-loopback address is used
NodeIP string `json:"nodeIP"`
PodTrafficNodeIP string `json:"podTrafficNodeIP"`

// ServingInfo describes how to start serving
ServingInfo ServingInfo `json:"servingInfo"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/server/api/v1/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ masterKubeConfig: ""
networkConfig:
mtu: 0
networkPluginName: ""
nodeIP: ""
podTrafficNodeIP: ""
nodeName: ""
podManifestConfig:
fileCheckIntervalSeconds: 0
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/server/api/validation/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ func ValidateNodeConfig(config *api.NodeConfig, fldPath *field.Path) ValidationR
if len(config.NodeName) == 0 {
validationResults.AddErrors(field.Required(fldPath.Child("nodeName"), ""))
}
if len(config.NodeIP) > 0 {
validationResults.AddErrors(ValidateSpecifiedIP(config.NodeIP, fldPath.Child("nodeIP"))...)
if len(config.PodTrafficNodeIP) > 0 {
validationResults.AddErrors(ValidateSpecifiedIP(config.PodTrafficNodeIP, fldPath.Child("podTrafficNodeIP"))...)
}

servingInfoPath := fldPath.Child("servingInfo")
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/server/kubernetes/node/node_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func BuildKubernetesNodeConfig(options configapi.NodeConfig, enableProxy, enable
server.RequireKubeConfig = true
server.PodManifestPath = path
server.RootDirectory = options.VolumeDirectory
server.NodeIP = options.NodeIP
server.NodeIP = options.PodTrafficNodeIP
server.HostnameOverride = options.NodeName
server.AllowPrivileged = true
server.RegisterNode = true
Expand Down Expand Up @@ -206,7 +206,7 @@ func BuildKubernetesNodeConfig(options configapi.NodeConfig, enableProxy, enable

internalKubeInformers := kinternalinformers.NewSharedInformerFactory(kubeClient, proxyconfig.ConfigSyncPeriod)

sdnPlugin, err := sdnplugin.NewNodePlugin(options.NetworkConfig.NetworkPluginName, originClient, kubeClient, options.NodeName, options.NodeIP, iptablesSyncPeriod, options.NetworkConfig.MTU, internalKubeInformers)
sdnPlugin, err := sdnplugin.NewNodePlugin(options.NetworkConfig.NetworkPluginName, originClient, kubeClient, options.NodeName, options.PodTrafficNodeIP, iptablesSyncPeriod, options.NetworkConfig.MTU, internalKubeInformers)
if err != nil {
return nil, fmt.Errorf("SDN initialization failed: %v", err)
}
Expand Down

0 comments on commit 6557c81

Please sign in to comment.