Enable local traffic detection using the interface options

This commit adds the framework for the new local detection
modes BridgeInterface and InterfaceNamePrefix to work.

Signed-off-by: Surya Seetharaman <suryaseetharaman.9@gmail.com>

Kubernetes-commit: 7d480d8ac8e33330af8c8ea863d19d9b547f3bdb
This commit is contained in:
Surya Seetharaman 2022-01-29 12:01:09 +01:00 committed by Kubernetes Publisher
parent 9c1bbdeacc
commit b85d3adcdd
2 changed files with 31 additions and 0 deletions

View File

@ -103,6 +103,18 @@ type KubeProxyWinkernelConfiguration struct {
ForwardHealthCheckVip bool `json:"forwardHealthCheckVip"`
}
// DetectLocalConfiguration contains optional settings related to DetectLocalMode option
type DetectLocalConfiguration struct {
// BridgeInterface is a string argument which represents a single bridge interface name.
// Kube-proxy considers traffic as local if originating from this given bridge.
// This argument should be set if DetectLocalMode is set to LocalModeBridgeInterface.
BridgeInterface string `json:"bridgeInterface"`
// InterfaceNamePrefix is a string argument which represents a single interface prefix name.
// Kube-proxy considers traffic as local if originating from one or more interfaces which match
// the given prefix. This argument should be set if DetectLocalMode is set to LocalModeInterfaceNamePrefix.
InterfaceNamePrefix string `json:"interfaceNamePrefix"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// KubeProxyConfiguration contains everything necessary to configure the
@ -170,6 +182,8 @@ type KubeProxyConfiguration struct {
ShowHiddenMetricsForVersion string `json:"showHiddenMetricsForVersion"`
// DetectLocalMode determines mode to use for detecting local traffic, defaults to LocalModeClusterCIDR
DetectLocalMode LocalMode `json:"detectLocalMode"`
// DetectLocal contains optional configuration settings related to DetectLocalMode.
DetectLocal DetectLocalConfiguration `json:"detectLocal"`
}
// ProxyMode represents modes used by the Kubernetes proxy server.

View File

@ -26,6 +26,22 @@ import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DetectLocalConfiguration) DeepCopyInto(out *DetectLocalConfiguration) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DetectLocalConfiguration.
func (in *DetectLocalConfiguration) DeepCopy() *DetectLocalConfiguration {
if in == nil {
return nil
}
out := new(DetectLocalConfiguration)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *KubeProxyConfiguration) DeepCopyInto(out *KubeProxyConfiguration) {
*out = *in
@ -54,6 +70,7 @@ func (in *KubeProxyConfiguration) DeepCopyInto(out *KubeProxyConfiguration) {
copy(*out, *in)
}
out.Winkernel = in.Winkernel
out.DetectLocal = in.DetectLocal
return
}