chore: pkg imported more than once (#10048)

This commit is contained in:
guangwu 2023-06-12 02:49:47 +08:00 committed by GitHub
parent 05e5956545
commit 114ae77fb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 33 deletions

View file

@ -27,7 +27,6 @@ import (
"github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
networking "k8s.io/api/networking/v1"
apiextcs "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
@ -38,7 +37,6 @@ import (
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
restclient "k8s.io/client-go/rest"
"k8s.io/klog/v2"
)
@ -62,13 +60,13 @@ type Framework struct {
// A Kubernetes and Service Catalog client
KubeClientSet kubernetes.Interface
KubeConfig *restclient.Config
KubeConfig *rest.Config
APIExtensionsClientSet apiextcs.Interface
Namespace string
IngressClass string
pod *corev1.Pod
pod *v1.Pod
}
// NewDefaultFramework makes a new framework and sets up a BeforeEach/AfterEach for
@ -233,7 +231,7 @@ func (f *Framework) GetURL(scheme RequestScheme) string {
}
// GetIngressNGINXPod returns the ingress controller running pod
func (f *Framework) GetIngressNGINXPod() *corev1.Pod {
func (f *Framework) GetIngressNGINXPod() *v1.Pod {
return f.pod
}
@ -413,13 +411,13 @@ func (f *Framework) WaitForReload(fn func()) {
assert.Nil(ginkgo.GinkgoT(), err, "while waiting for ingress controller reload")
}
func getReloadCount(pod *corev1.Pod, namespace string, client kubernetes.Interface) int {
func getReloadCount(pod *v1.Pod, namespace string, client kubernetes.Interface) int {
events, err := client.CoreV1().Events(namespace).Search(scheme.Scheme, pod)
assert.Nil(ginkgo.GinkgoT(), err, "obtaining NGINX Pod")
reloadCount := 0
for _, e := range events.Items {
if e.Reason == "RELOAD" && e.Type == corev1.EventTypeNormal {
if e.Reason == "RELOAD" && e.Type == v1.EventTypeNormal {
reloadCount++
}
}
@ -793,7 +791,7 @@ func Sleep(duration ...time.Duration) {
time.Sleep(sleepFor)
}
func loadConfig() (*restclient.Config, error) {
func loadConfig() (*rest.Config, error) {
config, err := rest.InClusterConfig()
if err != nil {
return nil, err