Remove unused variables and verbose e2e logs

This commit is contained in:
Manuel Alejandro de Brito Fontes 2020-06-27 11:57:00 -04:00
parent 47b5e20a88
commit 10dcf0db15
35 changed files with 331 additions and 427 deletions

View file

@ -75,7 +75,7 @@ func (f *Framework) NewNewFastCGIHelloServerDeploymentWithReplicas(replicas int3
d := f.EnsureDeployment(deployment)
err := WaitForPodsReady(f.KubeClientSet, DefaultTimeout, int(replicas), f.Namespace, metav1.ListOptions{
err := waitForPodsReady(f.KubeClientSet, DefaultTimeout, int(replicas), f.Namespace, metav1.ListOptions{
LabelSelector: fields.SelectorFromSet(fields.Set(d.Spec.Template.ObjectMeta.Labels)).String(),
})
assert.Nil(ginkgo.GinkgoT(), err, "failed to wait for to become ready")

View file

@ -24,6 +24,9 @@ import (
"github.com/gavv/httpexpect/v2"
"github.com/onsi/ginkgo"
"github.com/pkg/errors"
dto "github.com/prometheus/client_model/go"
"github.com/prometheus/common/expfmt"
"github.com/prometheus/common/model"
"github.com/stretchr/testify/assert"
appsv1 "k8s.io/api/apps/v1"
v1 "k8s.io/api/core/v1"
@ -37,6 +40,7 @@ import (
restclient "k8s.io/client-go/rest"
"k8s.io/ingress-nginx/internal/k8s"
"k8s.io/klog"
kubeframework "k8s.io/kubernetes/test/e2e/framework"
)
// RequestScheme define a scheme used in a test request.
@ -72,22 +76,8 @@ type Framework struct {
func NewDefaultFramework(baseName string) *Framework {
defer ginkgo.GinkgoRecover()
kubeConfig, err := restclient.InClusterConfig()
if err != nil {
panic(err.Error())
}
assert.Nil(ginkgo.GinkgoT(), err, "creating kubernetes API client configuration")
kubeClient, err := kubernetes.NewForConfig(kubeConfig)
assert.Nil(ginkgo.GinkgoT(), err, "creating Kubernetes API client")
_, isIngressV1Ready := k8s.NetworkingIngressAvailable(kubeClient)
f := &Framework{
BaseName: baseName,
KubeConfig: kubeConfig,
KubeClientSet: kubeClient,
IsIngressV1Ready: isIngressV1Ready,
BaseName: baseName,
}
ginkgo.BeforeEach(f.BeforeEach)
@ -98,63 +88,74 @@ func NewDefaultFramework(baseName string) *Framework {
// BeforeEach gets a client and makes a namespace.
func (f *Framework) BeforeEach() {
ingressNamespace, err := CreateKubeNamespace(f.BaseName, f.KubeClientSet)
assert.Nil(ginkgo.GinkgoT(), err, "creating namespace")
var err error
f.Namespace = ingressNamespace
if f.KubeClientSet == nil {
f.KubeConfig, err = kubeframework.LoadConfig()
assert.Nil(ginkgo.GinkgoT(), err, "loading a kubernetes client configuration")
f.KubeClientSet, err = kubernetes.NewForConfig(f.KubeConfig)
assert.Nil(ginkgo.GinkgoT(), err, "creating a kubernetes client")
_, isIngressV1Ready := k8s.NetworkingIngressAvailable(f.KubeClientSet)
f.IsIngressV1Ready = isIngressV1Ready
}
f.Namespace, err = CreateKubeNamespace(f.BaseName, f.KubeClientSet)
assert.Nil(ginkgo.GinkgoT(), err, "creating namespace")
err = f.newIngressController(f.Namespace, f.BaseName)
assert.Nil(ginkgo.GinkgoT(), err, "deploying the ingress controller")
err = WaitForPodsReady(f.KubeClientSet, DefaultTimeout, 1, f.Namespace, metav1.ListOptions{
err = waitForPodsReady(f.KubeClientSet, DefaultTimeout, 1, f.Namespace, metav1.ListOptions{
LabelSelector: "app.kubernetes.io/name=ingress-nginx",
})
assert.Nil(ginkgo.GinkgoT(), err, "waiting for ingress pods to be ready")
// wait before any request
time.Sleep(5 * time.Second)
}
// AfterEach deletes the namespace, after reading its events.
func (f *Framework) AfterEach() {
if ginkgo.CurrentGinkgoTestDescription().Failed {
pod, err := GetIngressNGINXPod(f.Namespace, f.KubeClientSet)
if err != nil {
Logf("Unexpected error searching for ingress controller pod: %v", err)
return
}
defer func(kubeClient kubernetes.Interface, ns string) {
err := deleteKubeNamespace(kubeClient, ns)
assert.Nil(ginkgo.GinkgoT(), err, "deleting namespace %v", f.Namespace)
}(f.KubeClientSet, f.Namespace)
cmd := fmt.Sprintf("cat /etc/nginx/nginx.conf")
o, err := f.ExecCommand(pod, cmd)
if err != nil {
Logf("Unexpected error obtaining nginx.conf file: %v", err)
return
}
ginkgo.By("Dumping NGINX configuration after failure")
Logf("%v", o)
log, err := f.NginxLogs()
if err != nil {
Logf("Unexpected error obtaining NGINX logs: %v", err)
return
}
ginkgo.By("Dumping NGINX logs")
Logf("%v", log)
o, err = f.NamespaceContent()
if err != nil {
Logf("Unexpected error obtaining namespace information: %v", err)
return
}
ginkgo.By("Dumping namespace content")
Logf("%v", o)
if !ginkgo.CurrentGinkgoTestDescription().Failed {
return
}
err := DeleteKubeNamespace(f.KubeClientSet, f.Namespace)
assert.Nil(ginkgo.GinkgoT(), err, "deleting namespace %v", f.Namespace)
pod, err := GetIngressNGINXPod(f.Namespace, f.KubeClientSet)
if err != nil {
Logf("Unexpected error searching for ingress controller pod: %v", err)
return
}
cmd := fmt.Sprintf("cat /etc/nginx/nginx.conf")
o, err := f.ExecCommand(pod, cmd)
if err != nil {
Logf("Unexpected error obtaining nginx.conf file: %v", err)
return
}
ginkgo.By("Dumping NGINX configuration after failure")
Logf("%v", o)
log, err := f.NginxLogs()
if err != nil {
Logf("Unexpected error obtaining NGINX logs: %v", err)
return
}
ginkgo.By("Dumping NGINX logs")
Logf("%v", log)
o, err = f.NamespaceContent()
if err != nil {
Logf("Unexpected error obtaining namespace information: %v", err)
return
}
ginkgo.By("Dumping namespace content")
Logf("%v", o)
}
// IngressNginxDescribe wrapper function for ginkgo describe. Adds namespacing.
@ -188,20 +189,10 @@ func (f *Framework) GetNginxIP() string {
}
// GetNginxPodIP returns the IP addresses of the running pods
func (f *Framework) GetNginxPodIP() []string {
e, err := f.KubeClientSet.
CoreV1().
Endpoints(f.Namespace).
Get(context.TODO(), "nginx-ingress-controller", metav1.GetOptions{})
assert.Nil(ginkgo.GinkgoT(), err, "obtaining NGINX IP address")
eips := make([]string, 0)
for _, s := range e.Subsets {
for _, a := range s.Addresses {
eips = append(eips, a.IP)
}
}
return eips
func (f *Framework) GetNginxPodIP() string {
pod, err := GetIngressNGINXPod(f.Namespace, f.KubeClientSet)
assert.Nil(ginkgo.GinkgoT(), err, "obtaining NGINX Pod")
return pod.Status.PodIP
}
// GetURL returns the URL should be used to make a request to NGINX
@ -214,7 +205,7 @@ func (f *Framework) GetURL(scheme RequestScheme) string {
func (f *Framework) WaitForNginxServer(name string, matcher func(cfg string) bool) {
err := wait.Poll(Poll, DefaultTimeout, f.matchNginxConditions(name, matcher))
assert.Nil(ginkgo.GinkgoT(), err, "waiting for nginx server condition/s")
time.Sleep(5 * time.Second)
Sleep()
}
// WaitForNginxConfiguration waits until the nginx configuration contains a particular configuration
@ -334,13 +325,15 @@ func (f *Framework) SetNginxConfigMapData(cmData map[string]string) {
cfgMap.Data = cmData
_, err = f.KubeClientSet.
CoreV1().
ConfigMaps(f.Namespace).
Update(context.TODO(), cfgMap, metav1.UpdateOptions{})
assert.Nil(ginkgo.GinkgoT(), err, "updating configuration configmap")
fn := func() {
_, err = f.KubeClientSet.
CoreV1().
ConfigMaps(f.Namespace).
Update(context.TODO(), cfgMap, metav1.UpdateOptions{})
assert.Nil(ginkgo.GinkgoT(), err, "updating configuration configmap")
}
time.Sleep(5 * time.Second)
f.waitForReload(fn)
}
// CreateConfigMap creates a new configmap in the current namespace
@ -363,13 +356,60 @@ func (f *Framework) UpdateNginxConfigMapData(key string, value string) {
config.Data[key] = value
_, err = f.KubeClientSet.
CoreV1().
ConfigMaps(f.Namespace).
Update(context.TODO(), config, metav1.UpdateOptions{})
assert.Nil(ginkgo.GinkgoT(), err, "updating configuration configmap")
fn := func() {
_, err = f.KubeClientSet.
CoreV1().
ConfigMaps(f.Namespace).
Update(context.TODO(), config, metav1.UpdateOptions{})
assert.Nil(ginkgo.GinkgoT(), err, "updating configuration configmap")
}
time.Sleep(5 * time.Second)
Sleep(1)
f.waitForReload(fn)
}
func (f *Framework) waitForReload(fn func()) {
reloadCount := f.getReloadCount()
fn()
var count int
err := wait.Poll(Poll, DefaultTimeout, func() (bool, error) {
// most of the cases reload the ingress controller
// in cases where the value is not modified we could wait forever
if count > 4 {
return true, nil
}
count++
return (f.getReloadCount() > reloadCount), nil
})
assert.Nil(ginkgo.GinkgoT(), err, "while waiting for ingress controller reload")
}
func (f *Framework) getReloadCount() int {
ip := f.GetNginxPodIP()
mf, err := f.GetMetric("nginx_ingress_controller_success", ip)
assert.Nil(ginkgo.GinkgoT(), err)
assert.NotNil(ginkgo.GinkgoT(), mf)
rc0, err := extractReloadCount(mf)
assert.Nil(ginkgo.GinkgoT(), err)
return int(rc0)
}
func extractReloadCount(mf *dto.MetricFamily) (float64, error) {
vec, err := expfmt.ExtractSamples(&expfmt.DecodeOptions{
Timestamp: model.Now(),
}, mf)
if err != nil {
return 0, err
}
return float64(vec[0].Value), nil
}
// DeleteNGINXPod deletes the currently running pod. It waits for the replacement pod to be up.
@ -451,7 +491,7 @@ func UpdateDeployment(kubeClientSet kubernetes.Interface, namespace string, name
}
}
err = WaitForPodsReady(kubeClientSet, DefaultTimeout, replicas, namespace, metav1.ListOptions{
err = waitForPodsReady(kubeClientSet, DefaultTimeout, replicas, namespace, metav1.ListOptions{
LabelSelector: fields.SelectorFromSet(fields.Set(deployment.Spec.Template.ObjectMeta.Labels)).String(),
})
if err != nil {
@ -485,7 +525,7 @@ func UpdateIngress(kubeClientSet kubernetes.Interface, namespace string, name st
return err
}
time.Sleep(5 * time.Second)
Sleep()
return nil
}
@ -621,3 +661,18 @@ func newSingleIngress(name, ns string, annotations map[string]string, spec netwo
return ing
}
// defaultWaitDuration default sleep time for operations related
// to the API server and NGINX reloads.
var defaultWaitDuration = 5 * time.Second
// Sleep pauses the current goroutine for at least the duration d.
// If no duration is defined, it uses a default
func Sleep(duration ...time.Duration) {
sleepFor := defaultWaitDuration
if len(duration) != 0 {
sleepFor = duration[0]
}
time.Sleep(sleepFor)
}

View file

@ -75,7 +75,7 @@ func (f *Framework) NewNewGRPCFortuneTellerDeploymentWithReplicas(replicas int32
d := f.EnsureDeployment(deployment)
err := WaitForPodsReady(f.KubeClientSet, DefaultTimeout, int(replicas), f.Namespace, metav1.ListOptions{
err := waitForPodsReady(f.KubeClientSet, DefaultTimeout, int(replicas), f.Namespace, metav1.ListOptions{
LabelSelector: fields.SelectorFromSet(fields.Set(d.Spec.Template.ObjectMeta.Labels)).String(),
})
assert.Nil(ginkgo.GinkgoT(), err, "failed to wait for to become ready")

View file

@ -136,7 +136,7 @@ func (f *Framework) NewInfluxDBDeployment() {
d := f.EnsureDeployment(deployment)
err = WaitForPodsReady(f.KubeClientSet, DefaultTimeout, 1, f.Namespace, metav1.ListOptions{
err = waitForPodsReady(f.KubeClientSet, DefaultTimeout, 1, f.Namespace, metav1.ListOptions{
LabelSelector: fields.SelectorFromSet(fields.Set(d.Spec.Template.ObjectMeta.Labels)).String(),
})
assert.Nil(ginkgo.GinkgoT(), err, "waiting for influxdb pod to become ready")

View file

@ -72,18 +72,18 @@ func (f *Framework) GetIngress(namespace string, name string) *networking.Ingres
// EnsureIngress creates an Ingress object and retunrs it, throws error if it already exists.
func (f *Framework) EnsureIngress(ingress *networking.Ingress) *networking.Ingress {
err := createIngressWithRetries(f.KubeClientSet, f.Namespace, ingress)
assert.Nil(ginkgo.GinkgoT(), err, "creating ingress")
fn := func() {
err := createIngressWithRetries(f.KubeClientSet, f.Namespace, ingress)
assert.Nil(ginkgo.GinkgoT(), err, "creating ingress")
}
f.waitForReload(fn)
ing := f.GetIngress(f.Namespace, ingress.Name)
if ing.Annotations == nil {
ing.Annotations = make(map[string]string)
}
// creating an ingress requires a reload.
time.Sleep(5 * time.Second)
return ing
}
@ -93,13 +93,12 @@ func (f *Framework) UpdateIngress(ingress *networking.Ingress) *networking.Ingre
assert.Nil(ginkgo.GinkgoT(), err, "updating ingress")
ing := f.GetIngress(f.Namespace, ingress.Name)
if ing.Annotations == nil {
ing.Annotations = make(map[string]string)
}
// updating an ingress requires a reload.
time.Sleep(5 * time.Second)
Sleep()
return ing
}
@ -128,8 +127,8 @@ func (f *Framework) EnsureDeployment(deployment *appsv1.Deployment) *appsv1.Depl
return d
}
// WaitForPodsReady waits for a given amount of time until a group of Pods is running in the given namespace.
func WaitForPodsReady(kubeClientSet kubernetes.Interface, timeout time.Duration, expectedReplicas int, namespace string, opts metav1.ListOptions) error {
// waitForPodsReady waits for a given amount of time until a group of Pods is running in the given namespace.
func waitForPodsReady(kubeClientSet kubernetes.Interface, timeout time.Duration, expectedReplicas int, namespace string, opts metav1.ListOptions) error {
return wait.Poll(Poll, timeout, func() (bool, error) {
pl, err := kubeClientSet.CoreV1().Pods(namespace).List(context.TODO(), opts)
if err != nil {
@ -215,6 +214,13 @@ func podRunningReady(p *core.Pod) (bool, error) {
// GetIngressNGINXPod returns the ingress controller running pod
func GetIngressNGINXPod(ns string, kubeClientSet kubernetes.Interface) (*core.Pod, error) {
err := waitForPodsReady(kubeClientSet, DefaultTimeout, 1, ns, metav1.ListOptions{
LabelSelector: "app.kubernetes.io/name=ingress-nginx",
})
if err != nil {
return nil, err
}
l, err := kubeClientSet.CoreV1().Pods(ns).List(context.TODO(), metav1.ListOptions{
LabelSelector: "app.kubernetes.io/name=ingress-nginx",
})
@ -222,26 +228,15 @@ func GetIngressNGINXPod(ns string, kubeClientSet kubernetes.Interface) (*core.Po
return nil, nil
}
if len(l.Items) == 0 {
return nil, fmt.Errorf("there is no ingress-nginx pods running in namespace %v", ns)
}
var pod *core.Pod
for _, p := range l.Items {
if strings.HasPrefix(p.GetName(), "nginx-ingress-controller") {
if isRunning, err := podRunningReady(&p); err == nil && isRunning {
pod = &p
break
return &p, nil
}
}
}
if pod == nil {
return nil, fmt.Errorf("there is no ingress-nginx pods running in namespace %v", ns)
}
return pod, nil
return nil, fmt.Errorf("there is no ingress-nginx pods running in namespace %v", ns)
}
func createDeploymentWithRetries(c kubernetes.Interface, namespace string, obj *appsv1.Deployment) error {

View file

@ -32,21 +32,10 @@ type TestContextType struct {
// TestContext is the global client context for tests.
var TestContext TestContextType
// RegisterCommonFlags registers flags common to all e2e test suites.
func RegisterCommonFlags() {
// Turn on verbose by default to get spec names
config.DefaultReporterConfig.Verbose = true
// Turn on EmitSpecProgress to get spec progress (especially on interrupt)
// registerCommonFlags registers flags common to all e2e test suites.
func registerCommonFlags() {
config.GinkgoConfig.EmitSpecProgress = true
// Randomize specs as well as suites
config.GinkgoConfig.RandomizeAllSpecs = true
// Default SlowSpecThreshold is 5 seconds.
// Too low for the kind of operations we need to tests
config.DefaultReporterConfig.SlowSpecThreshold = 20
flag.StringVar(&TestContext.KubeHost, "kubernetes-host", "http://127.0.0.1:8080", "The kubernetes host, or apiserver, to connect to")
//flag.StringVar(&TestContext.KubeConfig, "kubernetes-config", os.Getenv(clientcmd.RecommendedConfigPathEnvVar), "Path to config containing embedded authinfo for kubernetes. Default value is from environment variable "+clientcmd.RecommendedConfigPathEnvVar)
flag.StringVar(&TestContext.KubeContext, "kubernetes-context", "", "config context to use for kubernetes. If unset, will use value from 'current-context'")
@ -54,6 +43,6 @@ func RegisterCommonFlags() {
// RegisterParseFlags registers and parses flags for the test binary.
func RegisterParseFlags() {
RegisterCommonFlags()
registerCommonFlags()
flag.Parse()
}

View file

@ -17,7 +17,7 @@ limitations under the License.
package framework
import (
context2 "context"
"context"
"fmt"
"os"
"time"
@ -93,8 +93,8 @@ func CreateKubeNamespace(baseName string, c kubernetes.Interface) (string, error
var got *corev1.Namespace
var err error
err = wait.PollImmediate(Poll, DefaultTimeout, func() (bool, error) {
got, err = c.CoreV1().Namespaces().Create(context2.TODO(), ns, metav1.CreateOptions{})
err = wait.Poll(Poll, DefaultTimeout, func() (bool, error) {
got, err = c.CoreV1().Namespaces().Create(context.TODO(), ns, metav1.CreateOptions{})
if err != nil {
Logf("Unexpected error while creating namespace: %v", err)
return false, nil
@ -107,11 +107,11 @@ func CreateKubeNamespace(baseName string, c kubernetes.Interface) (string, error
return got.Name, nil
}
// DeleteKubeNamespace deletes a namespace and all the objects inside
func DeleteKubeNamespace(c kubernetes.Interface, namespace string) error {
// deleteKubeNamespace deletes a namespace and all the objects inside
func deleteKubeNamespace(c kubernetes.Interface, namespace string) error {
grace := int64(0)
pb := metav1.DeletePropagationBackground
return c.CoreV1().Namespaces().Delete(context2.TODO(), namespace, metav1.DeleteOptions{
return c.CoreV1().Namespaces().Delete(context.TODO(), namespace, metav1.DeleteOptions{
GracePeriodSeconds: &grace,
PropagationPolicy: &pb,
})
@ -119,12 +119,12 @@ func DeleteKubeNamespace(c kubernetes.Interface, namespace string) error {
// WaitForKubeNamespaceNotExist waits until a namespaces is not present in the cluster
func WaitForKubeNamespaceNotExist(c kubernetes.Interface, namespace string) error {
return wait.PollImmediate(Poll, DefaultTimeout, namespaceNotExist(c, namespace))
return wait.Poll(Poll, DefaultTimeout, namespaceNotExist(c, namespace))
}
func namespaceNotExist(c kubernetes.Interface, namespace string) wait.ConditionFunc {
return func() (bool, error) {
_, err := c.CoreV1().Namespaces().Get(context2.TODO(), namespace, metav1.GetOptions{})
_, err := c.CoreV1().Namespaces().Get(context.TODO(), namespace, metav1.GetOptions{})
if apierrors.IsNotFound(err) {
return true, nil
}
@ -137,12 +137,12 @@ func namespaceNotExist(c kubernetes.Interface, namespace string) wait.ConditionF
// WaitForNoPodsInNamespace waits until there are no pods running in a namespace
func WaitForNoPodsInNamespace(c kubernetes.Interface, namespace string) error {
return wait.PollImmediate(Poll, DefaultTimeout, noPodsInNamespace(c, namespace))
return wait.Poll(Poll, DefaultTimeout, noPodsInNamespace(c, namespace))
}
func noPodsInNamespace(c kubernetes.Interface, namespace string) wait.ConditionFunc {
return func() (bool, error) {
items, err := c.CoreV1().Pods(namespace).List(context2.TODO(), metav1.ListOptions{})
items, err := c.CoreV1().Pods(namespace).List(context.TODO(), metav1.ListOptions{})
if apierrors.IsNotFound(err) {
return true, nil
}
@ -167,17 +167,17 @@ func WaitForPodRunningInNamespace(c kubernetes.Interface, pod *corev1.Pod) error
}
func waitTimeoutForPodRunningInNamespace(c kubernetes.Interface, podName, namespace string, timeout time.Duration) error {
return wait.PollImmediate(Poll, DefaultTimeout, podRunning(c, podName, namespace))
return wait.Poll(Poll, DefaultTimeout, podRunning(c, podName, namespace))
}
// WaitForSecretInNamespace waits a default amount of time for the specified secret is present in a particular namespace
func WaitForSecretInNamespace(c kubernetes.Interface, namespace, name string) error {
return wait.PollImmediate(Poll, DefaultTimeout, secretInNamespace(c, namespace, name))
return wait.Poll(Poll, DefaultTimeout, secretInNamespace(c, namespace, name))
}
func secretInNamespace(c kubernetes.Interface, namespace, name string) wait.ConditionFunc {
return func() (bool, error) {
s, err := c.CoreV1().Secrets(namespace).Get(context2.TODO(), name, metav1.GetOptions{})
s, err := c.CoreV1().Secrets(namespace).Get(context.TODO(), name, metav1.GetOptions{})
if apierrors.IsNotFound(err) {
return false, nil
}
@ -194,7 +194,7 @@ func secretInNamespace(c kubernetes.Interface, namespace, name string) wait.Cond
// WaitForFileInFS waits a default amount of time for the specified file is present in the filesystem
func WaitForFileInFS(file string) error {
return wait.PollImmediate(Poll, DefaultTimeout, fileInFS(file))
return wait.Poll(Poll, DefaultTimeout, fileInFS(file))
}
func fileInFS(file string) wait.ConditionFunc {
@ -218,12 +218,12 @@ func fileInFS(file string) wait.ConditionFunc {
// WaitForNoIngressInNamespace waits until there is no ingress object in a particular namespace
func WaitForNoIngressInNamespace(c kubernetes.Interface, namespace, name string) error {
return wait.PollImmediate(Poll, DefaultTimeout, noIngressInNamespace(c, namespace, name))
return wait.Poll(Poll, DefaultTimeout, noIngressInNamespace(c, namespace, name))
}
func noIngressInNamespace(c kubernetes.Interface, namespace, name string) wait.ConditionFunc {
return func() (bool, error) {
ing, err := c.NetworkingV1beta1().Ingresses(namespace).Get(context2.TODO(), name, metav1.GetOptions{})
ing, err := c.NetworkingV1beta1().Ingresses(namespace).Get(context.TODO(), name, metav1.GetOptions{})
if apierrors.IsNotFound(err) {
return true, nil
}
@ -240,12 +240,12 @@ func noIngressInNamespace(c kubernetes.Interface, namespace, name string) wait.C
// WaitForIngressInNamespace waits until a particular ingress object exists namespace
func WaitForIngressInNamespace(c kubernetes.Interface, namespace, name string) error {
return wait.PollImmediate(Poll, DefaultTimeout, ingressInNamespace(c, namespace, name))
return wait.Poll(Poll, DefaultTimeout, ingressInNamespace(c, namespace, name))
}
func ingressInNamespace(c kubernetes.Interface, namespace, name string) wait.ConditionFunc {
return func() (bool, error) {
ing, err := c.NetworkingV1beta1().Ingresses(namespace).Get(context2.TODO(), name, metav1.GetOptions{})
ing, err := c.NetworkingV1beta1().Ingresses(namespace).Get(context.TODO(), name, metav1.GetOptions{})
if apierrors.IsNotFound(err) {
return false, nil
}
@ -262,7 +262,7 @@ func ingressInNamespace(c kubernetes.Interface, namespace, name string) wait.Con
func podRunning(c kubernetes.Interface, podName, namespace string) wait.ConditionFunc {
return func() (bool, error) {
pod, err := c.CoreV1().Pods(namespace).Get(context2.TODO(), podName, metav1.GetOptions{})
pod, err := c.CoreV1().Pods(namespace).Get(context.TODO(), podName, metav1.GetOptions{})
if err != nil {
return false, nil
}