Skip to content

Commit

Permalink
Merge branch 'next' into release-test-latest
Browse files Browse the repository at this point in the history
  • Loading branch information
shaneutt authored Jul 30, 2021
2 parents 4957870 + e135f44 commit 5fb8fd7
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions internal/ctrlutils/ingress-status.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/kong/deck/file"
"github.com/prometheus/common/log"
apiv1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
Expand Down Expand Up @@ -144,6 +145,10 @@ func UpdateIngressV1(ctx context.Context, logger logr.Logger, svc file.FService,
for retry < statusUpdateRetry {
curIng, err := ingCli.Get(ctx, name, metav1.GetOptions{})
if err != nil || curIng == nil {
if errors.IsNotFound(err) {
return nil
}

log.Errorf("failed to fetch Ingress %v/%v: %v. retrying...", namespace, name, err)
retry++
time.Sleep(time.Second)
Expand All @@ -166,6 +171,10 @@ func UpdateIngressV1(ctx context.Context, logger logr.Logger, svc file.FService,
if err == nil {
break
}
if errors.IsNotFound(err) {
return nil
}

log.Errorf("failed to update Ingress V1 status. %v. retrying...", err)
time.Sleep(time.Second)
retry++
Expand All @@ -189,6 +198,10 @@ func UpdateUDPIngress(ctx context.Context, logger logr.Logger, svc file.FService
for retry < statusUpdateRetry {
curIng, err := ingCli.Get(ctx, name, metav1.GetOptions{})
if err != nil || curIng == nil {
if errors.IsNotFound(err) {
return nil
}

log.Errorf("failed to fetch UDP Ingress %v/%v: %v", namespace, name, err)
time.Sleep(time.Second)
retry++
Expand All @@ -211,6 +224,10 @@ func UpdateUDPIngress(ctx context.Context, logger logr.Logger, svc file.FService
if err == nil {
break
}
if errors.IsNotFound(err) {
return nil
}

log.Errorf("failed to update UDPIngress status: %v. retry...", err)
time.Sleep(time.Second)
retry++
Expand All @@ -232,6 +249,10 @@ func UpdateTCPIngress(ctx context.Context, logger logr.Logger, svc file.FService
ingCli := kiccli.ConfigurationV1beta1().TCPIngresses(namespace)
curIng, err := ingCli.Get(ctx, name, metav1.GetOptions{})
if err != nil || curIng == nil {
if errors.IsNotFound(err) {
return nil
}

return fmt.Errorf("failed to fetch TCP Ingress %v/%v: %w", namespace, name, err)
}

Expand All @@ -248,6 +269,10 @@ func UpdateTCPIngress(ctx context.Context, logger logr.Logger, svc file.FService
curIng.Status.LoadBalancer.Ingress = status
_, err = ingCli.UpdateStatus(ctx, curIng, metav1.UpdateOptions{})
if err != nil {
if errors.IsNotFound(err) {
return nil
}

return fmt.Errorf("failed to update TCPIngress status: %v", err)
}
}
Expand Down Expand Up @@ -277,6 +302,10 @@ func UpdateKnativeIngress(ctx context.Context, logger logr.Logger, svc file.FSer
for retry < statusUpdateRetry {
curIng, err := ingClient.Get(ctx, name, metav1.GetOptions{})
if err != nil || curIng == nil {
if errors.IsNotFound(err) {
return nil
}

log.Errorf("failed to fetch Knative Ingress %v/%v: %v", namespace, name, err)
time.Sleep(time.Second)
retry++
Expand Down Expand Up @@ -310,6 +339,10 @@ func UpdateKnativeIngress(ctx context.Context, logger logr.Logger, svc file.FSer
if err == nil {
break
}
if errors.IsNotFound(err) {
return nil
}

log.Errorf("failed to update ingress status: %v. retrying...", err)
time.Sleep(time.Second)
retry++
Expand Down

0 comments on commit 5fb8fd7

Please sign in to comment.