diff --git a/cmd/kubeadm/app/preflight/checks.go b/cmd/kubeadm/app/preflight/checks.go index f737e6e6851..93c223f667a 100644 --- a/cmd/kubeadm/app/preflight/checks.go +++ b/cmd/kubeadm/app/preflight/checks.go @@ -1088,10 +1088,6 @@ func RunPullImagesCheck(execer utilsexec.Interface, cfg *kubeadmapi.InitConfigur // RunChecks runs each check, displays it's warnings/errors, and once all // are processed will exit if any errors occurred. func RunChecks(checks []Checker, ww io.Writer, ignorePreflightErrors sets.String) error { - type checkErrors struct { - Name string - Errors []error - } var errsBuffer bytes.Buffer for _, c := range checks { diff --git a/pkg/api/v1/persistentvolume/util_test.go b/pkg/api/v1/persistentvolume/util_test.go index 5a60dd1ce52..0ed1a06bfef 100644 --- a/pkg/api/v1/persistentvolume/util_test.go +++ b/pkg/api/v1/persistentvolume/util_test.go @@ -268,9 +268,3 @@ func collectSecretPaths(t *testing.T, path *field.Path, name string, tp reflect. return secretPaths } - -func newHostPathType(pathType string) *corev1.HostPathType { - hostPathType := new(corev1.HostPathType) - *hostPathType = corev1.HostPathType(pathType) - return hostPathType -} diff --git a/pkg/apis/batch/validation/validation_test.go b/pkg/apis/batch/validation/validation_test.go index 5300193233e..9ca5493e1d9 100644 --- a/pkg/apis/batch/validation/validation_test.go +++ b/pkg/apis/batch/validation/validation_test.go @@ -17,7 +17,6 @@ limitations under the License. package validation import ( - "fmt" "strings" "testing" @@ -68,12 +67,6 @@ func getValidPodTemplateSpecForGenerated(selector *metav1.LabelSelector) api.Pod } } -func featureToggle(feature utilfeature.Feature) []string { - enabled := fmt.Sprintf("%s=%t", feature, true) - disabled := fmt.Sprintf("%s=%t", feature, false) - return []string{enabled, disabled} -} - func TestValidateJob(t *testing.T) { validManualSelector := getValidManualSelector() validPodTemplateSpecForManual := getValidPodTemplateSpecForManual(validManualSelector) diff --git a/pkg/apis/policy/v1beta1/defaults.go b/pkg/apis/policy/v1beta1/defaults.go index 47a3d1f9a58..6403387d6d6 100644 --- a/pkg/apis/policy/v1beta1/defaults.go +++ b/pkg/apis/policy/v1beta1/defaults.go @@ -18,13 +18,8 @@ package v1beta1 import ( policyv1beta1 "k8s.io/api/policy/v1beta1" - "k8s.io/apimachinery/pkg/runtime" ) -func addDefaultingFuncs(scheme *runtime.Scheme) error { - return RegisterDefaults(scheme) -} - func SetDefaults_PodSecurityPolicySpec(obj *policyv1beta1.PodSecurityPolicySpec) { // This field was added after PodSecurityPolicy was released. // Policies that do not include this field must remain as permissive as they were prior to the introduction of this field. diff --git a/pkg/cloudprovider/providers/azure/azure_standard.go b/pkg/cloudprovider/providers/azure/azure_standard.go index c2b22e1e6df..abd38b27d8b 100644 --- a/pkg/cloudprovider/providers/azure/azure_standard.go +++ b/pkg/cloudprovider/providers/azure/azure_standard.go @@ -568,16 +568,6 @@ func extractResourceGroupByNicID(nicID string) (string, error) { return matches[1], nil } -// extractResourceGroupByPipID extracts the resource group name by publicIP ID. -func extractResourceGroupByPipID(pipID string) (string, error) { - matches := publicIPResourceGroupRE.FindStringSubmatch(pipID) - if len(matches) != 2 { - return "", fmt.Errorf("error of extracting resourceGroup from pipID %q", pipID) - } - - return matches[1], nil -} - // getPrimaryInterfaceWithVMSet gets machine primary network interface by node name and vmSet. func (as *availabilitySet) getPrimaryInterfaceWithVMSet(nodeName, vmSetName string) (network.Interface, error) { var machine compute.VirtualMachine diff --git a/pkg/cloudprovider/providers/gce/gce.go b/pkg/cloudprovider/providers/gce/gce.go index 6b36bd45613..0a22a6a59b6 100644 --- a/pkg/cloudprovider/providers/gce/gce.go +++ b/pkg/cloudprovider/providers/gce/gce.go @@ -81,11 +81,6 @@ const ( gceComputeAPIEndpointBeta = "https://www.googleapis.com/compute/beta/" ) -// gceObject is an abstraction of all GCE API object in go client -type gceObject interface { - MarshalJSON() ([]byte, error) -} - var _ cloudprovider.Interface = (*Cloud)(nil) var _ cloudprovider.Instances = (*Cloud)(nil) var _ cloudprovider.LoadBalancer = (*Cloud)(nil) diff --git a/pkg/cloudprovider/providers/gce/gce_util.go b/pkg/cloudprovider/providers/gce/gce_util.go index 328b9204f56..3b1d5353a4f 100644 --- a/pkg/cloudprovider/providers/gce/gce_util.go +++ b/pkg/cloudprovider/providers/gce/gce_util.go @@ -244,10 +244,6 @@ func makeGoogleAPINotFoundError(message string) error { return &googleapi.Error{Code: http.StatusNotFound, Message: message} } -func makeGoogleAPIError(code int, message string) error { - return &googleapi.Error{Code: code, Message: message} -} - // TODO(#51665): Remove this once Network Tiers becomes Beta in GCP. func handleAlphaNetworkTierGetError(err error) (string, error) { if isForbidden(err) { diff --git a/pkg/cloudprovider/providers/openstack/openstack_loadbalancer.go b/pkg/cloudprovider/providers/openstack/openstack_loadbalancer.go index 0c76e695496..b3185626521 100644 --- a/pkg/cloudprovider/providers/openstack/openstack_loadbalancer.go +++ b/pkg/cloudprovider/providers/openstack/openstack_loadbalancer.go @@ -85,8 +85,6 @@ type LbaasV2 struct { LoadBalancer } -type empty struct{} - func networkExtensions(client *gophercloud.ServiceClient) (map[string]bool, error) { seen := make(map[string]bool) diff --git a/pkg/controller/podautoscaler/metrics/legacy_metrics_client_test.go b/pkg/controller/podautoscaler/metrics/legacy_metrics_client_test.go index 1d7a78e066d..d9901fae8d9 100644 --- a/pkg/controller/podautoscaler/metrics/legacy_metrics_client_test.go +++ b/pkg/controller/podautoscaler/metrics/legacy_metrics_client_test.go @@ -389,22 +389,6 @@ func TestCPUEmptyMetricsForOnePod(t *testing.T) { tc.runTest(t) } -func testCollapseTimeSamples(t *testing.T) { - now := time.Now() - metrics := heapster.MetricResult{ - Metrics: []heapster.MetricPoint{ - {Timestamp: now, Value: 50, FloatValue: nil}, - {Timestamp: now.Add(-15 * time.Second), Value: 100, FloatValue: nil}, - {Timestamp: now.Add(-60 * time.Second), Value: 100000, FloatValue: nil}}, - LatestTimestamp: now, - } - - val, timestamp, hadMetrics := collapseTimeSamples(metrics, time.Minute) - assert.True(t, hadMetrics, "should report that it received a populated list of metrics") - assert.InEpsilon(t, float64(75), val, 0.1, "collapsed sample value should be as expected") - assert.True(t, timestamp.Equal(now), "timestamp should be the current time (the newest)") -} - func offsetTimestampBy(t int) time.Time { return fixedTimestamp.Add(time.Duration(t) * time.Minute) } diff --git a/pkg/controller/serviceaccount/tokens_controller.go b/pkg/controller/serviceaccount/tokens_controller.go index f93cd5822f5..7b97036e836 100644 --- a/pkg/controller/serviceaccount/tokens_controller.go +++ b/pkg/controller/serviceaccount/tokens_controller.go @@ -702,16 +702,6 @@ func (e *TokensController) listTokenSecrets(serviceAccount *v1.ServiceAccount) ( return items, nil } -// serviceAccountNameAndUID is a helper method to get the ServiceAccount Name and UID from the given secret -// Returns "","" if the secret is not a ServiceAccountToken secret -// If the name or uid annotation is missing, "" is returned instead -func serviceAccountNameAndUID(secret *v1.Secret) (string, string) { - if secret.Type != v1.SecretTypeServiceAccountToken { - return "", "" - } - return secret.Annotations[v1.ServiceAccountNameKey], secret.Annotations[v1.ServiceAccountUIDKey] -} - func getSecretReferences(serviceAccount *v1.ServiceAccount) sets.String { references := sets.NewString() for _, secret := range serviceAccount.Secrets { diff --git a/pkg/controller/volume/persistentvolume/pv_controller_test.go b/pkg/controller/volume/persistentvolume/pv_controller_test.go index 37b223abf3f..c4461ded228 100644 --- a/pkg/controller/volume/persistentvolume/pv_controller_test.go +++ b/pkg/controller/volume/persistentvolume/pv_controller_test.go @@ -234,14 +234,6 @@ func TestControllerCacheParsingError(t *testing.T) { } } -func addVolumeAnnotation(volume *v1.PersistentVolume, annName, annValue string) *v1.PersistentVolume { - if volume.Annotations == nil { - volume.Annotations = make(map[string]string) - } - volume.Annotations[annName] = annValue - return volume -} - func makePVCClass(scName *string, hasSelectNodeAnno bool) *v1.PersistentVolumeClaim { claim := &v1.PersistentVolumeClaim{ ObjectMeta: metav1.ObjectMeta{ diff --git a/pkg/credentialprovider/azure/azure_acr_helper.go b/pkg/credentialprovider/azure/azure_acr_helper.go index 1c6e0e94e6c..be18de4cec1 100644 --- a/pkg/credentialprovider/azure/azure_acr_helper.go +++ b/pkg/credentialprovider/azure/azure_acr_helper.go @@ -63,16 +63,6 @@ type authDirective struct { realm string } -type accessTokenPayload struct { - TenantID string `json:"tid"` -} - -type acrTokenPayload struct { - Expiration int64 `json:"exp"` - TenantID string `json:"tenant"` - Credential string `json:"credential"` -} - type acrAuthResponse struct { RefreshToken string `json:"refresh_token"` } diff --git a/pkg/kubectl/apply/element.go b/pkg/kubectl/apply/element.go index 6fc8b8055b7..bc9cf8a5070 100644 --- a/pkg/kubectl/apply/element.go +++ b/pkg/kubectl/apply/element.go @@ -151,8 +151,6 @@ func (mk MergeKeys) GetMergeKeyValue(i interface{}) (MergeKeyValue, error) { return result, nil } -type source int - // CombinedPrimitiveSlice implements a slice of primitives type CombinedPrimitiveSlice struct { Items []*PrimitiveListItem diff --git a/pkg/kubectl/cmd/set/BUILD b/pkg/kubectl/cmd/set/BUILD index 6f6d9d3c3c4..039c3c54431 100644 --- a/pkg/kubectl/cmd/set/BUILD +++ b/pkg/kubectl/cmd/set/BUILD @@ -28,7 +28,6 @@ go_library( "//pkg/kubectl/util/templates:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", "//staging/src/k8s.io/api/rbac/v1:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/api/meta:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", diff --git a/pkg/kubectl/cmd/set/helper.go b/pkg/kubectl/cmd/set/helper.go index b2e578f607b..72cc7756056 100644 --- a/pkg/kubectl/cmd/set/helper.go +++ b/pkg/kubectl/cmd/set/helper.go @@ -17,17 +17,13 @@ limitations under the License. package set import ( - "fmt" - "io" "strings" "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/strategicpatch" "k8s.io/cli-runtime/pkg/resource" - cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" ) // selectContainers allows one or more containers to be matched against a string or wildcard @@ -44,33 +40,6 @@ func selectContainers(containers []v1.Container, spec string) ([]*v1.Container, return out, skipped } -// handlePodUpdateError prints a more useful error to the end user when mutating a pod. -func handlePodUpdateError(out io.Writer, err error, resource string) { - if statusError, ok := err.(*errors.StatusError); ok && errors.IsInvalid(err) { - errorDetails := statusError.Status().Details - if errorDetails.Kind == "Pod" { - all, match := true, false - for _, cause := range errorDetails.Causes { - if cause.Field == "spec" && strings.Contains(cause.Message, "may not update fields other than") { - fmt.Fprintf(out, "error: may not update %s in pod %q directly\n", resource, errorDetails.Name) - match = true - } else { - all = false - } - } - if all && match { - return - } - } else { - if ok := cmdutil.PrintErrorWithCauses(err, out); ok { - return - } - } - } - - fmt.Fprintf(out, "error: %v\n", err) -} - // selectString returns true if the provided string matches spec, where spec is a string with // a non-greedy '*' wildcard operator. // TODO: turn into a regex and handle greedy matches and backtracking. diff --git a/pkg/kubectl/cmd/testing/fake.go b/pkg/kubectl/cmd/testing/fake.go index 9e5d8d5a9dd..2d3e18c5cf9 100644 --- a/pkg/kubectl/cmd/testing/fake.go +++ b/pkg/kubectl/cmd/testing/fake.go @@ -212,13 +212,6 @@ func NewInternalNamespacedType(kind, apiversion, name, namespace string) *Intern var errInvalidVersion = errors.New("not a version") -func versionErrIfFalse(b bool) error { - if b { - return nil - } - return errInvalidVersion -} - // ValidVersion of API var ValidVersion = "v1" diff --git a/pkg/kubectl/describe/versioned/describe.go b/pkg/kubectl/describe/versioned/describe.go index b75051c0e23..bdedb868514 100644 --- a/pkg/kubectl/describe/versioned/describe.go +++ b/pkg/kubectl/describe/versioned/describe.go @@ -4393,16 +4393,6 @@ func shorten(s string, maxLength int) string { return s } -// translateTimestampUntil returns the elapsed time until timestamp in -// human-readable approximation. -func translateTimestampUntil(timestamp metav1.Time) string { - if timestamp.IsZero() { - return "" - } - - return duration.HumanDuration(time.Until(timestamp.Time)) -} - // translateTimestampSince returns the elapsed time since timestamp in // human-readable approximation. func translateTimestampSince(timestamp metav1.Time) string { diff --git a/pkg/kubectl/util/deployment/deployment.go b/pkg/kubectl/util/deployment/deployment.go index 72f99f7f2ee..49fd4ec9fdb 100644 --- a/pkg/kubectl/util/deployment/deployment.go +++ b/pkg/kubectl/util/deployment/deployment.go @@ -109,7 +109,6 @@ func rsListFromClient(c appsclient.AppsV1Interface) rsListFunc { // TODO: switch this to full namespacers type rsListFunc func(string, metav1.ListOptions) ([]*appsv1.ReplicaSet, error) -type podListFunc func(string, metav1.ListOptions) (*corev1.PodList, error) // listReplicaSets returns a slice of RSes the given deployment targets. // Note that this does NOT attempt to reconcile ControllerRef (adopt/orphan), diff --git a/pkg/kubelet/dockershim/helpers_test.go b/pkg/kubelet/dockershim/helpers_test.go index 445191c53a4..fe36073a59b 100644 --- a/pkg/kubelet/dockershim/helpers_test.go +++ b/pkg/kubelet/dockershim/helpers_test.go @@ -18,9 +18,6 @@ package dockershim import ( "fmt" - "io/ioutil" - "os" - "path/filepath" "testing" dockertypes "github.com/docker/docker/api/types" @@ -128,20 +125,6 @@ func TestParsingCreationConflictError(t *testing.T) { require.Equal(t, matches[1], "24666ab8c814d16f986449e504ea0159468ddf8da01897144a770f66dce0e14e") } -// writeDockerConfig will write a config file into a temporary dir, and return that dir. -// Caller is responsible for deleting the dir and its contents. -func writeDockerConfig(cfg string) (string, error) { - tmpdir, err := ioutil.TempDir("", "dockershim=helpers_test.go=") - if err != nil { - return "", err - } - dir := filepath.Join(tmpdir, ".docker") - if err := os.Mkdir(dir, 0755); err != nil { - return "", err - } - return tmpdir, ioutil.WriteFile(filepath.Join(dir, "config.json"), []byte(cfg), 0644) -} - func TestEnsureSandboxImageExists(t *testing.T) { sandboxImage := "gcr.io/test/image" authConfig := dockertypes.AuthConfig{Username: "user", Password: "pass"} diff --git a/pkg/kubelet/eviction/helpers.go b/pkg/kubelet/eviction/helpers.go index e7c2ddcb19a..74229b75905 100644 --- a/pkg/kubelet/eviction/helpers.go +++ b/pkg/kubelet/eviction/helpers.go @@ -434,14 +434,6 @@ func formatThreshold(threshold evictionapi.Threshold) string { return fmt.Sprintf("threshold(signal=%v, operator=%v, value=%v, gracePeriod=%v)", threshold.Signal, threshold.Operator, evictionapi.ThresholdValue(threshold.Value), threshold.GracePeriod) } -// formatevictionapi.ThresholdValue formats a thresholdValue for logging. -func formatThresholdValue(value evictionapi.ThresholdValue) string { - if value.Quantity != nil { - return value.Quantity.String() - } - return fmt.Sprintf("%f%%", value.Percentage*float32(100)) -} - // cachedStatsFunc returns a statsFunc based on the provided pod stats. func cachedStatsFunc(podStats []statsapi.PodStats) statsFunc { uid2PodStats := map[string]statsapi.PodStats{} diff --git a/pkg/kubelet/kubelet_node_status_test.go b/pkg/kubelet/kubelet_node_status_test.go index 044faa3b68d..090dd7027f4 100644 --- a/pkg/kubelet/kubelet_node_status_test.go +++ b/pkg/kubelet/kubelet_node_status_test.go @@ -167,10 +167,6 @@ func (s sortableNodeAddress) Less(i, j int) bool { } func (s sortableNodeAddress) Swap(i, j int) { s[j], s[i] = s[i], s[j] } -func sortNodeAddresses(addrs sortableNodeAddress) { - sort.Sort(addrs) -} - func TestUpdateNewNodeStatus(t *testing.T) { cases := []struct { desc string diff --git a/pkg/kubelet/kubelet_pods_test.go b/pkg/kubelet/kubelet_pods_test.go index 4cd3d631079..f67b075c951 100644 --- a/pkg/kubelet/kubelet_pods_test.go +++ b/pkg/kubelet/kubelet_pods_test.go @@ -2018,20 +2018,6 @@ func TestPodPhaseWithRestartOnFailure(t *testing.T) { } } -type fakeReadWriteCloser struct{} - -func (f *fakeReadWriteCloser) Write(data []byte) (int, error) { - return 0, nil -} - -func (f *fakeReadWriteCloser) Read(data []byte) (int, error) { - return 0, nil -} - -func (f *fakeReadWriteCloser) Close() error { - return nil -} - func TestGetExec(t *testing.T) { const ( podName = "podFoo" diff --git a/pkg/kubelet/kubelet_test.go b/pkg/kubelet/kubelet_test.go index f8fc05397de..c44e9b8038c 100644 --- a/pkg/kubelet/kubelet_test.go +++ b/pkg/kubelet/kubelet_test.go @@ -136,22 +136,6 @@ func newTestKubelet(t *testing.T, controllerAttachDetachEnabled bool) *TestKubel return newTestKubeletWithImageList(t, imageList, controllerAttachDetachEnabled, true /*initFakeVolumePlugin*/) } -func newTestKubeletWithoutFakeVolumePlugin(t *testing.T, controllerAttachDetachEnabled bool) *TestKubelet { - imageList := []kubecontainer.Image{ - { - ID: "abc", - RepoTags: []string{"k8s.gcr.io:v1", "k8s.gcr.io:v2"}, - Size: 123, - }, - { - ID: "efg", - RepoTags: []string{"k8s.gcr.io:v3", "k8s.gcr.io:v4"}, - Size: 456, - }, - } - return newTestKubeletWithImageList(t, imageList, controllerAttachDetachEnabled, false /*initFakeVolumePlugin*/) -} - func newTestKubeletWithImageList( t *testing.T, imageList []kubecontainer.Image, diff --git a/pkg/kubelet/pod_workers_test.go b/pkg/kubelet/pod_workers_test.go index ff13baa99ca..2dc7cd644fa 100644 --- a/pkg/kubelet/pod_workers_test.go +++ b/pkg/kubelet/pod_workers_test.go @@ -257,19 +257,6 @@ func (kl *simpleFakeKubelet) syncPodWithWaitGroup(options syncPodOptions) error return nil } -// byContainerName sort the containers in a running pod by their names. -type byContainerName kubecontainer.Pod - -func (b byContainerName) Len() int { return len(b.Containers) } - -func (b byContainerName) Swap(i, j int) { - b.Containers[i], b.Containers[j] = b.Containers[j], b.Containers[i] -} - -func (b byContainerName) Less(i, j int) bool { - return b.Containers[i].Name < b.Containers[j].Name -} - // TestFakePodWorkers verifies that the fakePodWorkers behaves the same way as the real podWorkers // for their invocation of the syncPodFn. func TestFakePodWorkers(t *testing.T) { diff --git a/pkg/kubelet/status/status_manager_test.go b/pkg/kubelet/status/status_manager_test.go index 03f79b2a1bb..c3068763fe7 100644 --- a/pkg/kubelet/status/status_manager_test.go +++ b/pkg/kubelet/status/status_manager_test.go @@ -883,10 +883,6 @@ func getAction() core.GetAction { return core.GetActionImpl{ActionImpl: core.ActionImpl{Verb: "get", Resource: schema.GroupVersionResource{Resource: "pods"}}} } -func updateAction() core.UpdateAction { - return core.UpdateActionImpl{ActionImpl: core.ActionImpl{Verb: "update", Resource: schema.GroupVersionResource{Resource: "pods"}, Subresource: "status"}} -} - func patchAction() core.PatchAction { return core.PatchActionImpl{ActionImpl: core.ActionImpl{Verb: "patch", Resource: schema.GroupVersionResource{Resource: "pods"}, Subresource: "status"}} } diff --git a/pkg/master/BUILD b/pkg/master/BUILD index 0bec722bf3f..c46d692a45b 100644 --- a/pkg/master/BUILD +++ b/pkg/master/BUILD @@ -142,7 +142,6 @@ go_test( "//pkg/api/legacyscheme:go_default_library", "//pkg/api/testapi:go_default_library", "//pkg/apis/batch:go_default_library", - "//pkg/apis/core:go_default_library", "//pkg/apis/storage:go_default_library", "//pkg/generated/openapi:go_default_library", "//pkg/kubelet/client:go_default_library", diff --git a/pkg/master/master_test.go b/pkg/master/master_test.go index 90239fa0e0b..736b0591c3e 100644 --- a/pkg/master/master_test.go +++ b/pkg/master/master_test.go @@ -52,7 +52,6 @@ import ( "k8s.io/kubernetes/pkg/api/legacyscheme" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/apis/batch" - api "k8s.io/kubernetes/pkg/apis/core" apisstorage "k8s.io/kubernetes/pkg/apis/storage" kubeletclient "k8s.io/kubernetes/pkg/kubelet/client" "k8s.io/kubernetes/pkg/master/reconcilers" @@ -233,12 +232,6 @@ func TestVersion(t *testing.T) { } } -type fakeEndpointReconciler struct{} - -func (*fakeEndpointReconciler) ReconcileEndpoints(serviceName string, ip net.IP, endpointPorts []api.EndpointPort, reconcilePorts bool) error { - return nil -} - func makeNodeList(nodes []string, nodeResources apiv1.NodeResources) *apiv1.NodeList { list := apiv1.NodeList{ Items: make([]apiv1.Node, len(nodes)), diff --git a/pkg/printers/internalversion/printers.go b/pkg/printers/internalversion/printers.go index 637ba4420a1..c67d028ba45 100644 --- a/pkg/printers/internalversion/printers.go +++ b/pkg/printers/internalversion/printers.go @@ -1010,14 +1010,6 @@ func printServiceList(list *api.ServiceList, options printers.PrintOptions) ([]m return rows, nil } -// backendStringer behaves just like a string interface and converts the given backend to a string. -func backendStringer(backend *networking.IngressBackend) string { - if backend == nil { - return "" - } - return fmt.Sprintf("%v:%v", backend.ServiceName, backend.ServicePort.String()) -} - func formatHosts(rules []networking.IngressRule) string { list := []string{} max := 3 diff --git a/pkg/proxy/iptables/proxier_test.go b/pkg/proxy/iptables/proxier_test.go index fa49fdbb916..c096753d0d9 100644 --- a/pkg/proxy/iptables/proxier_test.go +++ b/pkg/proxy/iptables/proxier_test.go @@ -327,15 +327,6 @@ func TestDeleteEndpointConnections(t *testing.T) { } } -type fakeClosable struct { - closed bool -} - -func (c *fakeClosable) Close() error { - c.closed = true - return nil -} - // fakePortOpener implements portOpener. type fakePortOpener struct { openPorts []*utilproxy.LocalPort diff --git a/pkg/registry/core/componentstatus/validator.go b/pkg/registry/core/componentstatus/validator.go index ebfad4bf020..2c237ade28a 100644 --- a/pkg/registry/core/componentstatus/validator.go +++ b/pkg/registry/core/componentstatus/validator.go @@ -18,7 +18,6 @@ package componentstatus import ( "crypto/tls" - "net/http" "sync" "time" @@ -31,11 +30,6 @@ const ( probeTimeOut = 20 * time.Second ) -// TODO: this basic interface is duplicated in N places. consolidate? -type httpGet interface { - Get(url string) (*http.Response, error) -} - type ValidatorFn func([]byte) error type Server struct { diff --git a/pkg/scheduler/internal/queue/BUILD b/pkg/scheduler/internal/queue/BUILD index 23ec5520400..a0729869868 100644 --- a/pkg/scheduler/internal/queue/BUILD +++ b/pkg/scheduler/internal/queue/BUILD @@ -9,7 +9,6 @@ go_library( importpath = "k8s.io/kubernetes/pkg/scheduler/internal/queue", visibility = ["//pkg/scheduler:__subpackages__"], deps = [ - "//pkg/api/v1/pod:go_default_library", "//pkg/scheduler/algorithm/predicates:go_default_library", "//pkg/scheduler/algorithm/priorities/util:go_default_library", "//pkg/scheduler/metrics:go_default_library", diff --git a/pkg/scheduler/internal/queue/scheduling_queue.go b/pkg/scheduler/internal/queue/scheduling_queue.go index 43b06c8257f..6bc9bf74bd5 100644 --- a/pkg/scheduler/internal/queue/scheduling_queue.go +++ b/pkg/scheduler/internal/queue/scheduling_queue.go @@ -39,7 +39,6 @@ import ( ktypes "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/tools/cache" - podutil "k8s.io/kubernetes/pkg/api/v1/pod" "k8s.io/kubernetes/pkg/scheduler/algorithm/predicates" priorityutil "k8s.io/kubernetes/pkg/scheduler/algorithm/priorities/util" "k8s.io/kubernetes/pkg/scheduler/metrics" @@ -353,11 +352,6 @@ func (p *PriorityQueue) AddIfNotPresent(pod *v1.Pod) error { return err } -func isPodUnschedulable(pod *v1.Pod) bool { - _, cond := podutil.GetPodCondition(&pod.Status, v1.PodScheduled) - return cond != nil && cond.Status == v1.ConditionFalse && cond.Reason == v1.PodReasonUnschedulable -} - // nsNameForPod returns a namespacedname for a pod func nsNameForPod(pod *v1.Pod) ktypes.NamespacedName { return ktypes.NamespacedName{ diff --git a/pkg/util/mount/mount_helper_test.go b/pkg/util/mount/mount_helper_test.go index 3afcca37986..18a3e16c7ea 100644 --- a/pkg/util/mount/mount_helper_test.go +++ b/pkg/util/mount/mount_helper_test.go @@ -113,18 +113,6 @@ func TestDoCleanupMountPoint(t *testing.T) { } } -func validateDirEmpty(dir string) error { - files, err := ioutil.ReadDir(dir) - if err != nil { - return err - } - - if len(files) != 0 { - return fmt.Errorf("Directory %q is not empty", dir) - } - return nil -} - func validateDirExists(dir string) error { _, err := ioutil.ReadDir(dir) if err != nil { @@ -143,10 +131,3 @@ func validateDirNotExists(dir string) error { } return fmt.Errorf("dir %q still exists", dir) } - -func validateFileExists(file string) error { - if _, err := os.Stat(file); err != nil { - return err - } - return nil -} diff --git a/pkg/volume/awsebs/attacher_test.go b/pkg/volume/awsebs/attacher_test.go index df92328f03e..0124295c4b5 100644 --- a/pkg/volume/awsebs/attacher_test.go +++ b/pkg/volume/awsebs/attacher_test.go @@ -205,13 +205,6 @@ type detachCall struct { ret error } -type diskIsAttachedCall struct { - diskName aws.KubernetesVolumeID - nodeName types.NodeName - isAttached bool - ret error -} - func (testcase *testcase) AttachDisk(diskName aws.KubernetesVolumeID, nodeName types.NodeName) (string, error) { expected := &testcase.attach diff --git a/pkg/volume/awsebs/aws_ebs.go b/pkg/volume/awsebs/aws_ebs.go index 274ac79f2b1..2f6e285e84b 100644 --- a/pkg/volume/awsebs/aws_ebs.go +++ b/pkg/volume/awsebs/aws_ebs.go @@ -454,27 +454,6 @@ func makeGlobalPDPath(host volume.VolumeHost, volumeID aws.KubernetesVolumeID) s return filepath.Join(host.GetPluginDir(awsElasticBlockStorePluginName), mount.MountsInGlobalPDPath, name) } -// Reverses the mapping done in makeGlobalPDPath -func getVolumeIDFromGlobalMount(host volume.VolumeHost, globalPath string) (string, error) { - basePath := filepath.Join(host.GetPluginDir(awsElasticBlockStorePluginName), mount.MountsInGlobalPDPath) - rel, err := filepath.Rel(basePath, globalPath) - if err != nil { - klog.Errorf("Failed to get volume id from global mount %s - %v", globalPath, err) - return "", err - } - if strings.Contains(rel, "../") { - klog.Errorf("Unexpected mount path: %s", globalPath) - return "", fmt.Errorf("unexpected mount path: " + globalPath) - } - // Reverse the :// replacement done in makeGlobalPDPath - volumeID := rel - if strings.HasPrefix(volumeID, "aws/") { - volumeID = strings.Replace(volumeID, "aws/", "aws://", 1) - } - klog.V(2).Info("Mapping mount dir ", globalPath, " to volumeID ", volumeID) - return volumeID, nil -} - func (ebs *awsElasticBlockStore) GetPath() string { return getPath(ebs.podUID, ebs.volName, ebs.plugin.host) } diff --git a/pkg/volume/awsebs/aws_util.go b/pkg/volume/awsebs/aws_util.go index 67fe8d9cb47..43aadb8e0c3 100644 --- a/pkg/volume/awsebs/aws_util.go +++ b/pkg/volume/awsebs/aws_util.go @@ -201,20 +201,6 @@ func verifyDevicePath(devicePaths []string) (string, error) { return "", nil } -// Returns the first path that exists, or empty string if none exist. -func verifyAllPathsRemoved(devicePaths []string) (bool, error) { - allPathsRemoved := true - for _, path := range devicePaths { - exists, err := mount.PathExists(path) - if err != nil { - return false, fmt.Errorf("Error checking if path exists: %v", err) - } - allPathsRemoved = allPathsRemoved && !exists - } - - return allPathsRemoved, nil -} - // Returns list of all paths for given EBS mount // This is more interesting on GCE (where we are able to identify volumes under /dev/disk-by-id) // Here it is mostly about applying the partition path diff --git a/pkg/volume/csi/csi_plugin.go b/pkg/volume/csi/csi_plugin.go index 68b50eccd3b..e7bf8f359ea 100644 --- a/pkg/volume/csi/csi_plugin.go +++ b/pkg/volume/csi/csi_plugin.go @@ -894,12 +894,3 @@ func isV0Version(version string) bool { return parsedVersion.Major() == 0 } - -func isV1Version(version string) bool { - parsedVersion, err := utilversion.ParseGeneric(version) - if err != nil { - return false - } - - return parsedVersion.Major() == 1 -} diff --git a/pkg/volume/flexvolume/common_test.go b/pkg/volume/flexvolume/common_test.go index 45cbf267542..a7ed35b64df 100644 --- a/pkg/volume/flexvolume/common_test.go +++ b/pkg/volume/flexvolume/common_test.go @@ -20,7 +20,6 @@ import ( "encoding/json" "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/kubernetes/pkg/volume" volumetesting "k8s.io/kubernetes/pkg/volume/testing" "k8s.io/kubernetes/test/utils/harness" @@ -108,23 +107,6 @@ func fakeVolumeSpec() *volume.Spec { return volume.NewSpecFromVolume(vol) } -func fakePersistentVolumeSpec() *volume.Spec { - vol := &v1.PersistentVolume{ - ObjectMeta: metav1.ObjectMeta{ - Name: "vol1", - }, - Spec: v1.PersistentVolumeSpec{ - PersistentVolumeSource: v1.PersistentVolumeSource{ - FlexVolume: &v1.FlexPersistentVolumeSource{ - Driver: "kubernetes.io/fakeAttacher", - ReadOnly: false, - }, - }, - }, - } - return volume.NewSpecFromPersistentVolume(vol, false) -} - func specJSON(plugin *flexVolumeAttachablePlugin, spec *volume.Spec, extraOptions map[string]string) string { o, err := NewOptionsForDriver(spec, plugin.host, extraOptions) if err != nil { diff --git a/pkg/volume/flocker/flocker_test.go b/pkg/volume/flocker/flocker_test.go index fee6f06983e..a770844095a 100644 --- a/pkg/volume/flocker/flocker_test.go +++ b/pkg/volume/flocker/flocker_test.go @@ -302,62 +302,3 @@ func TestIsReadOnly(t *testing.T) { b := &flockerVolumeMounter{readOnly: true} assert.True(t, b.GetAttributes().ReadOnly) } - -type mockFlockerClient struct { - datasetID, primaryUUID, path string - datasetState *flockerapi.DatasetState -} - -func newMockFlockerClient(mockDatasetID, mockPrimaryUUID, mockPath string) *mockFlockerClient { - return &mockFlockerClient{ - datasetID: mockDatasetID, - primaryUUID: mockPrimaryUUID, - path: mockPath, - datasetState: &flockerapi.DatasetState{ - Path: mockPath, - DatasetID: mockDatasetID, - Primary: mockPrimaryUUID, - }, - } -} - -func (m mockFlockerClient) CreateDataset(metaName string) (*flockerapi.DatasetState, error) { - return m.datasetState, nil -} -func (m mockFlockerClient) GetDatasetState(datasetID string) (*flockerapi.DatasetState, error) { - return m.datasetState, nil -} -func (m mockFlockerClient) GetDatasetID(metaName string) (string, error) { - return m.datasetID, nil -} -func (m mockFlockerClient) GetPrimaryUUID() (string, error) { - return m.primaryUUID, nil -} -func (m mockFlockerClient) UpdatePrimaryForDataset(primaryUUID, datasetID string) (*flockerapi.DatasetState, error) { - return m.datasetState, nil -} - -/* -TODO: re-enable after refactor -func TestSetUpAtInternal(t *testing.T) { - const dir = "dir" - mockPath := "expected-to-be-set-properly" // package var - expectedPath := mockPath - - assert := assert.New(t) - - plugMgr, rootDir := newInitializedVolumePlugMgr(t) - if rootDir != "" { - defer os.RemoveAll(rootDir) - } - plug, err := plugMgr.FindPluginByName(flockerPluginName) - assert.NoError(err) - - pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} - b := flockerVolumeMounter{flockerVolume: &flockerVolume{pod: pod, plugin: plug.(*flockerPlugin)}} - b.client = newMockFlockerClient("dataset-id", "primary-uid", mockPath) - - assert.NoError(b.SetUpAt(dir, nil)) - assert.Equal(expectedPath, b.flocker.path) -} -*/ diff --git a/pkg/volume/iscsi/iscsi.go b/pkg/volume/iscsi/iscsi.go index e5262ea6178..3dd5ddf3ca2 100644 --- a/pkg/volume/iscsi/iscsi.go +++ b/pkg/volume/iscsi/iscsi.go @@ -594,15 +594,6 @@ func createSecretMap(spec *volume.Spec, plugin *iscsiPlugin, namespace string) ( return secret, err } -func createVolumeFromISCSIVolumeSource(volumeName string, iscsi v1.ISCSIVolumeSource) *v1.Volume { - return &v1.Volume{ - Name: volumeName, - VolumeSource: v1.VolumeSource{ - ISCSI: &iscsi, - }, - } -} - func createPersistentVolumeFromISCSIPVSource(volumeName string, iscsi v1.ISCSIPersistentVolumeSource) *v1.PersistentVolume { block := v1.PersistentVolumeBlock return &v1.PersistentVolume{ diff --git a/pkg/volume/projected/projected_test.go b/pkg/volume/projected/projected_test.go index 932e2fe992c..5955f490dbf 100644 --- a/pkg/volume/projected/projected_test.go +++ b/pkg/volume/projected/projected_test.go @@ -1193,20 +1193,6 @@ func makeSecret(namespace, name string) v1.Secret { } } -func configMap(namespace, name string) v1.ConfigMap { - return v1.ConfigMap{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: namespace, - Name: name, - }, - Data: map[string]string{ - "data-1": "value-1", - "data-2": "value-2", - "data-3": "value-3", - }, - } -} - func makeProjection(name string, defaultMode int32, kind string) *v1.ProjectedVolumeSource { var item v1.VolumeProjection diff --git a/pkg/volume/rbd/rbd.go b/pkg/volume/rbd/rbd.go index 89df8315c73..8d2fbd31577 100644 --- a/pkg/volume/rbd/rbd.go +++ b/pkg/volume/rbd/rbd.go @@ -1081,15 +1081,6 @@ func getVolumeAccessModes(spec *volume.Spec) ([]v1.PersistentVolumeAccessMode, e return nil, nil } -func parsePodSecret(pod *v1.Pod, secretName string, kubeClient clientset.Interface) (string, error) { - secret, err := volutil.GetSecretForPod(pod, secretName, kubeClient) - if err != nil { - klog.Errorf("failed to get secret from [%q/%q]: %+v", pod.Namespace, secretName, err) - return "", fmt.Errorf("failed to get secret from [%q/%q]: %+v", pod.Namespace, secretName, err) - } - return parseSecretMap(secret) -} - func parsePVSecret(namespace, secretName string, kubeClient clientset.Interface) (string, error) { secret, err := volutil.GetSecretForPV(namespace, secretName, rbdPluginName, kubeClient) if err != nil { diff --git a/pkg/volume/scaleio/sio_mgr.go b/pkg/volume/scaleio/sio_mgr.go index a322276b1dd..56a0680d1fa 100644 --- a/pkg/volume/scaleio/sio_mgr.go +++ b/pkg/volume/scaleio/sio_mgr.go @@ -27,14 +27,6 @@ import ( siotypes "github.com/codedellemc/goscaleio/types/v1" ) -type storageInterface interface { - CreateVolume(string, int64) (*siotypes.Volume, error) - AttachVolume(string, bool) (string, error) - IsAttached(string) (bool, error) - DetachVolume(string) error - DeleteVolume(string) error -} - type sioMgr struct { client sioInterface configData map[string]string diff --git a/pkg/volume/vsphere_volume/vsphere_volume_test.go b/pkg/volume/vsphere_volume/vsphere_volume_test.go index 09cbe4ed420..97217a10176 100644 --- a/pkg/volume/vsphere_volume/vsphere_volume_test.go +++ b/pkg/volume/vsphere_volume/vsphere_volume_test.go @@ -62,10 +62,6 @@ func TestCanSupport(t *testing.T) { type fakePDManager struct { } -func getFakeDeviceName(host volume.VolumeHost, volPath string) string { - return path.Join(host.GetPluginDir(vsphereVolumePluginName), "device", volPath) -} - func (fake *fakePDManager) CreateVolume(v *vsphereVolumeProvisioner, selectedZone []string) (volSpec *VolumeSpec, err error) { volSpec = &VolumeSpec{ Path: "[local] test-volume-name.vmdk", diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1/defaults.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1/defaults.go index 3e1567bb633..ff9e28a112d 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1/defaults.go +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1/defaults.go @@ -80,13 +80,3 @@ func SetDefaults_ServiceReference(obj *ServiceReference) { obj.Port = utilpointer.Int32Ptr(443) } } - -// hasPerVersionColumns returns true if a CRD uses per-version columns. -func hasPerVersionColumns(versions []CustomResourceDefinitionVersion) bool { - for _, v := range versions { - if len(v.AdditionalPrinterColumns) > 0 { - return true - } - } - return false -} diff --git a/staging/src/k8s.io/apimachinery/pkg/conversion/queryparams/convert.go b/staging/src/k8s.io/apimachinery/pkg/conversion/queryparams/convert.go index b3804aa42b2..2f0dd0074af 100644 --- a/staging/src/k8s.io/apimachinery/pkg/conversion/queryparams/convert.go +++ b/staging/src/k8s.io/apimachinery/pkg/conversion/queryparams/convert.go @@ -54,10 +54,6 @@ func jsonTag(field reflect.StructField) (string, bool) { return tag, omitempty } -func formatValue(value interface{}) string { - return fmt.Sprintf("%v", value) -} - func isPointerKind(kind reflect.Kind) bool { return kind == reflect.Ptr } diff --git a/staging/src/k8s.io/cli-runtime/pkg/genericclioptions/builder_flags.go b/staging/src/k8s.io/cli-runtime/pkg/genericclioptions/builder_flags.go index 77007a9988d..8db95f927c9 100644 --- a/staging/src/k8s.io/cli-runtime/pkg/genericclioptions/builder_flags.go +++ b/staging/src/k8s.io/cli-runtime/pkg/genericclioptions/builder_flags.go @@ -211,10 +211,6 @@ func ResourceFinderForResult(result resource.Visitor) ResourceFinder { }) } -func strPtr(val string) *string { - return &val -} - func boolPtr(val bool) *bool { return &val } diff --git a/staging/src/k8s.io/client-go/scale/client.go b/staging/src/k8s.io/client-go/scale/client.go index ddf0d4ac8f7..00e597523b1 100644 --- a/staging/src/k8s.io/client-go/scale/client.go +++ b/staging/src/k8s.io/client-go/scale/client.go @@ -30,10 +30,6 @@ import ( var scaleConverter = NewScaleConverter() var codecs = serializer.NewCodecFactory(scaleConverter.Scheme()) -// restInterfaceProvider turns a restclient.Config into a restclient.Interface. -// It's overridable for the purposes of testing. -type restInterfaceProvider func(*restclient.Config) (restclient.Interface, error) - // scaleClient is an implementation of ScalesGetter // which makes use of a RESTMapper and a generic REST // client to support an discoverable resource. diff --git a/staging/src/k8s.io/client-go/tools/cache/reflector.go b/staging/src/k8s.io/client-go/tools/cache/reflector.go index 4b5daeedc2a..72a69ea6e98 100644 --- a/staging/src/k8s.io/client-go/tools/cache/reflector.go +++ b/staging/src/k8s.io/client-go/tools/cache/reflector.go @@ -25,7 +25,6 @@ import ( "net" "net/url" "reflect" - "strings" "sync" "syscall" "time" @@ -113,11 +112,6 @@ func NewNamedReflector(name string, lw ListerWatcher, expectedType interface{}, return r } -func makeValidPrometheusMetricLabel(in string) string { - // this isn't perfect, but it removes our common characters - return strings.NewReplacer("/", "_", ".", "_", "-", "_", ":", "_").Replace(in) -} - // internalPackages are packages that ignored when creating a default reflector name. These packages are in the common // call chains to NewReflector, so they'd be low entropy names for reflectors var internalPackages = []string{"client-go/tools/cache/"} diff --git a/staging/src/k8s.io/client-go/tools/cache/reflector_metrics.go b/staging/src/k8s.io/client-go/tools/cache/reflector_metrics.go index 0945e5c3a2a..dd849c8fa1b 100644 --- a/staging/src/k8s.io/client-go/tools/cache/reflector_metrics.go +++ b/staging/src/k8s.io/client-go/tools/cache/reflector_metrics.go @@ -94,23 +94,6 @@ var metricsFactory = struct { metricsProvider: noopMetricsProvider{}, } -func newReflectorMetrics(name string) *reflectorMetrics { - var ret *reflectorMetrics - if len(name) == 0 { - return ret - } - return &reflectorMetrics{ - numberOfLists: metricsFactory.metricsProvider.NewListsMetric(name), - listDuration: metricsFactory.metricsProvider.NewListDurationMetric(name), - numberOfItemsInList: metricsFactory.metricsProvider.NewItemsInListMetric(name), - numberOfWatches: metricsFactory.metricsProvider.NewWatchesMetric(name), - numberOfShortWatches: metricsFactory.metricsProvider.NewShortWatchesMetric(name), - watchDuration: metricsFactory.metricsProvider.NewWatchDurationMetric(name), - numberOfItemsInWatch: metricsFactory.metricsProvider.NewItemsInWatchMetric(name), - lastResourceVersion: metricsFactory.metricsProvider.NewLastResourceVersionMetric(name), - } -} - // SetReflectorMetricsProvider sets the metrics provider func SetReflectorMetricsProvider(metricsProvider MetricsProvider) { metricsFactory.setProviders.Do(func() { diff --git a/staging/src/k8s.io/client-go/tools/clientcmd/client_config.go b/staging/src/k8s.io/client-go/tools/clientcmd/client_config.go index a7b8c1c6e42..878e0df79ff 100644 --- a/staging/src/k8s.io/client-go/tools/clientcmd/client_config.go +++ b/staging/src/k8s.io/client-go/tools/clientcmd/client_config.go @@ -296,16 +296,6 @@ func makeUserIdentificationConfig(info clientauth.Info) *restclient.Config { return config } -// makeUserIdentificationFieldsConfig returns a client.Config capable of being merged using mergo for only server identification information -func makeServerIdentificationConfig(info clientauth.Info) restclient.Config { - config := restclient.Config{} - config.CAFile = info.CAFile - if info.Insecure != nil { - config.Insecure = *info.Insecure - } - return config -} - func canIdentifyUser(config restclient.Config) bool { return len(config.Username) > 0 || (len(config.CertFile) > 0 || len(config.CertData) > 0) || diff --git a/staging/src/k8s.io/client-go/util/certificate/certificate_store.go b/staging/src/k8s.io/client-go/util/certificate/certificate_store.go index d2666615421..9b008084b6d 100644 --- a/staging/src/k8s.io/client-go/util/certificate/certificate_store.go +++ b/staging/src/k8s.io/client-go/util/certificate/certificate_store.go @@ -23,7 +23,6 @@ import ( "fmt" "os" "path/filepath" - "strings" "time" "k8s.io/klog" @@ -289,12 +288,6 @@ func (s *fileStore) filename(qualifier string) string { return s.pairNamePrefix + "-" + qualifier + pemExtension } -// withoutExt returns the given filename after removing the extension. The -// extension to remove will be the result of filepath.Ext(). -func withoutExt(filename string) string { - return strings.TrimSuffix(filename, filepath.Ext(filename)) -} - func loadX509KeyPair(certFile, keyFile string) (*tls.Certificate, error) { cert, err := tls.LoadX509KeyPair(certFile, keyFile) if err != nil { diff --git a/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/BUILD b/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/BUILD index 1717edd83f8..82040b6316b 100644 --- a/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/BUILD +++ b/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/BUILD @@ -14,7 +14,6 @@ go_library( "groupinterface.go", "informer.go", "packages.go", - "tags.go", "types.go", "versioninterface.go", ], diff --git a/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/tags.go b/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/tags.go deleted file mode 100644 index d25d5b63049..00000000000 --- a/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/tags.go +++ /dev/null @@ -1,33 +0,0 @@ -/* -Copyright 2016 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package generators - -import ( - "k8s.io/gengo/types" - "k8s.io/klog" -) - -// extractBoolTagOrDie gets the comment-tags for the key and asserts that, if -// it exists, the value is boolean. If the tag did not exist, it returns -// false. -func extractBoolTagOrDie(key string, lines []string) bool { - val, err := types.ExtractSingleBoolCommentTag("+", key, false, lines) - if err != nil { - klog.Fatal(err) - } - return val -} diff --git a/staging/src/k8s.io/code-generator/cmd/lister-gen/generators/BUILD b/staging/src/k8s.io/code-generator/cmd/lister-gen/generators/BUILD index ec1a2ec626e..e301f6e43e5 100644 --- a/staging/src/k8s.io/code-generator/cmd/lister-gen/generators/BUILD +++ b/staging/src/k8s.io/code-generator/cmd/lister-gen/generators/BUILD @@ -10,7 +10,6 @@ go_library( srcs = [ "expansion.go", "lister.go", - "tags.go", ], importmap = "k8s.io/kubernetes/vendor/k8s.io/code-generator/cmd/lister-gen/generators", importpath = "k8s.io/code-generator/cmd/lister-gen/generators", diff --git a/staging/src/k8s.io/code-generator/cmd/lister-gen/generators/tags.go b/staging/src/k8s.io/code-generator/cmd/lister-gen/generators/tags.go deleted file mode 100644 index d25d5b63049..00000000000 --- a/staging/src/k8s.io/code-generator/cmd/lister-gen/generators/tags.go +++ /dev/null @@ -1,33 +0,0 @@ -/* -Copyright 2016 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package generators - -import ( - "k8s.io/gengo/types" - "k8s.io/klog" -) - -// extractBoolTagOrDie gets the comment-tags for the key and asserts that, if -// it exists, the value is boolean. If the tag did not exist, it returns -// false. -func extractBoolTagOrDie(key string, lines []string) bool { - val, err := types.ExtractSingleBoolCommentTag("+", key, false, lines) - if err != nil { - klog.Fatal(err) - } - return val -} diff --git a/test/conformance/walk.go b/test/conformance/walk.go index 0cabab981fe..dd02c89ecf1 100644 --- a/test/conformance/walk.go +++ b/test/conformance/walk.go @@ -300,18 +300,6 @@ func (v *visitor) Visit(node ast.Node) (w ast.Visitor) { return v } -func scandir(dir string) { - v := newVisitor() - pkg, err := parser.ParseDir(v.FileSet, dir, nil, parser.ParseComments) - if err != nil { - panic(err) - } - - for _, p := range pkg { - ast.Walk(v, p) - } -} - func scanfile(path string, src interface{}) []conformanceData { v := newVisitor() file, err := parser.ParseFile(v.FileSet, path, src, parser.ParseComments) diff --git a/test/e2e/apimachinery/generated_clientset.go b/test/e2e/apimachinery/generated_clientset.go index 2873cdfbd14..48ca4fbace9 100644 --- a/test/e2e/apimachinery/generated_clientset.go +++ b/test/e2e/apimachinery/generated_clientset.go @@ -36,27 +36,6 @@ import ( imageutils "k8s.io/kubernetes/test/utils/image" ) -func stagingClientPod(name, value string) v1.Pod { - return v1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Labels: map[string]string{ - "name": "foo", - "time": value, - }, - }, - Spec: v1.PodSpec{ - Containers: []v1.Container{ - { - Name: "nginx", - Image: imageutils.GetE2EImage(imageutils.Nginx), - Ports: []v1.ContainerPort{{ContainerPort: 80}}, - }, - }, - }, - } -} - func testingPod(name, value string) v1.Pod { return v1.Pod{ ObjectMeta: metav1.ObjectMeta{ @@ -98,34 +77,6 @@ func observeCreation(w watch.Interface) { } } -func observeObjectDeletion(w watch.Interface) (obj runtime.Object) { - // output to give us a duration to failure. Maybe we aren't getting the - // full timeout for some reason. My guess would be watch failure - framework.Logf("Starting to observe pod deletion") - deleted := false - timeout := false - timer := time.After(framework.DefaultPodDeletionTimeout) - for !deleted && !timeout { - select { - case event, normal := <-w.ResultChan(): - if !normal { - framework.Failf("The channel was closed unexpectedly") - return - } - if event.Type == watch.Deleted { - obj = event.Object - deleted = true - } - case <-timer: - timeout = true - } - } - if !deleted { - framework.Failf("Failed to observe pod deletion") - } - return -} - func observerUpdate(w watch.Interface, expectedUpdate func(runtime.Object) bool) { timer := time.After(30 * time.Second) updated := false diff --git a/test/e2e/apimachinery/namespace.go b/test/e2e/apimachinery/namespace.go index a52346d03e2..fccc7bce7af 100644 --- a/test/e2e/apimachinery/namespace.go +++ b/test/e2e/apimachinery/namespace.go @@ -27,7 +27,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/wait" - clientset "k8s.io/client-go/kubernetes" "k8s.io/kubernetes/test/e2e/framework" imageutils "k8s.io/kubernetes/test/utils/image" @@ -82,23 +81,6 @@ func extinguish(f *framework.Framework, totalNS int, maxAllowedAfterDel int, max })) } -func waitForPodInNamespace(c clientset.Interface, ns, podName string) *v1.Pod { - var pod *v1.Pod - var err error - err = wait.PollImmediate(2*time.Second, 15*time.Second, func() (bool, error) { - pod, err = c.CoreV1().Pods(ns).Get(podName, metav1.GetOptions{}) - if errors.IsNotFound(err) { - return false, nil - } - if err != nil { - return false, err - } - return true, nil - }) - gomega.Expect(err).NotTo(gomega.HaveOccurred(), "failed to get pod %s in namespace: %s", podName, ns) - return pod -} - func ensurePodsAreRemovedWhenNamespaceIsDeleted(f *framework.Framework) { ginkgo.By("Creating a test namespace") namespaceName := "nsdeletetest" diff --git a/test/e2e/apimachinery/resource_quota.go b/test/e2e/apimachinery/resource_quota.go index f9069ec4cb4..0a089a619b3 100644 --- a/test/e2e/apimachinery/resource_quota.go +++ b/test/e2e/apimachinery/resource_quota.go @@ -1362,17 +1362,6 @@ func newTestResourceQuotaWithScopeForPriorityClass(name string, hard v1.Resource } } -// newTestResourceQuotaForEphemeralStorage returns a quota that enforces default constraints for testing feature LocalStorageCapacityIsolation -func newTestResourceQuotaForEphemeralStorage(name string) *v1.ResourceQuota { - hard := v1.ResourceList{} - hard[v1.ResourceEphemeralStorage] = resource.MustParse("500Mi") - hard[v1.ResourceQuotas] = resource.MustParse("1") - return &v1.ResourceQuota{ - ObjectMeta: metav1.ObjectMeta{Name: name}, - Spec: v1.ResourceQuotaSpec{Hard: hard}, - } -} - // newTestResourceQuota returns a quota that enforces default constraints for testing func newTestResourceQuota(name string) *v1.ResourceQuota { hard := v1.ResourceList{} diff --git a/test/e2e/autoscaling/cluster_size_autoscaling.go b/test/e2e/autoscaling/cluster_size_autoscaling.go index 7158b97236c..b14f1f60a46 100644 --- a/test/e2e/autoscaling/cluster_size_autoscaling.go +++ b/test/e2e/autoscaling/cluster_size_autoscaling.go @@ -17,7 +17,6 @@ limitations under the License. package autoscaling import ( - "bytes" "fmt" "io/ioutil" "math" @@ -1187,30 +1186,6 @@ func disableAutoscaler(nodePool string, minCount, maxCount int) error { return fmt.Errorf("autoscaler still enabled, last error: %v", finalErr) } -func executeHTTPRequest(method string, url string, body string) (string, error) { - client := &http.Client{} - req, err := http.NewRequest(method, url, strings.NewReader(body)) - if err != nil { - By(fmt.Sprintf("Can't create request: %s", err.Error())) - return "", err - } - resp, err := client.Do(req) - if err != nil { - return "", err - } - defer resp.Body.Close() - - respBody, err := ioutil.ReadAll(resp.Body) - if err != nil { - return "", err - } - if resp.StatusCode != http.StatusOK { - return "", fmt.Errorf("error: %s %s", resp.Status, string(respBody)) - } - - return string(respBody), nil -} - func addNodePool(name string, machineType string, numNodes int) { args := []string{"container", "node-pools", "create", name, "--quiet", "--machine-type=" + machineType, @@ -1297,26 +1272,6 @@ func getPoolSize(f *framework.Framework, poolName string) int { return size } -func doPut(url, content string) (string, error) { - req, err := http.NewRequest("PUT", url, bytes.NewBuffer([]byte(content))) - if err != nil { - return "", err - } - req.Header.Set("Content-Type", "application/json") - client := &http.Client{} - resp, err := client.Do(req) - if err != nil { - return "", err - } - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return "", err - } - strBody := string(body) - return strBody, nil -} - func reserveMemory(f *framework.Framework, id string, replicas, megabytes int, expectRunning bool, timeout time.Duration, selector map[string]string, tolerations []v1.Toleration, priorityClassName string) func() error { By(fmt.Sprintf("Running RC which reserves %v MB of memory", megabytes)) request := int64(1024 * 1024 * megabytes / replicas) @@ -1750,14 +1705,6 @@ func runReplicatedPodOnEachNode(f *framework.Framework, nodes []v1.Node, namespa return nil } -// wrap runReplicatedPodOnEachNode to return cleanup -func runReplicatedPodOnEachNodeWithCleanup(f *framework.Framework, nodes []v1.Node, namespace string, podsPerNode int, id string, labels map[string]string, memRequest int64) (func(), error) { - err := runReplicatedPodOnEachNode(f, nodes, namespace, podsPerNode, id, labels, memRequest) - return func() { - framework.DeleteRCAndWaitForGC(f.ClientSet, namespace, id) - }, err -} - // Increase cluster size by newNodesForScaledownTests to create some unused nodes // that can be later removed by cluster autoscaler. func manuallyIncreaseClusterSize(f *framework.Framework, originalSizes map[string]int) int { diff --git a/test/e2e/framework/providers/gce/recreate_node.go b/test/e2e/framework/providers/gce/recreate_node.go index 06a4c2e90c4..84affd39dd2 100644 --- a/test/e2e/framework/providers/gce/recreate_node.go +++ b/test/e2e/framework/providers/gce/recreate_node.go @@ -39,14 +39,6 @@ func nodeNames(nodes []v1.Node) []string { return result } -func podNames(pods []v1.Pod) []string { - result := make([]string, 0, len(pods)) - for i := range pods { - result = append(result, pods[i].Name) - } - return result -} - var _ = Describe("Recreate [Feature:Recreate]", func() { f := framework.NewDefaultFramework("recreate") var originalNodes []v1.Node diff --git a/test/e2e/network/ingress.go b/test/e2e/network/ingress.go index de97a30190e..e4c08b49546 100644 --- a/test/e2e/network/ingress.go +++ b/test/e2e/network/ingress.go @@ -858,29 +858,6 @@ func executeBacksideBacksideHTTPSTest(f *framework.Framework, jig *ingress.TestJ Expect(err).NotTo(HaveOccurred(), "Failed to verify backside re-encryption ingress") } -func detectHTTPVersionAndSchemeTest(f *framework.Framework, jig *ingress.TestJig, address, version, scheme string) { - timeoutClient := &http.Client{Timeout: ingress.IngressReqTimeout} - resp := "" - err := wait.PollImmediate(framework.LoadBalancerPollInterval, framework.LoadBalancerPollTimeout, func() (bool, error) { - var err error - resp, err = framework.SimpleGET(timeoutClient, fmt.Sprintf("http://%s", address), "") - if err != nil { - framework.Logf("SimpleGET failed: %v", err) - return false, nil - } - if !strings.Contains(resp, version) { - framework.Logf("Waiting for transition to HTTP/2") - return false, nil - } - if !strings.Contains(resp, scheme) { - return false, nil - } - framework.Logf("Poll succeeded, request was served by HTTP2") - return true, nil - }) - Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("Failed to get %s or %s, response body: %s", version, scheme, resp)) -} - func detectNegAnnotation(f *framework.Framework, jig *ingress.TestJig, gceController *gce.IngressController, ns, name string, negs int) { if err := wait.Poll(5*time.Second, negUpdateTimeout, func() (bool, error) { svc, err := f.ClientSet.CoreV1().Services(ns).Get(name, metav1.GetOptions{}) diff --git a/test/e2e/servicecatalog/podpreset.go b/test/e2e/servicecatalog/podpreset.go index e26d9dbfdd6..180dd4b6144 100644 --- a/test/e2e/servicecatalog/podpreset.go +++ b/test/e2e/servicecatalog/podpreset.go @@ -287,18 +287,6 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() { }) }) -func getPodPreset(c clientset.Interface, ns, name string) (*settings.PodPreset, error) { - return c.SettingsV1alpha1().PodPresets(ns).Get(name, metav1.GetOptions{}) -} - func createPodPreset(c clientset.Interface, ns string, job *settings.PodPreset) (*settings.PodPreset, error) { return c.SettingsV1alpha1().PodPresets(ns).Create(job) } - -func updatePodPreset(c clientset.Interface, ns string, job *settings.PodPreset) (*settings.PodPreset, error) { - return c.SettingsV1alpha1().PodPresets(ns).Update(job) -} - -func deletePodPreset(c clientset.Interface, ns, name string) error { - return c.SettingsV1alpha1().PodPresets(ns).Delete(name, nil) -} diff --git a/test/e2e/storage/BUILD b/test/e2e/storage/BUILD index 3b44b4838c7..009376a75ed 100644 --- a/test/e2e/storage/BUILD +++ b/test/e2e/storage/BUILD @@ -57,9 +57,7 @@ go_library( "//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/strategicpatch:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/uuid:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/version:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/watch:go_default_library", "//staging/src/k8s.io/apiserver/pkg/authentication/serviceaccount:go_default_library", "//staging/src/k8s.io/client-go/kubernetes:go_default_library", diff --git a/test/e2e/storage/drivers/csi_objects.go b/test/e2e/storage/drivers/csi_objects.go index 9960da8add4..aa623e3e8f6 100644 --- a/test/e2e/storage/drivers/csi_objects.go +++ b/test/e2e/storage/drivers/csi_objects.go @@ -47,17 +47,6 @@ var ( } ) -func csiContainerImage(image string) string { - var fullName string - fullName += *csiImageRegistry + "/" + image + ":" - if *csiImageVersion != "" { - fullName += *csiImageVersion - } else { - fullName += csiImageVersions[image] - } - return fullName -} - func shredFile(filePath string) { if _, err := os.Stat(filePath); os.IsNotExist(err) { framework.Logf("File %v was not found, skipping shredding", filePath) diff --git a/test/e2e/storage/flexvolume.go b/test/e2e/storage/flexvolume.go index 1c61c9bb820..f4b223bb65d 100644 --- a/test/e2e/storage/flexvolume.go +++ b/test/e2e/storage/flexvolume.go @@ -27,9 +27,6 @@ import ( . "github.com/onsi/ginkgo" "k8s.io/api/core/v1" apierrs "k8s.io/apimachinery/pkg/api/errors" - versionutil "k8s.io/apimachinery/pkg/util/version" - "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/apimachinery/pkg/version" clientset "k8s.io/client-go/kubernetes" "k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework/testfiles" @@ -144,24 +141,6 @@ func sshAndLog(cmd, host string, failOnError bool) { } } -func getMasterVersion(c clientset.Interface) (*versionutil.Version, error) { - var err error - var v *version.Info - waitErr := wait.PollImmediate(5*time.Second, 2*time.Minute, func() (bool, error) { - v, err = c.Discovery().ServerVersion() - return err == nil, nil - }) - if waitErr != nil { - return nil, fmt.Errorf("Could not get the master version: %v", waitErr) - } - - return versionutil.MustParseSemantic(v.GitVersion), nil -} - -func getNodeVersion(node *v1.Node) *versionutil.Version { - return versionutil.MustParseSemantic(node.Status.NodeInfo.KubeletVersion) -} - func getHostFromHostPort(hostPort string) string { // try to split host and port var host string diff --git a/test/e2e/storage/regional_pd.go b/test/e2e/storage/regional_pd.go index 4df7aa96d90..15e10aaf30a 100644 --- a/test/e2e/storage/regional_pd.go +++ b/test/e2e/storage/regional_pd.go @@ -542,30 +542,6 @@ func getTwoRandomZones(c clientset.Interface) []string { return []string{zone1, zone2} } -// Waits for at least 1 replica of a StatefulSet to become not ready or until timeout occurs, whichever comes first. -func waitForStatefulSetReplicasNotReady(statefulSetName, ns string, c clientset.Interface) error { - const poll = 3 * time.Second - const timeout = statefulSetReadyTimeout - - framework.Logf("Waiting up to %v for StatefulSet %s to have at least 1 replica to become not ready", timeout, statefulSetName) - for start := time.Now(); time.Since(start) < timeout; time.Sleep(poll) { - sts, err := c.AppsV1().StatefulSets(ns).Get(statefulSetName, metav1.GetOptions{}) - if err != nil { - framework.Logf("Get StatefulSet %s failed, ignoring for %v: %v", statefulSetName, poll, err) - continue - } else { - if sts.Status.ReadyReplicas < *sts.Spec.Replicas { - framework.Logf("%d replicas are ready out of a total of %d replicas in StatefulSet %s. (%v)", - sts.Status.ReadyReplicas, *sts.Spec.Replicas, statefulSetName, time.Since(start)) - return nil - } else { - framework.Logf("StatefulSet %s found but there are %d ready replicas and %d total replicas.", statefulSetName, sts.Status.ReadyReplicas, *sts.Spec.Replicas) - } - } - } - return fmt.Errorf("All replicas in StatefulSet %s are still ready within %v", statefulSetName, timeout) -} - // If match is true, check if zones in PV exactly match zones given. // Otherwise, check whether zones in PV is superset of zones given. func verifyZonesInPV(volume *v1.PersistentVolume, zones sets.String, match bool) error { diff --git a/test/e2e/storage/testsuites/subpath.go b/test/e2e/storage/testsuites/subpath.go index d91d1a96119..121822dde05 100644 --- a/test/e2e/storage/testsuites/subpath.go +++ b/test/e2e/storage/testsuites/subpath.go @@ -641,14 +641,6 @@ func volumeFormatPod(f *framework.Framework, volumeSource *v1.VolumeSource) *v1. } } -func clearSubpathPodCommands(pod *v1.Pod) { - pod.Spec.InitContainers[0].Command = nil - pod.Spec.InitContainers[1].Args = nil - pod.Spec.InitContainers[2].Args = nil - pod.Spec.Containers[0].Args = nil - pod.Spec.Containers[1].Args = nil -} - func setInitCommand(pod *v1.Pod, command string) { pod.Spec.InitContainers[0].Command = []string{"/bin/sh", "-ec", command} } diff --git a/test/e2e_node/docker_util.go b/test/e2e_node/docker_util.go index 2e84e7b6fc5..359e15cf2ec 100644 --- a/test/e2e_node/docker_util.go +++ b/test/e2e_node/docker_util.go @@ -53,16 +53,6 @@ func isSharedPIDNamespaceSupported() (bool, error) { return version.GTE(semver.MustParse("1.26.0")), nil } -// isDockerNoNewPrivilegesSupported returns true if Docker version is 1.11+ -// (API version 1.23+), and false otherwise. -func isDockerNoNewPrivilegesSupported() (bool, error) { - version, err := getDockerAPIVersion() - if err != nil { - return false, err - } - return version.GTE(semver.MustParse("1.23.0")), nil -} - // isDockerLiveRestoreSupported returns true if live-restore is supported in // the current Docker version. func isDockerLiveRestoreSupported() (bool, error) { diff --git a/test/e2e_node/remote/node_e2e.go b/test/e2e_node/remote/node_e2e.go index 63bc7dabbaa..2e5751b168f 100644 --- a/test/e2e_node/remote/node_e2e.go +++ b/test/e2e_node/remote/node_e2e.go @@ -85,23 +85,6 @@ func (n *NodeE2ERemote) SetupTestPackage(tardir, systemSpecName string) error { return nil } -// dest is relative to the root of the tar -func tarAddFile(tar, source, dest string) error { - dir := filepath.Dir(dest) - tardir := filepath.Join(tar, dir) - tardest := filepath.Join(tar, dest) - - out, err := exec.Command("mkdir", "-p", tardir).CombinedOutput() - if err != nil { - return fmt.Errorf("failed to create archive bin subdir %q, was dest for file %q. Err: %v. Output:\n%s", tardir, source, err, out) - } - out, err = exec.Command("cp", source, tardest).CombinedOutput() - if err != nil { - return fmt.Errorf("failed to copy file %q to the archive bin subdir %q. Err: %v. Output:\n%s", source, tardir, err, out) - } - return nil -} - // prependCOSMounterFlag prepends the flag for setting the GCI mounter path to // args and returns the result. func prependCOSMounterFlag(args, host, workspace string) (string, error) { diff --git a/test/images/net/main.go b/test/images/net/main.go index 896bdca9d00..b3323221c74 100644 --- a/test/images/net/main.go +++ b/test/images/net/main.go @@ -33,11 +33,6 @@ import ( type runnerMap map[string]common.Runner -type runRequestJSON struct { - runner string - options interface{} -} - var ( // flags for the command line. See usage args below for // descriptions. @@ -157,6 +152,3 @@ func handleRunRequest(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "ok\noutput:\n\n"+output.b.String()) } - -func setupLogger() { -} diff --git a/test/images/netexec/netexec.go b/test/images/netexec/netexec.go index 8bd6f632bc1..f95b0c584f9 100644 --- a/test/images/netexec/netexec.go +++ b/test/images/netexec/netexec.go @@ -62,11 +62,6 @@ func (a *atomicBool) get() bool { return atomic.LoadInt32(&a.v) == 1 } -type output struct { - responses []string - errors []string -} - func init() { flag.IntVar(&httpPort, "http-port", 8080, "HTTP Listen Port") flag.IntVar(&udpPort, "udp-port", 8081, "UDP Listen Port") diff --git a/test/images/no-snat-test-proxy/main.go b/test/images/no-snat-test-proxy/main.go index 6646982b818..7b2c9547964 100644 --- a/test/images/no-snat-test-proxy/main.go +++ b/test/images/no-snat-test-proxy/main.go @@ -21,7 +21,6 @@ import ( "io/ioutil" "net/http" "os" - "strings" "github.com/spf13/pflag" cliflag "k8s.io/component-base/cli/flag" @@ -66,16 +65,6 @@ func (m *masqTestProxy) Run() error { return http.ListenAndServe(":"+m.Port, nil) } -type handler func(http.ResponseWriter, *http.Request) - -func joinErrors(errs []error, sep string) string { - strs := make([]string, len(errs)) - for i, err := range errs { - strs[i] = err.Error() - } - return strings.Join(strs, sep) -} - func checknosnatURL(pip, ips string) string { return fmt.Sprintf("http://%s/checknosnat?ips=%s", pip, ips) } diff --git a/test/integration/master/transformation_testcase.go b/test/integration/master/transformation_testcase.go index 50d5c1ab5bd..4a59f05343a 100644 --- a/test/integration/master/transformation_testcase.go +++ b/test/integration/master/transformation_testcase.go @@ -258,12 +258,3 @@ func (e *transformTest) printMetrics() error { return nil } - -func contains(s []string, e string) bool { - for _, a := range s { - if a == e { - return true - } - } - return false -} diff --git a/test/integration/scheduler/util.go b/test/integration/scheduler/util.go index 91b999a9567..70cc08c2479 100644 --- a/test/integration/scheduler/util.go +++ b/test/integration/scheduler/util.go @@ -589,17 +589,6 @@ func podScheduled(c clientset.Interface, podNamespace, podName string) wait.Cond } } -// podUnschedulable returns a condition function that returns true if the given pod -// gets unschedulable status. -func podSchedulableCondition(c clientset.Interface, podNamespace, podName string) (*v1.PodCondition, error) { - pod, err := c.CoreV1().Pods(podNamespace).Get(podName, metav1.GetOptions{}) - if err != nil { - return nil, err - } - _, cond := podutil.GetPodCondition(&pod.Status, v1.PodScheduled) - return cond, nil -} - // podUnschedulable returns a condition function that returns true if the given pod // gets unschedulable status. func podUnschedulable(c clientset.Interface, podNamespace, podName string) wait.ConditionFunc { diff --git a/test/integration/statefulset/util.go b/test/integration/statefulset/util.go index 0accec21302..bf866f7db90 100644 --- a/test/integration/statefulset/util.go +++ b/test/integration/statefulset/util.go @@ -48,13 +48,6 @@ const ( fakeImage = "fakeimage" ) -type statefulsetTester struct { - t *testing.T - c clientset.Interface - service *v1.Service - statefulset *appsv1.StatefulSet -} - func labelMap() map[string]string { return map[string]string{"foo": "bar"} }