Fix go imports
This commit is contained in:
parent
a2009484f7
commit
004d0c8214
8 changed files with 22 additions and 18 deletions
|
@ -20,9 +20,10 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"k8s.io/ingress-nginx/internal/nginx"
|
"k8s.io/ingress-nginx/internal/nginx"
|
||||||
"os"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -23,7 +23,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/client-go/kubernetes/fake"
|
"k8s.io/client-go/kubernetes/fake"
|
||||||
|
@ -48,7 +48,7 @@ func TestHandleSigterm(t *testing.T) {
|
||||||
defer deleteConfigMap(cm, ns, clientSet, t)
|
defer deleteConfigMap(cm, ns, clientSet, t)
|
||||||
|
|
||||||
name := "test"
|
name := "test"
|
||||||
pod := v1.Pod{
|
pod := corev1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: name,
|
Name: name,
|
||||||
Namespace: ns,
|
Namespace: ns,
|
||||||
|
@ -110,7 +110,7 @@ func createConfigMap(clientSet kubernetes.Interface, ns string, t *testing.T) st
|
||||||
t.Helper()
|
t.Helper()
|
||||||
t.Log("Creating temporal config map")
|
t.Log("Creating temporal config map")
|
||||||
|
|
||||||
configMap := &v1.ConfigMap{
|
configMap := &corev1.ConfigMap{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "config",
|
Name: "config",
|
||||||
SelfLink: fmt.Sprintf("/api/v1/namespaces/%s/configmaps/config", ns),
|
SelfLink: fmt.Sprintf("/api/v1/namespaces/%s/configmaps/config", ns),
|
||||||
|
|
|
@ -20,6 +20,7 @@ import (
|
||||||
"crypto/sha1"
|
"crypto/sha1"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,12 @@ package annotations
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
. "github.com/onsi/ginkgo"
|
|
||||||
. "github.com/onsi/gomega"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
. "github.com/onsi/ginkgo"
|
||||||
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
"github.com/parnurzeal/gorequest"
|
"github.com/parnurzeal/gorequest"
|
||||||
|
|
||||||
"k8s.io/ingress-nginx/test/e2e/framework"
|
"k8s.io/ingress-nginx/test/e2e/framework"
|
||||||
|
|
|
@ -17,11 +17,12 @@ limitations under the License.
|
||||||
package annotations
|
package annotations
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
"github.com/parnurzeal/gorequest"
|
"github.com/parnurzeal/gorequest"
|
||||||
"k8s.io/ingress-nginx/test/e2e/framework"
|
"k8s.io/ingress-nginx/test/e2e/framework"
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = framework.IngressNginxDescribe("Annotations - X-Forwarded-Prefix", func() {
|
var _ = framework.IngressNginxDescribe("Annotations - X-Forwarded-Prefix", func() {
|
||||||
|
|
|
@ -25,7 +25,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"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
|
// 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
|
// 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 (
|
var (
|
||||||
execOut bytes.Buffer
|
execOut bytes.Buffer
|
||||||
execErr bytes.Buffer
|
execErr bytes.Buffer
|
||||||
|
|
|
@ -21,11 +21,11 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Logs returns the log entries of a given Pod.
|
// Logs returns the log entries of a given Pod.
|
||||||
func Logs(pod *v1.Pod) (string, error) {
|
func Logs(pod *corev1.Pod) (string, error) {
|
||||||
var (
|
var (
|
||||||
execOut bytes.Buffer
|
execOut bytes.Buffer
|
||||||
execErr bytes.Buffer
|
execErr bytes.Buffer
|
||||||
|
|
|
@ -23,7 +23,7 @@ import (
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
v1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/uuid"
|
"k8s.io/apimachinery/pkg/util/uuid"
|
||||||
|
@ -92,13 +92,13 @@ var RunID = uuid.NewUUID()
|
||||||
// CreateKubeNamespace creates a new namespace in the cluster
|
// CreateKubeNamespace creates a new namespace in the cluster
|
||||||
func CreateKubeNamespace(baseName string, c kubernetes.Interface) (string, error) {
|
func CreateKubeNamespace(baseName string, c kubernetes.Interface) (string, error) {
|
||||||
ts := time.Now().UnixNano()
|
ts := time.Now().UnixNano()
|
||||||
ns := &v1.Namespace{
|
ns := &corev1.Namespace{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
GenerateName: fmt.Sprintf("e2e-tests-%v-%v-", baseName, ts),
|
GenerateName: fmt.Sprintf("e2e-tests-%v-%v-", baseName, ts),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
// Be robust about making the namespace creation call.
|
// Be robust about making the namespace creation call.
|
||||||
var got *v1.Namespace
|
var got *corev1.Namespace
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
err = wait.PollImmediate(Poll, DefaultTimeout, func() (bool, 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.
|
// 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.
|
// Returns an error if timeout occurs first, or pod goes in to failed state.
|
||||||
func WaitForPodRunningInNamespace(c kubernetes.Interface, pod *v1.Pod) error {
|
func WaitForPodRunningInNamespace(c kubernetes.Interface, pod *corev1.Pod) error {
|
||||||
if pod.Status.Phase == v1.PodRunning {
|
if pod.Status.Phase == corev1.PodRunning {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return waitTimeoutForPodRunningInNamespace(c, pod.Name, pod.Namespace, DefaultTimeout)
|
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
|
return false, nil
|
||||||
}
|
}
|
||||||
switch pod.Status.Phase {
|
switch pod.Status.Phase {
|
||||||
case v1.PodRunning:
|
case corev1.PodRunning:
|
||||||
return true, nil
|
return true, nil
|
||||||
case v1.PodFailed, v1.PodSucceeded:
|
case corev1.PodFailed, corev1.PodSucceeded:
|
||||||
return false, fmt.Errorf("pod ran to completion")
|
return false, fmt.Errorf("pod ran to completion")
|
||||||
}
|
}
|
||||||
return false, nil
|
return false, nil
|
||||||
|
|
Loading…
Reference in a new issue