mirror of https://github.com/k3s-io/k3s
Add Windows flags for KubeProxyConfiguration
parent
a4272099e7
commit
a47e99e37a
|
@ -37,4 +37,7 @@ func initForOS(windowsService bool) error {
|
||||||
|
|
||||||
func (o *Options) addOSFlags(fs *pflag.FlagSet) {
|
func (o *Options) addOSFlags(fs *pflag.FlagSet) {
|
||||||
fs.BoolVar(&o.WindowsService, "windows-service", o.WindowsService, "Enable Windows Service Control Manager API integration")
|
fs.BoolVar(&o.WindowsService, "windows-service", o.WindowsService, "Enable Windows Service Control Manager API integration")
|
||||||
|
fs.StringVar(&o.config.Winkernel.SourceVip, "source-vip", o.config.Winkernel.SourceVip, "The IP address of the source VIP for non-DSR.")
|
||||||
|
fs.StringVar(&o.config.Winkernel.NetworkName, "network-name", o.config.Winkernel.NetworkName, "The name of the cluster network.")
|
||||||
|
fs.BoolVar(&o.config.Winkernel.EnableDSR, "enable-dsr", o.config.Winkernel.EnableDSR, "If true make kube-proxy apply DSR policies for service VIP")
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,6 +110,7 @@ func newProxyServer(config *proxyconfigapi.KubeProxyConfiguration, cleanupAndExi
|
||||||
utilnode.GetNodeIP(client, hostname),
|
utilnode.GetNodeIP(client, hostname),
|
||||||
recorder,
|
recorder,
|
||||||
healthzUpdater,
|
healthzUpdater,
|
||||||
|
config.Winkernel,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to create proxier: %v", err)
|
return nil, fmt.Errorf("unable to create proxier: %v", err)
|
||||||
|
|
|
@ -78,6 +78,20 @@ type KubeProxyConntrackConfiguration struct {
|
||||||
TCPCloseWaitTimeout *metav1.Duration
|
TCPCloseWaitTimeout *metav1.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// KubeProxyWinkernelConfiguration contains Windows/HNS settings for
|
||||||
|
// the Kubernetes proxy server.
|
||||||
|
type KubeProxyWinkernelConfiguration struct {
|
||||||
|
// networkName is the name of the network kube-proxy will use
|
||||||
|
// to create endpoints and policies
|
||||||
|
NetworkName string
|
||||||
|
// sourceVip is the IP address of the source VIP endoint used for
|
||||||
|
// NAT when loadbalancing
|
||||||
|
SourceVip string
|
||||||
|
// enableDSR tells kube-proxy whether HNS policies should be created
|
||||||
|
// with DSR
|
||||||
|
EnableDSR bool
|
||||||
|
}
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
// KubeProxyConfiguration contains everything necessary to configure the
|
// KubeProxyConfiguration contains everything necessary to configure the
|
||||||
|
@ -140,6 +154,8 @@ type KubeProxyConfiguration struct {
|
||||||
// If set it to a non-zero IP block, kube-proxy will filter that down to just the IPs that applied to the node.
|
// If set it to a non-zero IP block, kube-proxy will filter that down to just the IPs that applied to the node.
|
||||||
// An empty string slice is meant to select all network interfaces.
|
// An empty string slice is meant to select all network interfaces.
|
||||||
NodePortAddresses []string
|
NodePortAddresses []string
|
||||||
|
// winkernel contains winkernel-related configuration options.
|
||||||
|
Winkernel KubeProxyWinkernelConfiguration
|
||||||
}
|
}
|
||||||
|
|
||||||
// Currently, three modes of proxy are available in Linux platform: 'userspace' (older, going to be EOL), 'iptables'
|
// Currently, three modes of proxy are available in Linux platform: 'userspace' (older, going to be EOL), 'iptables'
|
||||||
|
|
|
@ -78,6 +78,16 @@ func RegisterConversions(s *runtime.Scheme) error {
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*v1alpha1.KubeProxyWinkernelConfiguration)(nil), (*config.KubeProxyWinkernelConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_v1alpha1_KubeProxyWinkernelConfiguration_To_config_KubeProxyWinkernelConfiguration(a.(*v1alpha1.KubeProxyWinkernelConfiguration), b.(*config.KubeProxyWinkernelConfiguration), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*config.KubeProxyWinkernelConfiguration)(nil), (*v1alpha1.KubeProxyWinkernelConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_config_KubeProxyWinkernelConfiguration_To_v1alpha1_KubeProxyWinkernelConfiguration(a.(*config.KubeProxyWinkernelConfiguration), b.(*v1alpha1.KubeProxyWinkernelConfiguration), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,6 +118,9 @@ func autoConvert_v1alpha1_KubeProxyConfiguration_To_config_KubeProxyConfiguratio
|
||||||
}
|
}
|
||||||
out.ConfigSyncPeriod = in.ConfigSyncPeriod
|
out.ConfigSyncPeriod = in.ConfigSyncPeriod
|
||||||
out.NodePortAddresses = *(*[]string)(unsafe.Pointer(&in.NodePortAddresses))
|
out.NodePortAddresses = *(*[]string)(unsafe.Pointer(&in.NodePortAddresses))
|
||||||
|
if err := Convert_v1alpha1_KubeProxyWinkernelConfiguration_To_config_KubeProxyWinkernelConfiguration(&in.Winkernel, &out.Winkernel, s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,6 +156,9 @@ func autoConvert_config_KubeProxyConfiguration_To_v1alpha1_KubeProxyConfiguratio
|
||||||
}
|
}
|
||||||
out.ConfigSyncPeriod = in.ConfigSyncPeriod
|
out.ConfigSyncPeriod = in.ConfigSyncPeriod
|
||||||
out.NodePortAddresses = *(*[]string)(unsafe.Pointer(&in.NodePortAddresses))
|
out.NodePortAddresses = *(*[]string)(unsafe.Pointer(&in.NodePortAddresses))
|
||||||
|
if err := Convert_config_KubeProxyWinkernelConfiguration_To_v1alpha1_KubeProxyWinkernelConfiguration(&in.Winkernel, &out.Winkernel, s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,3 +246,27 @@ func autoConvert_config_KubeProxyIPVSConfiguration_To_v1alpha1_KubeProxyIPVSConf
|
||||||
func Convert_config_KubeProxyIPVSConfiguration_To_v1alpha1_KubeProxyIPVSConfiguration(in *config.KubeProxyIPVSConfiguration, out *v1alpha1.KubeProxyIPVSConfiguration, s conversion.Scope) error {
|
func Convert_config_KubeProxyIPVSConfiguration_To_v1alpha1_KubeProxyIPVSConfiguration(in *config.KubeProxyIPVSConfiguration, out *v1alpha1.KubeProxyIPVSConfiguration, s conversion.Scope) error {
|
||||||
return autoConvert_config_KubeProxyIPVSConfiguration_To_v1alpha1_KubeProxyIPVSConfiguration(in, out, s)
|
return autoConvert_config_KubeProxyIPVSConfiguration_To_v1alpha1_KubeProxyIPVSConfiguration(in, out, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func autoConvert_v1alpha1_KubeProxyWinkernelConfiguration_To_config_KubeProxyWinkernelConfiguration(in *v1alpha1.KubeProxyWinkernelConfiguration, out *config.KubeProxyWinkernelConfiguration, s conversion.Scope) error {
|
||||||
|
out.NetworkName = in.NetworkName
|
||||||
|
out.SourceVip = in.SourceVip
|
||||||
|
out.EnableDSR = in.EnableDSR
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_v1alpha1_KubeProxyWinkernelConfiguration_To_config_KubeProxyWinkernelConfiguration is an autogenerated conversion function.
|
||||||
|
func Convert_v1alpha1_KubeProxyWinkernelConfiguration_To_config_KubeProxyWinkernelConfiguration(in *v1alpha1.KubeProxyWinkernelConfiguration, out *config.KubeProxyWinkernelConfiguration, s conversion.Scope) error {
|
||||||
|
return autoConvert_v1alpha1_KubeProxyWinkernelConfiguration_To_config_KubeProxyWinkernelConfiguration(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_config_KubeProxyWinkernelConfiguration_To_v1alpha1_KubeProxyWinkernelConfiguration(in *config.KubeProxyWinkernelConfiguration, out *v1alpha1.KubeProxyWinkernelConfiguration, s conversion.Scope) error {
|
||||||
|
out.NetworkName = in.NetworkName
|
||||||
|
out.SourceVip = in.SourceVip
|
||||||
|
out.EnableDSR = in.EnableDSR
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_config_KubeProxyWinkernelConfiguration_To_v1alpha1_KubeProxyWinkernelConfiguration is an autogenerated conversion function.
|
||||||
|
func Convert_config_KubeProxyWinkernelConfiguration_To_v1alpha1_KubeProxyWinkernelConfiguration(in *config.KubeProxyWinkernelConfiguration, out *v1alpha1.KubeProxyWinkernelConfiguration, s conversion.Scope) error {
|
||||||
|
return autoConvert_config_KubeProxyWinkernelConfiguration_To_v1alpha1_KubeProxyWinkernelConfiguration(in, out, s)
|
||||||
|
}
|
||||||
|
|
|
@ -74,6 +74,7 @@ func (in *KubeProxyConfiguration) DeepCopyInto(out *KubeProxyConfiguration) {
|
||||||
*out = make([]string, len(*in))
|
*out = make([]string, len(*in))
|
||||||
copy(*out, *in)
|
copy(*out, *in)
|
||||||
}
|
}
|
||||||
|
out.Winkernel = in.Winkernel
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,3 +182,19 @@ func (in *KubeProxyIPVSConfiguration) DeepCopy() *KubeProxyIPVSConfiguration {
|
||||||
in.DeepCopyInto(out)
|
in.DeepCopyInto(out)
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *KubeProxyWinkernelConfiguration) DeepCopyInto(out *KubeProxyWinkernelConfiguration) {
|
||||||
|
*out = *in
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeProxyWinkernelConfiguration.
|
||||||
|
func (in *KubeProxyWinkernelConfiguration) DeepCopy() *KubeProxyWinkernelConfiguration {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(KubeProxyWinkernelConfiguration)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
|
@ -74,6 +74,20 @@ type KubeProxyConntrackConfiguration struct {
|
||||||
TCPCloseWaitTimeout *metav1.Duration `json:"tcpCloseWaitTimeout"`
|
TCPCloseWaitTimeout *metav1.Duration `json:"tcpCloseWaitTimeout"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// KubeProxyWinkernelConfiguration contains Windows/HNS settings for
|
||||||
|
// the Kubernetes proxy server.
|
||||||
|
type KubeProxyWinkernelConfiguration struct {
|
||||||
|
// networkName is the name of the network kube-proxy will use
|
||||||
|
// to create endpoints and policies
|
||||||
|
NetworkName string `json:"networkName"`
|
||||||
|
// sourceVip is the IP address of the source VIP endoint used for
|
||||||
|
// NAT when loadbalancing
|
||||||
|
SourceVip string `json:"sourceVip"`
|
||||||
|
// enableDSR tells kube-proxy whether HNS policies should be created
|
||||||
|
// with DSR
|
||||||
|
EnableDSR bool `json:"enableDSR"`
|
||||||
|
}
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
// KubeProxyConfiguration contains everything necessary to configure the
|
// KubeProxyConfiguration contains everything necessary to configure the
|
||||||
|
@ -136,6 +150,8 @@ type KubeProxyConfiguration struct {
|
||||||
// If set it to a non-zero IP block, kube-proxy will filter that down to just the IPs that applied to the node.
|
// If set it to a non-zero IP block, kube-proxy will filter that down to just the IPs that applied to the node.
|
||||||
// An empty string slice is meant to select all network interfaces.
|
// An empty string slice is meant to select all network interfaces.
|
||||||
NodePortAddresses []string `json:"nodePortAddresses"`
|
NodePortAddresses []string `json:"nodePortAddresses"`
|
||||||
|
// winkernel contains winkernel-related configuration options.
|
||||||
|
Winkernel KubeProxyWinkernelConfiguration `json:"winkernel"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Currently, three modes of proxy are available in Linux platform: 'userspace' (older, going to be EOL), 'iptables'
|
// Currently, three modes of proxy are available in Linux platform: 'userspace' (older, going to be EOL), 'iptables'
|
||||||
|
|
|
@ -52,6 +52,7 @@ func (in *KubeProxyConfiguration) DeepCopyInto(out *KubeProxyConfiguration) {
|
||||||
*out = make([]string, len(*in))
|
*out = make([]string, len(*in))
|
||||||
copy(*out, *in)
|
copy(*out, *in)
|
||||||
}
|
}
|
||||||
|
out.Winkernel = in.Winkernel
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,3 +160,19 @@ func (in *KubeProxyIPVSConfiguration) DeepCopy() *KubeProxyIPVSConfiguration {
|
||||||
in.DeepCopyInto(out)
|
in.DeepCopyInto(out)
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *KubeProxyWinkernelConfiguration) DeepCopyInto(out *KubeProxyWinkernelConfiguration) {
|
||||||
|
*out = *in
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeProxyWinkernelConfiguration.
|
||||||
|
func (in *KubeProxyWinkernelConfiguration) DeepCopy() *KubeProxyWinkernelConfiguration {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(KubeProxyWinkernelConfiguration)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue