Remove k8s.io/kubernetes dependency
This commit is contained in:
parent
a762d8a4e3
commit
a85e53f4cb
8 changed files with 86 additions and 234 deletions
|
|
@ -42,8 +42,6 @@ import (
|
|||
restclient "k8s.io/client-go/rest"
|
||||
"k8s.io/ingress-nginx/internal/k8s"
|
||||
"k8s.io/klog/v2"
|
||||
"k8s.io/kubernetes/pkg/apis/core"
|
||||
kubeframework "k8s.io/kubernetes/test/e2e/framework"
|
||||
)
|
||||
|
||||
// RequestScheme define a scheme used in a test request.
|
||||
|
|
@ -97,7 +95,7 @@ func (f *Framework) BeforeEach() {
|
|||
var err error
|
||||
|
||||
if f.KubeClientSet == nil {
|
||||
f.KubeConfig, err = kubeframework.LoadConfig()
|
||||
f.KubeConfig, err = loadConfig()
|
||||
assert.Nil(ginkgo.GinkgoT(), err, "loading a kubernetes client configuration")
|
||||
|
||||
// TODO: remove after k8s v1.22
|
||||
|
|
@ -392,7 +390,7 @@ func getReloadCount(pod *corev1.Pod, namespace string, client kubernetes.Interfa
|
|||
|
||||
reloadCount := 0
|
||||
for _, e := range evnts.Items {
|
||||
if e.Reason == "RELOAD" && e.Type == core.EventTypeNormal {
|
||||
if e.Reason == "RELOAD" && e.Type == corev1.EventTypeNormal {
|
||||
reloadCount++
|
||||
}
|
||||
}
|
||||
|
|
@ -717,3 +715,13 @@ func Sleep(duration ...time.Duration) {
|
|||
|
||||
time.Sleep(sleepFor)
|
||||
}
|
||||
|
||||
func loadConfig() (*restclient.Config, error) {
|
||||
config, err := rest.InClusterConfig()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
config.UserAgent = "ingress-nginx-e2e"
|
||||
return config, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ import (
|
|||
utilnet "k8s.io/apimachinery/pkg/util/net"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
podutil "k8s.io/kubernetes/pkg/api/v1/pod"
|
||||
)
|
||||
|
||||
// EnsureSecret creates a Secret object or returns it if it already exists.
|
||||
|
|
@ -210,13 +209,26 @@ func podRunningReady(p *core.Pod) (bool, error) {
|
|||
p.ObjectMeta.Name, p.Spec.NodeName, core.PodRunning, p.Status.Phase)
|
||||
}
|
||||
// Check the ready condition is true.
|
||||
if !podutil.IsPodReady(p) {
|
||||
|
||||
if !isPodReady(p) {
|
||||
return false, fmt.Errorf("pod '%s' on '%s' didn't have condition {%v %v}; conditions: %v",
|
||||
p.ObjectMeta.Name, p.Spec.NodeName, core.PodReady, core.ConditionTrue, p.Status.Conditions)
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func isPodReady(p *core.Pod) bool {
|
||||
for _, condition := range p.Status.Conditions {
|
||||
if condition.Type != core.ContainersReady {
|
||||
continue
|
||||
}
|
||||
|
||||
return condition.Status == core.ConditionTrue
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// getIngressNGINXPod returns the ingress controller running pod
|
||||
func getIngressNGINXPod(ns string, kubeClientSet kubernetes.Interface) (*core.Pod, error) {
|
||||
var pod *core.Pod
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue