From c550c17f7f0910ca32fcf97762170bea4f616cc6 Mon Sep 17 00:00:00 2001 From: cyclinder Date: Fri, 16 Jun 2023 10:01:11 +0800 Subject: [PATCH 1/2] accept int or string flush frequency --- pkg/generated/openapi/zz_generated.openapi.go | 9 +++- .../KubeletConfiguration/after/v1beta1.yaml | 2 +- .../roundtrip/default/v1beta1.yaml | 2 +- .../apis/config/v1beta1/defaults_test.go | 16 +++---- .../component-base/logs/api/v1/options.go | 8 ++-- .../component-base/logs/api/v1/types.go | 32 +++++++++++-- .../component-base/logs/api/v1/types_test.go | 48 ++++++++++++++++++- .../logs/api/v1/zz_generated.deepcopy.go | 17 +++++++ 8 files changed, 113 insertions(+), 21 deletions(-) diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index 15ed83553e7..c070dc22374 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -53901,12 +53901,19 @@ func schema_k8sio_kube_proxy_config_v1alpha1_KubeProxyConfiguration(ref common.R Ref: ref("k8s.io/kube-proxy/config/v1alpha1.DetectLocalConfiguration"), }, }, + "logging": { + SchemaProps: spec.SchemaProps{ + Description: "logging specifies the options of logging. Refer to [Logs Options](https://github.com/kubernetes/component-base/blob/master/logs/options.go) for more information.", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/component-base/logs/api/v1.LoggingConfiguration"), + }, + }, }, Required: []string{"bindAddress", "healthzBindAddress", "metricsBindAddress", "bindAddressHardFail", "enableProfiling", "clusterCIDR", "hostnameOverride", "clientConnection", "iptables", "ipvs", "oomScoreAdj", "mode", "portRange", "conntrack", "configSyncPeriod", "nodePortAddresses", "winkernel", "showHiddenMetricsForVersion", "detectLocalMode", "detectLocal"}, }, }, Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.Duration", "k8s.io/component-base/config/v1alpha1.ClientConnectionConfiguration", "k8s.io/kube-proxy/config/v1alpha1.DetectLocalConfiguration", "k8s.io/kube-proxy/config/v1alpha1.KubeProxyConntrackConfiguration", "k8s.io/kube-proxy/config/v1alpha1.KubeProxyIPTablesConfiguration", "k8s.io/kube-proxy/config/v1alpha1.KubeProxyIPVSConfiguration", "k8s.io/kube-proxy/config/v1alpha1.KubeProxyWinkernelConfiguration"}, + "k8s.io/apimachinery/pkg/apis/meta/v1.Duration", "k8s.io/component-base/config/v1alpha1.ClientConnectionConfiguration", "k8s.io/component-base/logs/api/v1.LoggingConfiguration", "k8s.io/kube-proxy/config/v1alpha1.DetectLocalConfiguration", "k8s.io/kube-proxy/config/v1alpha1.KubeProxyConntrackConfiguration", "k8s.io/kube-proxy/config/v1alpha1.KubeProxyIPTablesConfiguration", "k8s.io/kube-proxy/config/v1alpha1.KubeProxyIPVSConfiguration", "k8s.io/kube-proxy/config/v1alpha1.KubeProxyWinkernelConfiguration"}, } } diff --git a/pkg/kubelet/apis/config/scheme/testdata/KubeletConfiguration/after/v1beta1.yaml b/pkg/kubelet/apis/config/scheme/testdata/KubeletConfiguration/after/v1beta1.yaml index 16406184bd6..ab43f865f3a 100644 --- a/pkg/kubelet/apis/config/scheme/testdata/KubeletConfiguration/after/v1beta1.yaml +++ b/pkg/kubelet/apis/config/scheme/testdata/KubeletConfiguration/after/v1beta1.yaml @@ -51,7 +51,7 @@ kubeAPIBurst: 100 kubeAPIQPS: 50 localStorageCapacityIsolation: true logging: - flushFrequency: 5000000000 + flushFrequency: 5s format: text options: json: diff --git a/pkg/kubelet/apis/config/scheme/testdata/KubeletConfiguration/roundtrip/default/v1beta1.yaml b/pkg/kubelet/apis/config/scheme/testdata/KubeletConfiguration/roundtrip/default/v1beta1.yaml index 12aea87941e..8b877c3ad4e 100644 --- a/pkg/kubelet/apis/config/scheme/testdata/KubeletConfiguration/roundtrip/default/v1beta1.yaml +++ b/pkg/kubelet/apis/config/scheme/testdata/KubeletConfiguration/roundtrip/default/v1beta1.yaml @@ -51,7 +51,7 @@ kubeAPIBurst: 100 kubeAPIQPS: 50 localStorageCapacityIsolation: true logging: - flushFrequency: 5000000000 + flushFrequency: 5s format: text options: json: diff --git a/pkg/kubelet/apis/config/v1beta1/defaults_test.go b/pkg/kubelet/apis/config/v1beta1/defaults_test.go index 9bd3b7a97a6..52b4bc38ff1 100644 --- a/pkg/kubelet/apis/config/v1beta1/defaults_test.go +++ b/pkg/kubelet/apis/config/v1beta1/defaults_test.go @@ -115,7 +115,7 @@ func TestSetDefaultsKubeletConfiguration(t *testing.T) { VolumePluginDir: DefaultVolumePluginDir, Logging: logsapi.LoggingConfiguration{ Format: "text", - FlushFrequency: 5 * time.Second, + FlushFrequency: logsapi.TimeOrMetaDuration{Duration: 5 * time.Second}, }, EnableSystemLogHandler: utilpointer.Bool(true), EnableProfilingHandler: utilpointer.Bool(true), @@ -239,7 +239,7 @@ func TestSetDefaultsKubeletConfiguration(t *testing.T) { KernelMemcgNotification: false, Logging: logsapi.LoggingConfiguration{ Format: "", - FlushFrequency: 5 * time.Second, + FlushFrequency: logsapi.TimeOrMetaDuration{Duration: 5 * time.Second}, }, EnableSystemLogHandler: utilpointer.Bool(false), ShutdownGracePeriod: zeroDuration, @@ -339,7 +339,7 @@ func TestSetDefaultsKubeletConfiguration(t *testing.T) { VolumePluginDir: DefaultVolumePluginDir, Logging: logsapi.LoggingConfiguration{ Format: "text", - FlushFrequency: 5 * time.Second, + FlushFrequency: logsapi.TimeOrMetaDuration{Duration: 5 * time.Second}, }, EnableSystemLogHandler: utilpointer.Bool(false), ReservedMemory: []v1beta1.MemoryReservation{}, @@ -481,7 +481,7 @@ func TestSetDefaultsKubeletConfiguration(t *testing.T) { KernelMemcgNotification: true, Logging: logsapi.LoggingConfiguration{ Format: "json", - FlushFrequency: 5 * time.Second, + FlushFrequency: logsapi.TimeOrMetaDuration{Duration: 5 * time.Second}, }, EnableSystemLogHandler: utilpointer.Bool(true), ShutdownGracePeriod: metav1.Duration{Duration: 60 * time.Second}, @@ -627,7 +627,7 @@ func TestSetDefaultsKubeletConfiguration(t *testing.T) { KernelMemcgNotification: true, Logging: logsapi.LoggingConfiguration{ Format: "json", - FlushFrequency: 5 * time.Second, + FlushFrequency: logsapi.TimeOrMetaDuration{Duration: 5 * time.Second}, }, EnableSystemLogHandler: utilpointer.Bool(true), ShutdownGracePeriod: metav1.Duration{Duration: 60 * time.Second}, @@ -724,7 +724,7 @@ func TestSetDefaultsKubeletConfiguration(t *testing.T) { VolumePluginDir: DefaultVolumePluginDir, Logging: logsapi.LoggingConfiguration{ Format: "text", - FlushFrequency: 5 * time.Second, + FlushFrequency: logsapi.TimeOrMetaDuration{Duration: 5 * time.Second}, }, EnableSystemLogHandler: utilpointer.Bool(true), EnableProfilingHandler: utilpointer.Bool(true), @@ -813,7 +813,7 @@ func TestSetDefaultsKubeletConfiguration(t *testing.T) { VolumePluginDir: DefaultVolumePluginDir, Logging: logsapi.LoggingConfiguration{ Format: "text", - FlushFrequency: 5 * time.Second, + FlushFrequency: logsapi.TimeOrMetaDuration{Duration: 5 * time.Second}, }, EnableSystemLogHandler: utilpointer.Bool(true), EnableProfilingHandler: utilpointer.Bool(true), @@ -902,7 +902,7 @@ func TestSetDefaultsKubeletConfiguration(t *testing.T) { VolumePluginDir: DefaultVolumePluginDir, Logging: logsapi.LoggingConfiguration{ Format: "text", - FlushFrequency: 5 * time.Second, + FlushFrequency: logsapi.TimeOrMetaDuration{Duration: 5 * time.Second}, }, EnableSystemLogHandler: utilpointer.Bool(true), EnableProfilingHandler: utilpointer.Bool(true), diff --git a/staging/src/k8s.io/component-base/logs/api/v1/options.go b/staging/src/k8s.io/component-base/logs/api/v1/options.go index 0279cf883d5..44e036ac7e5 100644 --- a/staging/src/k8s.io/component-base/logs/api/v1/options.go +++ b/staging/src/k8s.io/component-base/logs/api/v1/options.go @@ -262,7 +262,7 @@ func apply(c *LoggingConfiguration, options *LoggingOptions, featureGate feature if err := loggingFlags.Lookup("vmodule").Value.Set(VModuleConfigurationPflag(&c.VModule).String()); err != nil { return fmt.Errorf("internal error while setting klog vmodule: %v", err) } - klog.StartFlushDaemon(c.FlushFrequency) + klog.StartFlushDaemon(c.FlushFrequency.Duration) klog.EnableContextualLogging(p.ContextualLoggingEnabled) return nil } @@ -342,7 +342,7 @@ func addFlags(c *LoggingConfiguration, fs flagSet) { // No new log formats should be added after generation is of flag options logRegistry.freeze() - fs.DurationVar(&c.FlushFrequency, LogFlushFreqFlagName, c.FlushFrequency, "Maximum number of seconds between log flushes") + fs.DurationVar(&c.FlushFrequency.Duration, LogFlushFreqFlagName, c.FlushFrequency.Duration, "Maximum number of seconds between log flushes") fs.VarP(VerbosityLevelPflag(&c.Verbosity), "v", "v", "number for the log level verbosity") fs.Var(VModuleConfigurationPflag(&c.VModule), "vmodule", "comma-separated list of pattern=N settings for file-filtered logging (only works for text log format)") @@ -364,8 +364,8 @@ func SetRecommendedLoggingConfiguration(c *LoggingConfiguration) { if c.Format == "" { c.Format = "text" } - if c.FlushFrequency == 0 { - c.FlushFrequency = LogFlushFreqDefault + if c.FlushFrequency.Duration == 0 { + c.FlushFrequency.Duration = LogFlushFreqDefault } var empty resource.QuantityValue if c.Options.JSON.InfoBufferSize == empty { diff --git a/staging/src/k8s.io/component-base/logs/api/v1/types.go b/staging/src/k8s.io/component-base/logs/api/v1/types.go index d1bf313643b..98a64bc1fd4 100644 --- a/staging/src/k8s.io/component-base/logs/api/v1/types.go +++ b/staging/src/k8s.io/component-base/logs/api/v1/types.go @@ -17,9 +17,11 @@ limitations under the License. package v1 import ( - "time" + "encoding/json" + "fmt" "k8s.io/apimachinery/pkg/api/resource" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) // Supported output formats. @@ -39,10 +41,11 @@ type LoggingConfiguration struct { // Format Flag specifies the structure of log messages. // default value of format is `text` Format string `json:"format,omitempty"` - // Maximum number of nanoseconds (i.e. 1s = 1000000000) between log - // flushes. Ignored if the selected logging backend writes log - // messages without buffering. - FlushFrequency time.Duration `json:"flushFrequency"` + // Maximum time between log flushes. + // If a string, parsed as a duration (i.e. "1s") + // If an int, the maximum number of nanoseconds (i.e. 1s = 1000000000). + // Ignored if the selected logging backend writes log messages without buffering. + FlushFrequency TimeOrMetaDuration `json:"flushFrequency"` // Verbosity is the threshold that determines which log messages are // logged. Default is zero which logs only the most important // messages. Higher values enable additional messages. Error messages @@ -58,6 +61,25 @@ type LoggingConfiguration struct { Options FormatOptions `json:"options,omitempty"` } +// TimeOrMetaDuration is present only for backwards compatibility for the +// flushFrequency field, and new fields should use metav1.Duration. +type TimeOrMetaDuration metav1.Duration + +func (t TimeOrMetaDuration) MarshalJSON() ([]byte, error) { + return (metav1.Duration(t)).MarshalJSON() +} + +func (t *TimeOrMetaDuration) UnmarshalJSON(b []byte) error { + if len(b) > 0 && b[0] == '"' { + // string values unmarshal as metav1.Duration + return json.Unmarshal(b, (*metav1.Duration)(t)) + } + if err := json.Unmarshal(b, &t.Duration); err != nil { + return fmt.Errorf("invalid duration %q: %w", string(b), err) + } + return nil +} + // FormatOptions contains options for the different logging formats. type FormatOptions struct { // [Alpha] JSON contains options for logging format "json". diff --git a/staging/src/k8s.io/component-base/logs/api/v1/types_test.go b/staging/src/k8s.io/component-base/logs/api/v1/types_test.go index 175a5697641..7b847fc3d0d 100644 --- a/staging/src/k8s.io/component-base/logs/api/v1/types_test.go +++ b/staging/src/k8s.io/component-base/logs/api/v1/types_test.go @@ -17,6 +17,7 @@ limitations under the License. package v1 import ( + enjson "encoding/json" "fmt" "math" "reflect" @@ -168,7 +169,7 @@ func TestCompatibility(t *testing.T) { expectAllFields: true, expectConfig: LoggingConfiguration{ Format: JSONLogFormat, - FlushFrequency: time.Nanosecond, + FlushFrequency: TimeOrMetaDuration{Duration: time.Nanosecond}, Verbosity: VerbosityLevel(5), VModule: VModuleConfiguration{ { @@ -264,3 +265,48 @@ func notZeroRecursive(t *testing.T, i interface{}, path string) bool { return valid } + +func TestTimeOrMetaDuration_UnmarshalJSON(t *testing.T) { + tests := []struct { + name string + tomd *TimeOrMetaDuration + arg any + wanted string + }{ + { + name: "string values unmarshal as metav1.Duration", + tomd: &TimeOrMetaDuration{}, + arg: "1s", + wanted: "1s", + }, { + name: "int values unmarshal as metav1.Duration", + tomd: &TimeOrMetaDuration{}, + arg: 1000000000, + wanted: "1s", + }, { + name: "invalid value return error", + tomd: &TimeOrMetaDuration{}, + arg: "invalid", + wanted: "time: invalid duration \"invalid\"", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + b, err := enjson.Marshal(tt.arg) + if err != nil { + t.Errorf("unexpect error: %v", err) + } + + if err := tt.tomd.UnmarshalJSON(b); err == nil { + if tt.wanted != tt.tomd.String() { + t.Errorf("unexpected wanted for %s, wanted: %v, got: %v", tt.name, tt.wanted, tt.tomd.String()) + } + } else { + if err.Error() != tt.wanted { + t.Errorf("UnmarshalJSON() error = %v", err) + } + } + }) + } + +} diff --git a/staging/src/k8s.io/component-base/logs/api/v1/zz_generated.deepcopy.go b/staging/src/k8s.io/component-base/logs/api/v1/zz_generated.deepcopy.go index 87ca10da1a3..9e7fdcd4693 100644 --- a/staging/src/k8s.io/component-base/logs/api/v1/zz_generated.deepcopy.go +++ b/staging/src/k8s.io/component-base/logs/api/v1/zz_generated.deepcopy.go @@ -58,6 +58,7 @@ func (in *JSONOptions) DeepCopy() *JSONOptions { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LoggingConfiguration) DeepCopyInto(out *LoggingConfiguration) { *out = *in + out.FlushFrequency = in.FlushFrequency if in.VModule != nil { in, out := &in.VModule, &out.VModule *out = make(VModuleConfiguration, len(*in)) @@ -77,6 +78,22 @@ func (in *LoggingConfiguration) DeepCopy() *LoggingConfiguration { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TimeOrMetaDuration) DeepCopyInto(out *TimeOrMetaDuration) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TimeOrMetaDuration. +func (in *TimeOrMetaDuration) DeepCopy() *TimeOrMetaDuration { + if in == nil { + return nil + } + out := new(TimeOrMetaDuration) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in VModuleConfiguration) DeepCopyInto(out *VModuleConfiguration) { { From 71ef0dafa72ca8cf2aa26fe1a75d3379a551771a Mon Sep 17 00:00:00 2001 From: cyclinder Date: Thu, 6 Jul 2023 22:30:45 +0800 Subject: [PATCH 2/2] add flag 'logging-format' to kube-proxy --- cmd/kube-proxy/app/server.go | 12 ++- cmd/kube-proxy/app/server_test.go | 10 ++- cmd/kube-proxy/proxy.go | 1 + pkg/proxy/apis/config/fuzzer/fuzzer.go | 3 + pkg/proxy/apis/config/register_test.go | 6 +- .../after/v1alpha1.yaml | 7 ++ .../roundtrip/default/v1alpha1.yaml | 7 ++ pkg/proxy/apis/config/types.go | 4 + pkg/proxy/apis/config/v1alpha1/defaults.go | 3 + .../apis/config/v1alpha1/defaults_test.go | 9 ++ .../v1alpha1/zz_generated.conversion.go | 2 + .../apis/config/validation/validation.go | 2 + .../apis/config/validation/validation_test.go | 82 +++++++++++++++++++ .../apis/config/zz_generated.deepcopy.go | 1 + .../kube-proxy/config/v1alpha1/types.go | 5 ++ .../config/v1alpha1/zz_generated.deepcopy.go | 1 + staging/src/k8s.io/kube-proxy/go.mod | 15 +++- staging/src/k8s.io/kube-proxy/go.sum | 32 +++++++- 18 files changed, 193 insertions(+), 9 deletions(-) diff --git a/cmd/kube-proxy/app/server.go b/cmd/kube-proxy/app/server.go index 7fe01c87769..a799ab0bd83 100644 --- a/cmd/kube-proxy/app/server.go +++ b/cmd/kube-proxy/app/server.go @@ -43,6 +43,7 @@ import ( "k8s.io/apimachinery/pkg/types" utilerrors "k8s.io/apimachinery/pkg/util/errors" utilruntime "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/apimachinery/pkg/util/validation/field" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/apiserver/pkg/server/healthz" "k8s.io/apiserver/pkg/server/mux" @@ -89,7 +90,7 @@ import ( func init() { utilruntime.Must(metricsfeatures.AddFeatureGates(utilfeature.DefaultMutableFeatureGate)) - logsapi.AddFeatureGates(utilfeature.DefaultMutableFeatureGate) + utilruntime.Must(logsapi.AddFeatureGates(utilfeature.DefaultMutableFeatureGate)) } // proxyRun defines the interface to run a specified ProxyServer @@ -207,6 +208,7 @@ func (o *Options) AddFlags(fs *pflag.FlagSet) { fs.Var(&o.config.DetectLocalMode, "detect-local-mode", "Mode to use to detect local traffic. This parameter is ignored if a config file is specified by --config.") fs.StringVar(&o.config.DetectLocal.BridgeInterface, "pod-bridge-interface", o.config.DetectLocal.BridgeInterface, "A bridge interface name in the cluster. Kube-proxy considers traffic as local if originating from an interface which matches the value. This argument should be set if DetectLocalMode is set to BridgeInterface.") fs.StringVar(&o.config.DetectLocal.InterfaceNamePrefix, "pod-interface-name-prefix", o.config.DetectLocal.InterfaceNamePrefix, "An interface prefix in the cluster. Kube-proxy considers traffic as local if originating from interfaces that match the given prefix. This argument should be set if DetectLocalMode is set to InterfaceNamePrefix.") + logsapi.AddFlags(&o.config.Logging, fs) } // newKubeProxyConfiguration returns a KubeProxyConfiguration with default values @@ -468,7 +470,6 @@ addon that provides cluster DNS for these cluster IPs. The user must create a se with the apiserver API to configure the proxy.`, RunE: func(cmd *cobra.Command, args []string) error { verflag.PrintAndExitIfRequested() - cliflag.PrintFlags(cmd.Flags()) if err := initForOS(opts.WindowsService); err != nil { return fmt.Errorf("failed os init: %w", err) @@ -478,6 +479,13 @@ with the apiserver API to configure the proxy.`, return fmt.Errorf("failed complete: %w", err) } + logs.InitLogs() + if err := logsapi.ValidateAndApplyAsField(&opts.config.Logging, utilfeature.DefaultFeatureGate, field.NewPath("logging")); err != nil { + return fmt.Errorf("initialize logging: %v", err) + } + + cliflag.PrintFlags(cmd.Flags()) + if err := opts.Validate(); err != nil { return fmt.Errorf("failed validate: %w", err) } diff --git a/cmd/kube-proxy/app/server_test.go b/cmd/kube-proxy/app/server_test.go index 2b7709a152c..d4a2b3a99b4 100644 --- a/cmd/kube-proxy/app/server_test.go +++ b/cmd/kube-proxy/app/server_test.go @@ -19,7 +19,6 @@ package app import ( "errors" "fmt" - "reflect" "testing" "time" @@ -30,6 +29,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" clientsetfake "k8s.io/client-go/kubernetes/fake" componentbaseconfig "k8s.io/component-base/config" + logsapi "k8s.io/component-base/logs/api/v1" kubeproxyconfig "k8s.io/kubernetes/pkg/proxy/apis/config" "k8s.io/utils/pointer" ) @@ -220,6 +220,10 @@ nodePortAddresses: BridgeInterface: string("cbr0"), InterfaceNamePrefix: string("veth"), }, + Logging: logsapi.LoggingConfiguration{ + Format: "text", + FlushFrequency: logsapi.TimeOrMetaDuration{Duration: 5 * time.Second}, + }, } options := NewOptions() @@ -235,8 +239,8 @@ nodePortAddresses: assert.NoError(t, err, "unexpected error for %s: %v", tc.name, err) - if !reflect.DeepEqual(expected, config) { - t.Fatalf("unexpected config for %s, diff = %s", tc.name, cmp.Diff(config, expected)) + if diff := cmp.Diff(config, expected); diff != "" { + t.Fatalf("unexpected config for %s, diff = %s", tc.name, diff) } } } diff --git a/cmd/kube-proxy/proxy.go b/cmd/kube-proxy/proxy.go index 862496eb300..e167484781a 100644 --- a/cmd/kube-proxy/proxy.go +++ b/cmd/kube-proxy/proxy.go @@ -20,6 +20,7 @@ import ( "os" "k8s.io/component-base/cli" + _ "k8s.io/component-base/logs/json/register" _ "k8s.io/component-base/metrics/prometheus/clientgo" // for client metric registration _ "k8s.io/component-base/metrics/prometheus/version" // for version metric registration "k8s.io/kubernetes/cmd/kube-proxy/app" diff --git a/pkg/proxy/apis/config/fuzzer/fuzzer.go b/pkg/proxy/apis/config/fuzzer/fuzzer.go index ac624c6d254..33b39077adc 100644 --- a/pkg/proxy/apis/config/fuzzer/fuzzer.go +++ b/pkg/proxy/apis/config/fuzzer/fuzzer.go @@ -47,6 +47,9 @@ func Funcs(codecs runtimeserializer.CodecFactory) []interface{} { obj.OOMScoreAdj = pointer.Int32(c.Int31()) obj.ClientConnection.ContentType = "bar" obj.NodePortAddresses = []string{"1.2.3.0/24"} + if obj.Logging.Format == "" { + obj.Logging.Format = "text" + } }, } } diff --git a/pkg/proxy/apis/config/register_test.go b/pkg/proxy/apis/config/register_test.go index adb131ee003..bb1337f77d3 100644 --- a/pkg/proxy/apis/config/register_test.go +++ b/pkg/proxy/apis/config/register_test.go @@ -22,6 +22,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" componentconfigtesting "k8s.io/component-base/config/testing" + logsapi "k8s.io/component-base/logs/api/v1" ) func TestComponentConfigSetup(t *testing.T) { @@ -31,8 +32,9 @@ func TestComponentConfigSetup(t *testing.T) { SchemeGroupVersion: SchemeGroupVersion, AddToScheme: AddToScheme, AllowedTags: map[reflect.Type]bool{ - reflect.TypeOf(metav1.TypeMeta{}): true, - reflect.TypeOf(metav1.Duration{}): true, + reflect.TypeOf(metav1.TypeMeta{}): true, + reflect.TypeOf(metav1.Duration{}): true, + reflect.TypeOf(logsapi.LoggingConfiguration{}): true, }, } diff --git a/pkg/proxy/apis/config/scheme/testdata/KubeProxyConfiguration/after/v1alpha1.yaml b/pkg/proxy/apis/config/scheme/testdata/KubeProxyConfiguration/after/v1alpha1.yaml index 5e8c2de74a1..7f01ffe5b0a 100644 --- a/pkg/proxy/apis/config/scheme/testdata/KubeProxyConfiguration/after/v1alpha1.yaml +++ b/pkg/proxy/apis/config/scheme/testdata/KubeProxyConfiguration/after/v1alpha1.yaml @@ -37,6 +37,13 @@ ipvs: tcpTimeout: 0s udpTimeout: 0s kind: KubeProxyConfiguration +logging: + flushFrequency: 5s + format: text + options: + json: + infoBufferSize: "0" + verbosity: 0 metricsBindAddress: 127.0.0.1:10249 mode: "" nodePortAddresses: null diff --git a/pkg/proxy/apis/config/scheme/testdata/KubeProxyConfiguration/roundtrip/default/v1alpha1.yaml b/pkg/proxy/apis/config/scheme/testdata/KubeProxyConfiguration/roundtrip/default/v1alpha1.yaml index 5e8c2de74a1..7f01ffe5b0a 100644 --- a/pkg/proxy/apis/config/scheme/testdata/KubeProxyConfiguration/roundtrip/default/v1alpha1.yaml +++ b/pkg/proxy/apis/config/scheme/testdata/KubeProxyConfiguration/roundtrip/default/v1alpha1.yaml @@ -37,6 +37,13 @@ ipvs: tcpTimeout: 0s udpTimeout: 0s kind: KubeProxyConfiguration +logging: + flushFrequency: 5s + format: text + options: + json: + infoBufferSize: "0" + verbosity: 0 metricsBindAddress: 127.0.0.1:10249 mode: "" nodePortAddresses: null diff --git a/pkg/proxy/apis/config/types.go b/pkg/proxy/apis/config/types.go index eec55133ee9..cc00fa21da9 100644 --- a/pkg/proxy/apis/config/types.go +++ b/pkg/proxy/apis/config/types.go @@ -23,6 +23,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" componentbaseconfig "k8s.io/component-base/config" + logsapi "k8s.io/component-base/logs/api/v1" ) // KubeProxyIPTablesConfiguration contains iptables-related configuration @@ -188,6 +189,9 @@ type KubeProxyConfiguration struct { DetectLocalMode LocalMode // DetectLocal contains optional configuration settings related to DetectLocalMode. DetectLocal DetectLocalConfiguration + // Logging specifies the options of logging. + // Refer to [Logs Options](https://github.com/kubernetes/component-base/blob/master/logs/options.go) for more information. + Logging logsapi.LoggingConfiguration } // ProxyMode represents modes used by the Kubernetes proxy server. diff --git a/pkg/proxy/apis/config/v1alpha1/defaults.go b/pkg/proxy/apis/config/v1alpha1/defaults.go index 127913249ad..06f812bbb90 100644 --- a/pkg/proxy/apis/config/v1alpha1/defaults.go +++ b/pkg/proxy/apis/config/v1alpha1/defaults.go @@ -24,6 +24,7 @@ import ( kruntime "k8s.io/apimachinery/pkg/runtime" kubeproxyconfigv1alpha1 "k8s.io/kube-proxy/config/v1alpha1" + logsapi "k8s.io/component-base/logs/api/v1" "k8s.io/kubernetes/pkg/cluster/ports" "k8s.io/kubernetes/pkg/kubelet/qos" proxyutil "k8s.io/kubernetes/pkg/proxy/util" @@ -124,6 +125,8 @@ func SetDefaults_KubeProxyConfiguration(obj *kubeproxyconfigv1alpha1.KubeProxyCo if obj.FeatureGates == nil { obj.FeatureGates = make(map[string]bool) } + // Use the Default LoggingConfiguration option + logsapi.SetRecommendedLoggingConfiguration(&obj.Logging) } // getDefaultAddresses returns default address of healthz and metrics server diff --git a/pkg/proxy/apis/config/v1alpha1/defaults_test.go b/pkg/proxy/apis/config/v1alpha1/defaults_test.go index dfcd3acb9c9..7f6fb701118 100644 --- a/pkg/proxy/apis/config/v1alpha1/defaults_test.go +++ b/pkg/proxy/apis/config/v1alpha1/defaults_test.go @@ -24,6 +24,7 @@ import ( "github.com/google/go-cmp/cmp" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" componentbaseconfig "k8s.io/component-base/config/v1alpha1" + logsapi "k8s.io/component-base/logs/api/v1" kubeproxyconfigv1alpha1 "k8s.io/kube-proxy/config/v1alpha1" ) @@ -67,6 +68,10 @@ func TestDefaultsKubeProxyConfiguration(t *testing.T) { TCPCloseWaitTimeout: &metav1.Duration{Duration: 1 * time.Hour}, }, ConfigSyncPeriod: metav1.Duration{Duration: 15 * time.Minute}, + Logging: logsapi.LoggingConfiguration{ + Format: "text", + FlushFrequency: logsapi.TimeOrMetaDuration{Duration: 5 * time.Second}, + }, }, }, { @@ -103,6 +108,10 @@ func TestDefaultsKubeProxyConfiguration(t *testing.T) { TCPCloseWaitTimeout: &metav1.Duration{Duration: 1 * time.Hour}, }, ConfigSyncPeriod: metav1.Duration{Duration: 15 * time.Minute}, + Logging: logsapi.LoggingConfiguration{ + Format: "text", + FlushFrequency: logsapi.TimeOrMetaDuration{Duration: 5 * time.Second}, + }, }, }, } diff --git a/pkg/proxy/apis/config/v1alpha1/zz_generated.conversion.go b/pkg/proxy/apis/config/v1alpha1/zz_generated.conversion.go index ab8c42ba754..3ade1180bcd 100644 --- a/pkg/proxy/apis/config/v1alpha1/zz_generated.conversion.go +++ b/pkg/proxy/apis/config/v1alpha1/zz_generated.conversion.go @@ -158,6 +158,7 @@ func autoConvert_v1alpha1_KubeProxyConfiguration_To_config_KubeProxyConfiguratio if err := Convert_v1alpha1_DetectLocalConfiguration_To_config_DetectLocalConfiguration(&in.DetectLocal, &out.DetectLocal, s); err != nil { return err } + out.Logging = in.Logging return nil } @@ -200,6 +201,7 @@ func autoConvert_config_KubeProxyConfiguration_To_v1alpha1_KubeProxyConfiguratio if err := Convert_config_DetectLocalConfiguration_To_v1alpha1_DetectLocalConfiguration(&in.DetectLocal, &out.DetectLocal, s); err != nil { return err } + out.Logging = in.Logging return nil } diff --git a/pkg/proxy/apis/config/validation/validation.go b/pkg/proxy/apis/config/validation/validation.go index f04145d3cce..599ba27819c 100644 --- a/pkg/proxy/apis/config/validation/validation.go +++ b/pkg/proxy/apis/config/validation/validation.go @@ -28,6 +28,7 @@ import ( "k8s.io/apimachinery/pkg/util/validation/field" utilfeature "k8s.io/apiserver/pkg/util/feature" componentbaseconfig "k8s.io/component-base/config" + logsapi "k8s.io/component-base/logs/api/v1" "k8s.io/component-base/metrics" apivalidation "k8s.io/kubernetes/pkg/apis/core/validation" kubeproxyconfig "k8s.io/kubernetes/pkg/proxy/apis/config" @@ -103,6 +104,7 @@ func Validate(config *kubeproxyconfig.KubeProxyConfiguration) field.ErrorList { if config.DetectLocalMode == kubeproxyconfig.LocalModeInterfaceNamePrefix { allErrs = append(allErrs, validateInterface(config.DetectLocal.InterfaceNamePrefix, newPath.Child("InterfacePrefix"))...) } + allErrs = append(allErrs, logsapi.Validate(&config.Logging, effectiveFeatures, newPath.Child("logging"))...) return allErrs } diff --git a/pkg/proxy/apis/config/validation/validation_test.go b/pkg/proxy/apis/config/validation/validation_test.go index d15a2e293a0..6044739a15e 100644 --- a/pkg/proxy/apis/config/validation/validation_test.go +++ b/pkg/proxy/apis/config/validation/validation_test.go @@ -24,6 +24,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/validation/field" componentbaseconfig "k8s.io/component-base/config" + logsapi "k8s.io/component-base/logs/api/v1" kubeproxyconfig "k8s.io/kubernetes/pkg/proxy/apis/config" "k8s.io/utils/pointer" @@ -58,6 +59,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, }, + Logging: logsapi.LoggingConfiguration{ + Format: "text", + }, }, { BindAddress: "192.168.59.103", HealthzBindAddress: "0.0.0.0:10256", @@ -75,6 +79,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, }, + Logging: logsapi.LoggingConfiguration{ + Format: "text", + }, }, { BindAddress: "192.168.59.103", HealthzBindAddress: "", @@ -92,6 +99,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, }, + Logging: logsapi.LoggingConfiguration{ + Format: "text", + }, }, { BindAddress: "fd00:192:168:59::103", HealthzBindAddress: "", @@ -109,6 +119,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, }, + Logging: logsapi.LoggingConfiguration{ + Format: "text", + }, }, { BindAddress: "10.10.12.11", HealthzBindAddress: "0.0.0.0:12345", @@ -126,6 +139,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, }, + Logging: logsapi.LoggingConfiguration{ + Format: "text", + }, }, { BindAddress: "10.10.12.11", HealthzBindAddress: "0.0.0.0:12345", @@ -143,6 +159,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, }, + Logging: logsapi.LoggingConfiguration{ + Format: "text", + }, }, { BindAddress: "10.10.12.11", HealthzBindAddress: "0.0.0.0:12345", @@ -160,6 +179,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, }, + Logging: logsapi.LoggingConfiguration{ + Format: "text", + }, }, { BindAddress: "10.10.12.11", HealthzBindAddress: "0.0.0.0:12345", @@ -181,6 +203,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { DetectLocal: kubeproxyconfig.DetectLocalConfiguration{ InterfaceNamePrefix: "vethabcde", }, + Logging: logsapi.LoggingConfiguration{ + Format: "text", + }, }, { BindAddress: "10.10.12.11", HealthzBindAddress: "0.0.0.0:12345", @@ -202,6 +227,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { DetectLocal: kubeproxyconfig.DetectLocalConfiguration{ BridgeInterface: "avz", }, + Logging: logsapi.LoggingConfiguration{ + Format: "text", + }, }} for _, successCase := range successCases { @@ -233,6 +261,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, }, + Logging: logsapi.LoggingConfiguration{ + Format: "text", + }, }, expectedErrs: field.ErrorList{field.Invalid(newPath.Child("BindAddress"), "10.10.12.11:2000", "not a valid textual representation of an IP address")}, }, @@ -254,6 +285,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, }, + Logging: logsapi.LoggingConfiguration{ + Format: "text", + }, }, expectedErrs: field.ErrorList{field.Invalid(newPath.Child("HealthzBindAddress"), "0.0.0.0", "must be IP:port")}, }, @@ -275,6 +309,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, }, + Logging: logsapi.LoggingConfiguration{ + Format: "text", + }, }, expectedErrs: field.ErrorList{field.Invalid(newPath.Child("MetricsBindAddress"), "127.0.0.1", "must be IP:port")}, }, @@ -296,6 +333,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, }, + Logging: logsapi.LoggingConfiguration{ + Format: "text", + }, }, expectedErrs: field.ErrorList{field.Invalid(newPath.Child("ClusterCIDR"), "192.168.59.0", "must be a valid CIDR block (e.g. 10.100.0.0/16 or fde4:8dba:82e1::/48)")}, }, @@ -317,6 +357,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, }, + Logging: logsapi.LoggingConfiguration{ + Format: "text", + }, }, expectedErrs: field.ErrorList{field.Invalid(newPath.Child("ClusterCIDR"), "192.168.59.0/24,fd00:192:168::/64,10.0.0.0/16", "only one CIDR allowed or a valid DualStack CIDR (e.g. 10.100.0.0/16,fde4:8dba:82e1::/48)")}, }, @@ -338,6 +381,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, }, + Logging: logsapi.LoggingConfiguration{ + Format: "text", + }, }, expectedErrs: field.ErrorList{field.Invalid(newPath.Child("ConfigSyncPeriod"), metav1.Duration{Duration: -1 * time.Second}, "must be greater than 0")}, }, @@ -361,6 +407,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, }, + Logging: logsapi.LoggingConfiguration{ + Format: "text", + }, }, expectedErrs: field.ErrorList{field.Invalid(newPath.Child("KubeProxyIPVSConfiguration.SyncPeriod"), metav1.Duration{Duration: 0}, "must be greater than 0")}, }, @@ -386,6 +435,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { DetectLocal: kubeproxyconfig.DetectLocalConfiguration{ InterfaceNamePrefix: "", }, + Logging: logsapi.LoggingConfiguration{ + Format: "text", + }, }, expectedErrs: field.ErrorList{field.Invalid(newPath.Child("InterfacePrefix"), "", "must not be empty")}, }, @@ -411,6 +463,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { DetectLocal: kubeproxyconfig.DetectLocalConfiguration{ InterfaceNamePrefix: "eth0", // we won't care about prefix since mode is not prefix }, + Logging: logsapi.LoggingConfiguration{ + Format: "text", + }, }, expectedErrs: field.ErrorList{field.Invalid(newPath.Child("InterfaceName"), "", "must not be empty")}, }, @@ -433,9 +488,36 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, }, DetectLocalMode: "Guess", + Logging: logsapi.LoggingConfiguration{ + Format: "text", + }, }, expectedErrs: field.ErrorList{field.NotSupported(newPath.Child("DetectLocalMode"), "Guess", []string{"ClusterCIDR", "NodeCIDR", "BridgeInterface", "InterfaceNamePrefix", ""})}, }, + "invalid logging format": { + config: kubeproxyconfig.KubeProxyConfiguration{ + BindAddress: "10.10.12.11", + HealthzBindAddress: "0.0.0.0:12345", + MetricsBindAddress: "127.0.0.1:10249", + ClusterCIDR: "192.168.59.0/24", + ConfigSyncPeriod: metav1.Duration{Duration: 1 * time.Second}, + IPTables: kubeproxyconfig.KubeProxyIPTablesConfiguration{ + MasqueradeAll: true, + SyncPeriod: metav1.Duration{Duration: 5 * time.Second}, + MinSyncPeriod: metav1.Duration{Duration: 2 * time.Second}, + }, + Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{ + MaxPerCore: pointer.Int32(1), + Min: pointer.Int32(1), + TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, + TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, + }, + Logging: logsapi.LoggingConfiguration{ + Format: "unsupported format", + }, + }, + expectedErrs: field.ErrorList{field.Invalid(newPath.Child("logging.format"), "unsupported format", "Unsupported log format")}, + }, } for name, testCase := range testCases { diff --git a/pkg/proxy/apis/config/zz_generated.deepcopy.go b/pkg/proxy/apis/config/zz_generated.deepcopy.go index fd83125fc2a..15a86792daa 100644 --- a/pkg/proxy/apis/config/zz_generated.deepcopy.go +++ b/pkg/proxy/apis/config/zz_generated.deepcopy.go @@ -92,6 +92,7 @@ func (in *KubeProxyConfiguration) DeepCopyInto(out *KubeProxyConfiguration) { } out.Winkernel = in.Winkernel out.DetectLocal = in.DetectLocal + in.Logging.DeepCopyInto(&out.Logging) return } diff --git a/staging/src/k8s.io/kube-proxy/config/v1alpha1/types.go b/staging/src/k8s.io/kube-proxy/config/v1alpha1/types.go index 3c6f3ecf6cc..e5654a1175c 100644 --- a/staging/src/k8s.io/kube-proxy/config/v1alpha1/types.go +++ b/staging/src/k8s.io/kube-proxy/config/v1alpha1/types.go @@ -19,6 +19,7 @@ package v1alpha1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" componentbaseconfigv1alpha1 "k8s.io/component-base/config/v1alpha1" + logsapi "k8s.io/component-base/logs/api/v1" ) // KubeProxyIPTablesConfiguration contains iptables-related configuration @@ -184,6 +185,10 @@ type KubeProxyConfiguration struct { DetectLocalMode LocalMode `json:"detectLocalMode"` // DetectLocal contains optional configuration settings related to DetectLocalMode. DetectLocal DetectLocalConfiguration `json:"detectLocal"` + // logging specifies the options of logging. + // Refer to [Logs Options](https://github.com/kubernetes/component-base/blob/master/logs/options.go) + // for more information. + Logging logsapi.LoggingConfiguration `json:"logging,omitempty"` } // ProxyMode represents modes used by the Kubernetes proxy server. diff --git a/staging/src/k8s.io/kube-proxy/config/v1alpha1/zz_generated.deepcopy.go b/staging/src/k8s.io/kube-proxy/config/v1alpha1/zz_generated.deepcopy.go index 5ecdfb06c68..4db886c9a94 100644 --- a/staging/src/k8s.io/kube-proxy/config/v1alpha1/zz_generated.deepcopy.go +++ b/staging/src/k8s.io/kube-proxy/config/v1alpha1/zz_generated.deepcopy.go @@ -70,6 +70,7 @@ func (in *KubeProxyConfiguration) DeepCopyInto(out *KubeProxyConfiguration) { } out.Winkernel = in.Winkernel out.DetectLocal = in.DetectLocal + in.Logging.DeepCopyInto(&out.Logging) return } diff --git a/staging/src/k8s.io/kube-proxy/go.mod b/staging/src/k8s.io/kube-proxy/go.mod index 53c6a8539ba..066b8ff4e56 100644 --- a/staging/src/k8s.io/kube-proxy/go.mod +++ b/staging/src/k8s.io/kube-proxy/go.mod @@ -10,18 +10,31 @@ require ( ) require ( + github.com/beorn7/perks v1.0.1 // indirect + github.com/blang/semver/v4 v4.0.0 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/gofuzz v1.2.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/kr/text v0.2.0 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/prometheus/client_golang v1.16.0 // indirect + github.com/prometheus/client_model v0.3.0 // indirect + github.com/prometheus/common v0.42.0 // indirect + github.com/prometheus/procfs v0.10.1 // indirect github.com/rogpeppe/go-internal v1.6.1 // indirect + github.com/spf13/cobra v1.7.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect golang.org/x/net v0.9.0 // indirect + golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.9.0 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect + google.golang.org/protobuf v1.30.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect k8s.io/klog/v2 v2.100.1 // indirect diff --git a/staging/src/k8s.io/kube-proxy/go.sum b/staging/src/k8s.io/kube-proxy/go.sum index a24c35db640..9866b0eb146 100644 --- a/staging/src/k8s.io/kube-proxy/go.sum +++ b/staging/src/k8s.io/kube-proxy/go.sum @@ -1,9 +1,15 @@ github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/alecthomas/kingpin/v2 v2.3.1/go.mod h1:oYL5vtsvEHZGHxU7DMp32Dvx+qL+ptGn6lWaot2vCNE= +github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -11,6 +17,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/emicklei/go-restful/v3 v3.9.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -22,8 +30,13 @@ github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+ github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -32,14 +45,16 @@ github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/ github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -47,6 +62,7 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= github.com/moby/term v0.0.0-20221205130635-1aeaba878587/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= @@ -56,17 +72,24 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/onsi/ginkgo/v2 v2.9.4/go.mod h1:gCQYp2Q+kSoIj7ykSVb9nskRSsR6PUj4AiLywzIhbKM= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= +github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= +github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= @@ -74,6 +97,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/xhit/go-str2duration v1.2.0/go.mod h1:3cPSlfZlUHVlneIVfePFWcJZsuwf+P1v2SRTV4cUmp4= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.35.1/go.mod h1:9NiG9I2aHTKkcxqCILhjtyNA1QEiCjdBACv4IvrFQ+c= @@ -102,12 +126,15 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -129,6 +156,9 @@ google.golang.org/genproto v0.0.0-20230526161137-0005af68ea54/go.mod h1:zqTuNwFl google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=