Merge pull request #87403 from gavinfish/kubectl_pkg
Staticcheck: vendor/k8s.io/kubectl/pkg/scale etc. Kubernetes-commit: de9bbcc9cd6413cf0c5719d746bea52eaa03ff1d
This commit is contained in:
commit
eb1f9fda60
|
@ -181,7 +181,7 @@ func (o TopNodeOptions) RunTopNode() error {
|
|||
|
||||
metricsAPIAvailable := SupportedMetricsAPIVersionAvailable(apiGroups)
|
||||
|
||||
metrics := &metricsapi.NodeMetricsList{}
|
||||
var metrics *metricsapi.NodeMetricsList
|
||||
if metricsAPIAvailable {
|
||||
metrics, err = getNodeMetricsFromMetricsAPI(o.MetricsClient, o.ResourceName, selector)
|
||||
if err != nil {
|
||||
|
|
|
@ -175,7 +175,7 @@ func (o TopPodOptions) RunTopPod() error {
|
|||
|
||||
metricsAPIAvailable := SupportedMetricsAPIVersionAvailable(apiGroups)
|
||||
|
||||
metrics := &metricsapi.PodMetricsList{}
|
||||
var metrics *metricsapi.PodMetricsList
|
||||
if metricsAPIAvailable {
|
||||
metrics, err = getMetricsFromMetricsAPI(o.MetricsClient, o.Namespace, o.ResourceName, o.AllNamespaces, selector)
|
||||
if err != nil {
|
||||
|
|
|
@ -37,7 +37,6 @@ import (
|
|||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/mergepatch"
|
||||
"k8s.io/apimachinery/pkg/util/strategicpatch"
|
||||
|
@ -731,10 +730,6 @@ func (h *editHeader) writeTo(w io.Writer, editMode EditMode) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (h *editHeader) flush() {
|
||||
h.reasons = []editReason{}
|
||||
}
|
||||
|
||||
// editResults capture the result of an update
|
||||
type editResults struct {
|
||||
header editHeader
|
||||
|
@ -742,8 +737,6 @@ type editResults struct {
|
|||
notfound int
|
||||
edit []*resource.Info
|
||||
file string
|
||||
|
||||
version schema.GroupVersion
|
||||
}
|
||||
|
||||
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 {
|
||||
condition := conditionUncast.(map[string]interface{})
|
||||
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
|
||||
}
|
||||
status, found, err := unstructured.NestedString(condition, "status")
|
||||
if !found || err != nil {
|
||||
continue
|
||||
}
|
||||
return strings.ToLower(status) == strings.ToLower(w.conditionStatus), nil
|
||||
return strings.EqualFold(status, w.conditionStatus), 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) {
|
||||
var replicas int32 = 1
|
||||
f := fake.NewSimpleClientset(
|
||||
|
|
|
@ -78,7 +78,7 @@ func TestReplicationControllerScaleRetry(t *testing.T) {
|
|||
}
|
||||
preconditions := ScalePrecondition{3, ""}
|
||||
scaleFunc = ScaleCondition(scaler, &preconditions, namespace, name, count, nil, rcgvr)
|
||||
pass, err = scaleFunc()
|
||||
_, err = scaleFunc()
|
||||
if err == nil {
|
||||
t.Errorf("Expected error on precondition failure")
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ func TestDeploymentScaleRetry(t *testing.T) {
|
|||
}
|
||||
preconditions := &ScalePrecondition{3, ""}
|
||||
scaleFunc = ScaleCondition(scaler, preconditions, namespace, name, count, nil, deploygvr)
|
||||
pass, err = scaleFunc()
|
||||
_, err = scaleFunc()
|
||||
if err == nil {
|
||||
t.Error("Expected error on precondition failure")
|
||||
}
|
||||
|
@ -318,7 +318,7 @@ func TestStatefulSetScaleRetry(t *testing.T) {
|
|||
}
|
||||
preconditions := &ScalePrecondition{3, ""}
|
||||
scaleFunc = ScaleCondition(scaler, preconditions, namespace, name, count, nil, stsgvr)
|
||||
pass, err = scaleFunc()
|
||||
_, err = scaleFunc()
|
||||
if err == nil {
|
||||
t.Error("Expected error on precondition failure")
|
||||
}
|
||||
|
@ -427,7 +427,7 @@ func TestReplicaSetScaleRetry(t *testing.T) {
|
|||
}
|
||||
preconditions := &ScalePrecondition{3, ""}
|
||||
scaleFunc = ScaleCondition(scaler, preconditions, namespace, name, count, nil, rsgvr)
|
||||
pass, err = scaleFunc()
|
||||
_, err = scaleFunc()
|
||||
if err == nil {
|
||||
t.Error("Expected error on precondition failure")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue