mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Merge pull request #87403 from gavinfish/kubectl_pkg
Staticcheck: vendor/k8s.io/kubectl/pkg/scale etc.
This commit is contained in:
commit
de9bbcc9cd
@ -103,9 +103,4 @@ vendor/k8s.io/kubectl/pkg/cmd/rollingupdate
|
|||||||
vendor/k8s.io/kubectl/pkg/cmd/scale
|
vendor/k8s.io/kubectl/pkg/cmd/scale
|
||||||
vendor/k8s.io/kubectl/pkg/cmd/set
|
vendor/k8s.io/kubectl/pkg/cmd/set
|
||||||
vendor/k8s.io/kubectl/pkg/cmd/testing
|
vendor/k8s.io/kubectl/pkg/cmd/testing
|
||||||
vendor/k8s.io/kubectl/pkg/cmd/top
|
|
||||||
vendor/k8s.io/kubectl/pkg/cmd/util/editor
|
|
||||||
vendor/k8s.io/kubectl/pkg/cmd/wait
|
|
||||||
vendor/k8s.io/kubectl/pkg/describe/versioned
|
|
||||||
vendor/k8s.io/kubectl/pkg/scale
|
|
||||||
vendor/k8s.io/metrics/pkg/client/custom_metrics
|
vendor/k8s.io/metrics/pkg/client/custom_metrics
|
||||||
|
@ -181,7 +181,7 @@ func (o TopNodeOptions) RunTopNode() error {
|
|||||||
|
|
||||||
metricsAPIAvailable := SupportedMetricsAPIVersionAvailable(apiGroups)
|
metricsAPIAvailable := SupportedMetricsAPIVersionAvailable(apiGroups)
|
||||||
|
|
||||||
metrics := &metricsapi.NodeMetricsList{}
|
var metrics *metricsapi.NodeMetricsList
|
||||||
if metricsAPIAvailable {
|
if metricsAPIAvailable {
|
||||||
metrics, err = getNodeMetricsFromMetricsAPI(o.MetricsClient, o.ResourceName, selector)
|
metrics, err = getNodeMetricsFromMetricsAPI(o.MetricsClient, o.ResourceName, selector)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -175,7 +175,7 @@ func (o TopPodOptions) RunTopPod() error {
|
|||||||
|
|
||||||
metricsAPIAvailable := SupportedMetricsAPIVersionAvailable(apiGroups)
|
metricsAPIAvailable := SupportedMetricsAPIVersionAvailable(apiGroups)
|
||||||
|
|
||||||
metrics := &metricsapi.PodMetricsList{}
|
var metrics *metricsapi.PodMetricsList
|
||||||
if metricsAPIAvailable {
|
if metricsAPIAvailable {
|
||||||
metrics, err = getMetricsFromMetricsAPI(o.MetricsClient, o.Namespace, o.ResourceName, o.AllNamespaces, selector)
|
metrics, err = getMetricsFromMetricsAPI(o.MetricsClient, o.Namespace, o.ResourceName, o.AllNamespaces, selector)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -15,7 +15,6 @@ go_library(
|
|||||||
"//staging/src/k8s.io/apimachinery/pkg/api/meta:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/api/meta:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/mergepatch:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/mergepatch:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/strategicpatch:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/strategicpatch:go_default_library",
|
||||||
|
@ -37,7 +37,6 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/api/meta"
|
"k8s.io/apimachinery/pkg/api/meta"
|
||||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
"k8s.io/apimachinery/pkg/util/mergepatch"
|
"k8s.io/apimachinery/pkg/util/mergepatch"
|
||||||
"k8s.io/apimachinery/pkg/util/strategicpatch"
|
"k8s.io/apimachinery/pkg/util/strategicpatch"
|
||||||
@ -731,10 +730,6 @@ func (h *editHeader) writeTo(w io.Writer, editMode EditMode) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *editHeader) flush() {
|
|
||||||
h.reasons = []editReason{}
|
|
||||||
}
|
|
||||||
|
|
||||||
// editResults capture the result of an update
|
// editResults capture the result of an update
|
||||||
type editResults struct {
|
type editResults struct {
|
||||||
header editHeader
|
header editHeader
|
||||||
@ -742,8 +737,6 @@ type editResults struct {
|
|||||||
notfound int
|
notfound int
|
||||||
edit []*resource.Info
|
edit []*resource.Info
|
||||||
file string
|
file string
|
||||||
|
|
||||||
version schema.GroupVersion
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *editResults) addError(err error, info *resource.Info) string {
|
func (r *editResults) addError(err error, info *resource.Info) string {
|
||||||
|
@ -426,14 +426,14 @@ func (w ConditionalWait) checkCondition(obj *unstructured.Unstructured) (bool, e
|
|||||||
for _, conditionUncast := range conditions {
|
for _, conditionUncast := range conditions {
|
||||||
condition := conditionUncast.(map[string]interface{})
|
condition := conditionUncast.(map[string]interface{})
|
||||||
name, found, err := unstructured.NestedString(condition, "type")
|
name, found, err := unstructured.NestedString(condition, "type")
|
||||||
if !found || err != nil || strings.ToLower(name) != strings.ToLower(w.conditionName) {
|
if !found || err != nil || !strings.EqualFold(name, w.conditionName) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
status, found, err := unstructured.NestedString(condition, "status")
|
status, found, err := unstructured.NestedString(condition, "status")
|
||||||
if !found || err != nil {
|
if !found || err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
return strings.ToLower(status) == strings.ToLower(w.conditionStatus), nil
|
return strings.EqualFold(status, w.conditionStatus), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return false, nil
|
return false, nil
|
||||||
|
@ -3661,12 +3661,6 @@ Events: <none>` + "\n"
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// boolPtr returns a pointer to a bool
|
|
||||||
func boolPtr(b bool) *bool {
|
|
||||||
o := b
|
|
||||||
return &o
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestControllerRef(t *testing.T) {
|
func TestControllerRef(t *testing.T) {
|
||||||
var replicas int32 = 1
|
var replicas int32 = 1
|
||||||
f := fake.NewSimpleClientset(
|
f := fake.NewSimpleClientset(
|
||||||
|
@ -78,7 +78,7 @@ func TestReplicationControllerScaleRetry(t *testing.T) {
|
|||||||
}
|
}
|
||||||
preconditions := ScalePrecondition{3, ""}
|
preconditions := ScalePrecondition{3, ""}
|
||||||
scaleFunc = ScaleCondition(scaler, &preconditions, namespace, name, count, nil, rcgvr)
|
scaleFunc = ScaleCondition(scaler, &preconditions, namespace, name, count, nil, rcgvr)
|
||||||
pass, err = scaleFunc()
|
_, err = scaleFunc()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Errorf("Expected error on precondition failure")
|
t.Errorf("Expected error on precondition failure")
|
||||||
}
|
}
|
||||||
@ -188,7 +188,7 @@ func TestDeploymentScaleRetry(t *testing.T) {
|
|||||||
}
|
}
|
||||||
preconditions := &ScalePrecondition{3, ""}
|
preconditions := &ScalePrecondition{3, ""}
|
||||||
scaleFunc = ScaleCondition(scaler, preconditions, namespace, name, count, nil, deploygvr)
|
scaleFunc = ScaleCondition(scaler, preconditions, namespace, name, count, nil, deploygvr)
|
||||||
pass, err = scaleFunc()
|
_, err = scaleFunc()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Error("Expected error on precondition failure")
|
t.Error("Expected error on precondition failure")
|
||||||
}
|
}
|
||||||
@ -318,7 +318,7 @@ func TestStatefulSetScaleRetry(t *testing.T) {
|
|||||||
}
|
}
|
||||||
preconditions := &ScalePrecondition{3, ""}
|
preconditions := &ScalePrecondition{3, ""}
|
||||||
scaleFunc = ScaleCondition(scaler, preconditions, namespace, name, count, nil, stsgvr)
|
scaleFunc = ScaleCondition(scaler, preconditions, namespace, name, count, nil, stsgvr)
|
||||||
pass, err = scaleFunc()
|
_, err = scaleFunc()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Error("Expected error on precondition failure")
|
t.Error("Expected error on precondition failure")
|
||||||
}
|
}
|
||||||
@ -427,7 +427,7 @@ func TestReplicaSetScaleRetry(t *testing.T) {
|
|||||||
}
|
}
|
||||||
preconditions := &ScalePrecondition{3, ""}
|
preconditions := &ScalePrecondition{3, ""}
|
||||||
scaleFunc = ScaleCondition(scaler, preconditions, namespace, name, count, nil, rsgvr)
|
scaleFunc = ScaleCondition(scaler, preconditions, namespace, name, count, nil, rsgvr)
|
||||||
pass, err = scaleFunc()
|
_, err = scaleFunc()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Error("Expected error on precondition failure")
|
t.Error("Expected error on precondition failure")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user