From 004d0c82143af739793f33327c5d2c01e3e8ae48 Mon Sep 17 00:00:00 2001 From: Manuel Alejandro de Brito Fontes Date: Sun, 30 Jun 2019 18:58:18 -0400 Subject: [PATCH] Fix go imports --- cmd/dbg/main.go | 3 ++- cmd/nginx/main_test.go | 6 +++--- internal/file/file.go | 1 + test/e2e/annotations/rewrite.go | 5 +++-- test/e2e/annotations/xforwardedprefix.go | 3 ++- test/e2e/framework/exec.go | 4 ++-- test/e2e/framework/logs.go | 4 ++-- test/e2e/framework/util.go | 14 +++++++------- 8 files changed, 22 insertions(+), 18 deletions(-) diff --git a/cmd/dbg/main.go b/cmd/dbg/main.go index 7b9657ab3..308a6bdf8 100644 --- a/cmd/dbg/main.go +++ b/cmd/dbg/main.go @@ -20,9 +20,10 @@ import ( "bytes" "encoding/json" "fmt" + "os" + "github.com/spf13/cobra" "k8s.io/ingress-nginx/internal/nginx" - "os" ) const ( diff --git a/cmd/nginx/main_test.go b/cmd/nginx/main_test.go index c4236ebfc..65a98da7d 100644 --- a/cmd/nginx/main_test.go +++ b/cmd/nginx/main_test.go @@ -23,7 +23,7 @@ import ( "testing" "time" - "k8s.io/api/core/v1" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/fake" @@ -48,7 +48,7 @@ func TestHandleSigterm(t *testing.T) { defer deleteConfigMap(cm, ns, clientSet, t) name := "test" - pod := v1.Pod{ + pod := corev1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: ns, @@ -110,7 +110,7 @@ func createConfigMap(clientSet kubernetes.Interface, ns string, t *testing.T) st t.Helper() t.Log("Creating temporal config map") - configMap := &v1.ConfigMap{ + configMap := &corev1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ Name: "config", SelfLink: fmt.Sprintf("/api/v1/namespaces/%s/configmaps/config", ns), diff --git a/internal/file/file.go b/internal/file/file.go index 9939df944..0a8d5270e 100644 --- a/internal/file/file.go +++ b/internal/file/file.go @@ -20,6 +20,7 @@ import ( "crypto/sha1" "encoding/hex" "io/ioutil" + "k8s.io/klog" ) diff --git a/test/e2e/annotations/rewrite.go b/test/e2e/annotations/rewrite.go index c5137a34c..67d2a159c 100644 --- a/test/e2e/annotations/rewrite.go +++ b/test/e2e/annotations/rewrite.go @@ -18,11 +18,12 @@ package annotations import ( "fmt" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" "net/http" "strings" + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "github.com/parnurzeal/gorequest" "k8s.io/ingress-nginx/test/e2e/framework" diff --git a/test/e2e/annotations/xforwardedprefix.go b/test/e2e/annotations/xforwardedprefix.go index 479aa4de0..ddbdc6822 100644 --- a/test/e2e/annotations/xforwardedprefix.go +++ b/test/e2e/annotations/xforwardedprefix.go @@ -17,11 +17,12 @@ limitations under the License. package annotations import ( + "net/http" + . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/parnurzeal/gorequest" "k8s.io/ingress-nginx/test/e2e/framework" - "net/http" ) var _ = framework.IngressNginxDescribe("Annotations - X-Forwarded-Prefix", func() { diff --git a/test/e2e/framework/exec.go b/test/e2e/framework/exec.go index 1da7f586b..cf6b55cbd 100644 --- a/test/e2e/framework/exec.go +++ b/test/e2e/framework/exec.go @@ -25,7 +25,7 @@ import ( "strconv" "strings" - "k8s.io/api/core/v1" + corev1 "k8s.io/api/core/v1" ) // ExecIngressPod executes a command inside the first container in ingress controller running pod @@ -39,7 +39,7 @@ func (f *Framework) ExecIngressPod(command string) (string, error) { } // ExecCommand executes a command inside a the first container in a running pod -func (f *Framework) ExecCommand(pod *v1.Pod, command string) (string, error) { +func (f *Framework) ExecCommand(pod *corev1.Pod, command string) (string, error) { var ( execOut bytes.Buffer execErr bytes.Buffer diff --git a/test/e2e/framework/logs.go b/test/e2e/framework/logs.go index 21a93e569..b9e605aac 100644 --- a/test/e2e/framework/logs.go +++ b/test/e2e/framework/logs.go @@ -21,11 +21,11 @@ import ( "fmt" "os/exec" - "k8s.io/api/core/v1" + corev1 "k8s.io/api/core/v1" ) // Logs returns the log entries of a given Pod. -func Logs(pod *v1.Pod) (string, error) { +func Logs(pod *corev1.Pod) (string, error) { var ( execOut bytes.Buffer execErr bytes.Buffer diff --git a/test/e2e/framework/util.go b/test/e2e/framework/util.go index 2b7025d96..7ea5c4d27 100644 --- a/test/e2e/framework/util.go +++ b/test/e2e/framework/util.go @@ -23,7 +23,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - v1 "k8s.io/api/core/v1" + corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/uuid" @@ -92,13 +92,13 @@ var RunID = uuid.NewUUID() // CreateKubeNamespace creates a new namespace in the cluster func CreateKubeNamespace(baseName string, c kubernetes.Interface) (string, error) { ts := time.Now().UnixNano() - ns := &v1.Namespace{ + ns := &corev1.Namespace{ ObjectMeta: metav1.ObjectMeta{ GenerateName: fmt.Sprintf("e2e-tests-%v-%v-", baseName, ts), }, } // Be robust about making the namespace creation call. - var got *v1.Namespace + var got *corev1.Namespace var err error err = wait.PollImmediate(Poll, DefaultTimeout, func() (bool, error) { @@ -171,8 +171,8 @@ func noPodsInNamespace(c kubernetes.Interface, namespace string) wait.ConditionF // WaitForPodRunningInNamespace waits a default amount of time (PodStartTimeout) for the specified pod to become running. // Returns an error if timeout occurs first, or pod goes in to failed state. -func WaitForPodRunningInNamespace(c kubernetes.Interface, pod *v1.Pod) error { - if pod.Status.Phase == v1.PodRunning { +func WaitForPodRunningInNamespace(c kubernetes.Interface, pod *corev1.Pod) error { + if pod.Status.Phase == corev1.PodRunning { return nil } return waitTimeoutForPodRunningInNamespace(c, pod.Name, pod.Namespace, DefaultTimeout) @@ -279,9 +279,9 @@ func podRunning(c kubernetes.Interface, podName, namespace string) wait.Conditio return false, nil } switch pod.Status.Phase { - case v1.PodRunning: + case corev1.PodRunning: return true, nil - case v1.PodFailed, v1.PodSucceeded: + case corev1.PodFailed, corev1.PodSucceeded: return false, fmt.Errorf("pod ran to completion") } return false, nil