mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-26 12:46:06 +00:00
Add show hidden flag to kube-proxy
This commit is contained in:
@@ -153,6 +153,8 @@ type KubeProxyConfiguration struct {
|
||||
NodePortAddresses []string
|
||||
// winkernel contains winkernel-related configuration options.
|
||||
Winkernel KubeProxyWinkernelConfiguration
|
||||
// ShowHiddenMetricsForVersion is the version for which you want to show hidden metrics.
|
||||
ShowHiddenMetricsForVersion string
|
||||
}
|
||||
|
||||
// Currently, three modes of proxy are available in Linux platform: 'userspace' (older, going to be EOL), 'iptables'
|
||||
|
@@ -27,6 +27,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||
componentbaseconfig "k8s.io/component-base/config"
|
||||
"k8s.io/component-base/metrics"
|
||||
apivalidation "k8s.io/kubernetes/pkg/apis/core/validation"
|
||||
kubefeatures "k8s.io/kubernetes/pkg/features"
|
||||
kubeproxyconfig "k8s.io/kubernetes/pkg/proxy/apis/config"
|
||||
@@ -87,6 +88,7 @@ func Validate(config *kubeproxyconfig.KubeProxyConfiguration) field.ErrorList {
|
||||
}
|
||||
|
||||
allErrs = append(allErrs, validateKubeProxyNodePortAddress(config.NodePortAddresses, newPath.Child("NodePortAddresses"))...)
|
||||
allErrs = append(allErrs, validateShowHiddenMetricsVersion(config.ShowHiddenMetricsForVersion, newPath.Child("ShowHiddenMetricsForVersion"))...)
|
||||
|
||||
return allErrs
|
||||
}
|
||||
@@ -274,3 +276,13 @@ func validateIPVSExcludeCIDRs(excludeCIDRs []string, fldPath *field.Path) field.
|
||||
}
|
||||
return allErrs
|
||||
}
|
||||
|
||||
func validateShowHiddenMetricsVersion(version string, fldPath *field.Path) field.ErrorList {
|
||||
allErrs := field.ErrorList{}
|
||||
errs := metrics.ValidateShowHiddenMetricsVersion(version)
|
||||
for _, e := range errs {
|
||||
allErrs = append(allErrs, field.Invalid(fldPath, version, e.Error()))
|
||||
}
|
||||
|
||||
return allErrs
|
||||
}
|
||||
|
Reference in New Issue
Block a user