mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
cmd/kube-proxy: Replace deprecated func usage from the k8s.io/utils/pointer
pkg
This commit is contained in:
parent
132f29769d
commit
17c14ced18
@ -87,7 +87,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/util/oom"
|
"k8s.io/kubernetes/pkg/util/oom"
|
||||||
"k8s.io/utils/exec"
|
"k8s.io/utils/exec"
|
||||||
netutils "k8s.io/utils/net"
|
netutils "k8s.io/utils/net"
|
||||||
utilpointer "k8s.io/utils/pointer"
|
"k8s.io/utils/pointer"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -182,8 +182,8 @@ func (o *Options) AddFlags(fs *pflag.FlagSet) {
|
|||||||
fs.MarkDeprecated("healthz-port", "This flag is deprecated and will be removed in a future release. Please use --healthz-bind-address instead.")
|
fs.MarkDeprecated("healthz-port", "This flag is deprecated and will be removed in a future release. Please use --healthz-bind-address instead.")
|
||||||
fs.Int32Var(&o.metricsPort, "metrics-port", o.metricsPort, "The port to bind the metrics server. Use 0 to disable.")
|
fs.Int32Var(&o.metricsPort, "metrics-port", o.metricsPort, "The port to bind the metrics server. Use 0 to disable.")
|
||||||
fs.MarkDeprecated("metrics-port", "This flag is deprecated and will be removed in a future release. Please use --metrics-bind-address instead.")
|
fs.MarkDeprecated("metrics-port", "This flag is deprecated and will be removed in a future release. Please use --metrics-bind-address instead.")
|
||||||
fs.Int32Var(o.config.OOMScoreAdj, "oom-score-adj", utilpointer.Int32PtrDerefOr(o.config.OOMScoreAdj, int32(qos.KubeProxyOOMScoreAdj)), "The oom-score-adj value for kube-proxy process. Values must be within the range [-1000, 1000]. This parameter is ignored if a config file is specified by --config.")
|
fs.Int32Var(o.config.OOMScoreAdj, "oom-score-adj", pointer.Int32Deref(o.config.OOMScoreAdj, int32(qos.KubeProxyOOMScoreAdj)), "The oom-score-adj value for kube-proxy process. Values must be within the range [-1000, 1000]. This parameter is ignored if a config file is specified by --config.")
|
||||||
fs.Int32Var(o.config.IPTables.MasqueradeBit, "iptables-masquerade-bit", utilpointer.Int32PtrDerefOr(o.config.IPTables.MasqueradeBit, 14), "If using the pure iptables proxy, the bit of the fwmark space to mark packets requiring SNAT with. Must be within the range [0, 31].")
|
fs.Int32Var(o.config.IPTables.MasqueradeBit, "iptables-masquerade-bit", pointer.Int32Deref(o.config.IPTables.MasqueradeBit, 14), "If using the pure iptables proxy, the bit of the fwmark space to mark packets requiring SNAT with. Must be within the range [0, 31].")
|
||||||
fs.Int32Var(o.config.Conntrack.MaxPerCore, "conntrack-max-per-core", *o.config.Conntrack.MaxPerCore,
|
fs.Int32Var(o.config.Conntrack.MaxPerCore, "conntrack-max-per-core", *o.config.Conntrack.MaxPerCore,
|
||||||
"Maximum number of NAT connections to track per CPU core (0 to leave the limit as-is and ignore conntrack-min).")
|
"Maximum number of NAT connections to track per CPU core (0 to leave the limit as-is and ignore conntrack-min).")
|
||||||
fs.Int32Var(o.config.Conntrack.Min, "conntrack-min", *o.config.Conntrack.Min,
|
fs.Int32Var(o.config.Conntrack.Min, "conntrack-min", *o.config.Conntrack.Min,
|
||||||
|
@ -31,7 +31,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
utilpointer "k8s.io/utils/pointer"
|
"k8s.io/utils/pointer"
|
||||||
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
componentbaseconfig "k8s.io/component-base/config"
|
componentbaseconfig "k8s.io/component-base/config"
|
||||||
@ -68,8 +68,8 @@ func TestGetConntrackMax(t *testing.T) {
|
|||||||
|
|
||||||
for i, tc := range testCases {
|
for i, tc := range testCases {
|
||||||
cfg := kubeproxyconfig.KubeProxyConntrackConfiguration{
|
cfg := kubeproxyconfig.KubeProxyConntrackConfiguration{
|
||||||
Min: utilpointer.Int32Ptr(tc.min),
|
Min: pointer.Int32(tc.min),
|
||||||
MaxPerCore: utilpointer.Int32Ptr(tc.maxPerCore),
|
MaxPerCore: pointer.Int32(tc.maxPerCore),
|
||||||
}
|
}
|
||||||
x, e := getConntrackMax(cfg)
|
x, e := getConntrackMax(cfg)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
@ -240,8 +240,8 @@ nodePortAddresses:
|
|||||||
ClusterCIDR: tc.clusterCIDR,
|
ClusterCIDR: tc.clusterCIDR,
|
||||||
ConfigSyncPeriod: metav1.Duration{Duration: 15 * time.Second},
|
ConfigSyncPeriod: metav1.Duration{Duration: 15 * time.Second},
|
||||||
Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{
|
Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{
|
||||||
MaxPerCore: utilpointer.Int32Ptr(2),
|
MaxPerCore: pointer.Int32(2),
|
||||||
Min: utilpointer.Int32Ptr(1),
|
Min: pointer.Int32(1),
|
||||||
TCPCloseWaitTimeout: &metav1.Duration{Duration: 10 * time.Second},
|
TCPCloseWaitTimeout: &metav1.Duration{Duration: 10 * time.Second},
|
||||||
TCPEstablishedTimeout: &metav1.Duration{Duration: 20 * time.Second},
|
TCPEstablishedTimeout: &metav1.Duration{Duration: 20 * time.Second},
|
||||||
},
|
},
|
||||||
@ -250,7 +250,7 @@ nodePortAddresses:
|
|||||||
HostnameOverride: "foo",
|
HostnameOverride: "foo",
|
||||||
IPTables: kubeproxyconfig.KubeProxyIPTablesConfiguration{
|
IPTables: kubeproxyconfig.KubeProxyIPTablesConfiguration{
|
||||||
MasqueradeAll: true,
|
MasqueradeAll: true,
|
||||||
MasqueradeBit: utilpointer.Int32Ptr(17),
|
MasqueradeBit: pointer.Int32(17),
|
||||||
MinSyncPeriod: metav1.Duration{Duration: 10 * time.Second},
|
MinSyncPeriod: metav1.Duration{Duration: 10 * time.Second},
|
||||||
SyncPeriod: metav1.Duration{Duration: 60 * time.Second},
|
SyncPeriod: metav1.Duration{Duration: 60 * time.Second},
|
||||||
},
|
},
|
||||||
@ -261,7 +261,7 @@ nodePortAddresses:
|
|||||||
},
|
},
|
||||||
MetricsBindAddress: tc.metricsBindAddress,
|
MetricsBindAddress: tc.metricsBindAddress,
|
||||||
Mode: kubeproxyconfig.ProxyMode(tc.mode),
|
Mode: kubeproxyconfig.ProxyMode(tc.mode),
|
||||||
OOMScoreAdj: utilpointer.Int32Ptr(17),
|
OOMScoreAdj: pointer.Int32(17),
|
||||||
PortRange: "2-7",
|
PortRange: "2-7",
|
||||||
UDPIdleTimeout: metav1.Duration{Duration: 123 * time.Millisecond},
|
UDPIdleTimeout: metav1.Duration{Duration: 123 * time.Millisecond},
|
||||||
NodePortAddresses: []string{"10.20.30.40/16", "fd00:1::0/64"},
|
NodePortAddresses: []string{"10.20.30.40/16", "fd00:1::0/64"},
|
||||||
|
Loading…
Reference in New Issue
Block a user