mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Merge pull request #56881 from islinwb/remove_unused_code
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Remove unused code in pkg/api/,pkg/apis/ **What this PR does / why we need it**: Remove unused code in pkg/api/,pkg/apis/ **Release note**: ```release-note NONE ```
This commit is contained in:
		@@ -37,6 +37,5 @@ go_test(
 | 
				
			|||||||
    deps = [
 | 
					    deps = [
 | 
				
			||||||
        "//pkg/apis/core:go_default_library",
 | 
					        "//pkg/apis/core:go_default_library",
 | 
				
			||||||
        "//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library",
 | 
					        "//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library",
 | 
				
			||||||
        "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
 | 
					 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,10 +18,8 @@ package resource
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
	"time"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/api/resource"
 | 
						"k8s.io/apimachinery/pkg/api/resource"
 | 
				
			||||||
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
					 | 
				
			||||||
	api "k8s.io/kubernetes/pkg/apis/core"
 | 
						api "k8s.io/kubernetes/pkg/apis/core"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -62,21 +60,3 @@ func TestDefaultResourceHelpers(t *testing.T) {
 | 
				
			|||||||
		t.Errorf("expected %v, actual %v", resource.BinarySI, resourceList.Memory().Format)
 | 
							t.Errorf("expected %v, actual %v", resource.BinarySI, resourceList.Memory().Format)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
func newPod(now metav1.Time, ready bool, beforeSec int) *api.Pod {
 | 
					 | 
				
			||||||
	conditionStatus := api.ConditionFalse
 | 
					 | 
				
			||||||
	if ready {
 | 
					 | 
				
			||||||
		conditionStatus = api.ConditionTrue
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return &api.Pod{
 | 
					 | 
				
			||||||
		Status: api.PodStatus{
 | 
					 | 
				
			||||||
			Conditions: []api.PodCondition{
 | 
					 | 
				
			||||||
				{
 | 
					 | 
				
			||||||
					Type:               api.PodReady,
 | 
					 | 
				
			||||||
					LastTransitionTime: metav1.NewTime(now.Time.Add(-1 * time.Duration(beforeSec) * time.Second)),
 | 
					 | 
				
			||||||
					Status:             conditionStatus,
 | 
					 | 
				
			||||||
				},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -85,7 +85,6 @@ go_test(
 | 
				
			|||||||
        "//pkg/apis/extensions:go_default_library",
 | 
					        "//pkg/apis/extensions:go_default_library",
 | 
				
			||||||
        "//pkg/apis/extensions/v1beta1:go_default_library",
 | 
					        "//pkg/apis/extensions/v1beta1:go_default_library",
 | 
				
			||||||
        "//vendor/github.com/gogo/protobuf/proto:go_default_library",
 | 
					        "//vendor/github.com/gogo/protobuf/proto:go_default_library",
 | 
				
			||||||
        "//vendor/github.com/golang/protobuf/proto:go_default_library",
 | 
					 | 
				
			||||||
        "//vendor/github.com/google/gofuzz:go_default_library",
 | 
					        "//vendor/github.com/google/gofuzz:go_default_library",
 | 
				
			||||||
        "//vendor/github.com/json-iterator/go:go_default_library",
 | 
					        "//vendor/github.com/json-iterator/go:go_default_library",
 | 
				
			||||||
        "//vendor/k8s.io/api/core/v1:go_default_library",
 | 
					        "//vendor/k8s.io/api/core/v1:go_default_library",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,10 +23,8 @@ import (
 | 
				
			|||||||
	"io/ioutil"
 | 
						"io/ioutil"
 | 
				
			||||||
	"math/rand"
 | 
						"math/rand"
 | 
				
			||||||
	"reflect"
 | 
						"reflect"
 | 
				
			||||||
	"strings"
 | 
					 | 
				
			||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/golang/protobuf/proto"
 | 
					 | 
				
			||||||
	jsoniter "github.com/json-iterator/go"
 | 
						jsoniter "github.com/json-iterator/go"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"k8s.io/api/core/v1"
 | 
						"k8s.io/api/core/v1"
 | 
				
			||||||
@@ -66,17 +64,6 @@ func fuzzInternalObject(t *testing.T, forVersion schema.GroupVersion, item runti
 | 
				
			|||||||
	return item
 | 
						return item
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// dataAsString returns the given byte array as a string; handles detecting
 | 
					 | 
				
			||||||
// protocol buffers.
 | 
					 | 
				
			||||||
func dataAsString(data []byte) string {
 | 
					 | 
				
			||||||
	dataString := string(data)
 | 
					 | 
				
			||||||
	if !strings.HasPrefix(dataString, "{") {
 | 
					 | 
				
			||||||
		dataString = "\n" + hex.Dump(data)
 | 
					 | 
				
			||||||
		proto.NewBuffer(make([]byte, 0, 1024)).DebugPrint("decoded object", data)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return dataString
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func Convert_v1beta1_ReplicaSet_to_api_ReplicationController(in *v1beta1.ReplicaSet, out *api.ReplicationController, s conversion.Scope) error {
 | 
					func Convert_v1beta1_ReplicaSet_to_api_ReplicationController(in *v1beta1.ReplicaSet, out *api.ReplicationController, s conversion.Scope) error {
 | 
				
			||||||
	intermediate1 := &extensions.ReplicaSet{}
 | 
						intermediate1 := &extensions.ReplicaSet{}
 | 
				
			||||||
	if err := k8s_v1beta1.Convert_v1beta1_ReplicaSet_To_extensions_ReplicaSet(in, intermediate1, s); err != nil {
 | 
						if err := k8s_v1beta1.Convert_v1beta1_ReplicaSet_To_extensions_ReplicaSet(in, intermediate1, s); err != nil {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -213,15 +213,6 @@ func ValidateOwnerReferences(ownerReferences []metav1.OwnerReference, fldPath *f
 | 
				
			|||||||
// value that were not valid.  Otherwise this returns an empty list or nil.
 | 
					// value that were not valid.  Otherwise this returns an empty list or nil.
 | 
				
			||||||
type ValidateNameFunc apimachineryvalidation.ValidateNameFunc
 | 
					type ValidateNameFunc apimachineryvalidation.ValidateNameFunc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// maskTrailingDash replaces the final character of a string with a subdomain safe
 | 
					 | 
				
			||||||
// value if is a dash.
 | 
					 | 
				
			||||||
func maskTrailingDash(name string) string {
 | 
					 | 
				
			||||||
	if strings.HasSuffix(name, "-") {
 | 
					 | 
				
			||||||
		return name[:len(name)-2] + "a"
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return name
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// ValidatePodName can be used to check whether the given pod name is valid.
 | 
					// ValidatePodName can be used to check whether the given pod name is valid.
 | 
				
			||||||
// Prefix indicates this name will be used as part of generation, in which case
 | 
					// Prefix indicates this name will be used as part of generation, in which case
 | 
				
			||||||
// trailing dashes are allowed.
 | 
					// trailing dashes are allowed.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1232,11 +1232,6 @@ func TestValidateDeployment(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func int64p(i int) *int64 {
 | 
					 | 
				
			||||||
	i64 := int64(i)
 | 
					 | 
				
			||||||
	return &i64
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func TestValidateDeploymentStatus(t *testing.T) {
 | 
					func TestValidateDeploymentStatus(t *testing.T) {
 | 
				
			||||||
	collisionCount := int32(-3)
 | 
						collisionCount := int32(-3)
 | 
				
			||||||
	tests := []struct {
 | 
						tests := []struct {
 | 
				
			||||||
@@ -1473,8 +1468,6 @@ func TestValidateDeploymentRollback(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type ingressRules map[string]string
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func TestValidateIngress(t *testing.T) {
 | 
					func TestValidateIngress(t *testing.T) {
 | 
				
			||||||
	defaultBackend := extensions.IngressBackend{
 | 
						defaultBackend := extensions.IngressBackend{
 | 
				
			||||||
		ServiceName: "default-backend",
 | 
							ServiceName: "default-backend",
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user