Skip to content

Commit

Permalink
Update Ingress status
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacome committed Jan 11, 2023
1 parent f8fc99c commit c38353a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions internal/k8s/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type statusUpdater struct {
bigIPAddress string
bigIPPorts string
externalEndpoints []conf_v1.ExternalEndpoint
status []api_v1.LoadBalancerIngress
status []networking.IngressLoadBalancerIngress
statusInitialized bool
keyFunc func(obj interface{}) (string, error)
namespacedInformers map[string]*namespacedInformer
Expand Down Expand Up @@ -96,7 +96,7 @@ func (su *statusUpdater) UpdateExternalEndpointsForResource(r Resource) error {

// ClearIngressStatus clears the Ingress status.
func (su *statusUpdater) ClearIngressStatus(ing networking.Ingress) error {
return su.updateIngressWithStatus(ing, []api_v1.LoadBalancerIngress{})
return su.updateIngressWithStatus(ing, []networking.IngressLoadBalancerIngress{})
}

// UpdateIngressStatus updates the status on the selected Ingress.
Expand Down Expand Up @@ -126,7 +126,7 @@ func (su *statusUpdater) getNamespacedInformer(ns string) *namespacedInformer {
}

// updateIngressWithStatus sets the provided status on the selected Ingress.
func (su *statusUpdater) updateIngressWithStatus(ing networking.Ingress, status []api_v1.LoadBalancerIngress) error {
func (su *statusUpdater) updateIngressWithStatus(ing networking.Ingress, status []networking.IngressLoadBalancerIngress) error {
// Get an up-to-date Ingress from the Store
key, err := su.keyFunc(&ing)
if err != nil {
Expand Down Expand Up @@ -212,12 +212,12 @@ func (su *statusUpdater) retryStatusUpdate(clientIngress typednetworking.Ingress
// saveStatus saves the string array of IPs or addresses that we will set as status
// on all the Ingresses that we manage.
func (su *statusUpdater) saveStatus(ips []string) {
statusIngs := []api_v1.LoadBalancerIngress{}
statusIngs := []networking.IngressLoadBalancerIngress{}
for _, ip := range ips {
if net.ParseIP(ip) == nil {
statusIngs = append(statusIngs, api_v1.LoadBalancerIngress{Hostname: ip})
statusIngs = append(statusIngs, networking.IngressLoadBalancerIngress{Hostname: ip})
} else {
statusIngs = append(statusIngs, api_v1.LoadBalancerIngress{IP: ip})
statusIngs = append(statusIngs, networking.IngressLoadBalancerIngress{IP: ip})
}
}
su.status = statusIngs
Expand Down Expand Up @@ -664,7 +664,7 @@ func (su *statusUpdater) updateVirtualServerRouteExternalEndpoints(vsr *conf_v1.
return err
}

func (su *statusUpdater) generateExternalEndpointsFromStatus(status []api_v1.LoadBalancerIngress) []conf_v1.ExternalEndpoint {
func (su *statusUpdater) generateExternalEndpointsFromStatus(status []networking.IngressLoadBalancerIngress) []conf_v1.ExternalEndpoint {
var externalEndpoints []conf_v1.ExternalEndpoint
for _, lb := range status {
ports := su.externalServicePorts
Expand Down
12 changes: 6 additions & 6 deletions internal/k8s/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ func TestStatusUpdateWithExternalStatusAndExternalService(t *testing.T) {
Namespace: "namespace",
},
Status: networking.IngressStatus{
LoadBalancer: v1.LoadBalancerStatus{
Ingress: []v1.LoadBalancerIngress{
LoadBalancer: networking.IngressLoadBalancerStatus{
Ingress: []networking.IngressLoadBalancerIngress{
{
IP: "1.2.3.4",
},
Expand Down Expand Up @@ -299,8 +299,8 @@ func TestStatusUpdateWithExternalStatusAndIngressLink(t *testing.T) {
Namespace: "namespace",
},
Status: networking.IngressStatus{
LoadBalancer: v1.LoadBalancerStatus{
Ingress: []v1.LoadBalancerIngress{
LoadBalancer: networking.IngressLoadBalancerStatus{
Ingress: []networking.IngressLoadBalancerIngress{
{
IP: "1.2.3.4",
},
Expand Down Expand Up @@ -409,7 +409,7 @@ func TestGenerateExternalEndpointsFromStatus(t *testing.T) {
}{
{
su: statusUpdater{
status: []v1.LoadBalancerIngress{
status: []networking.IngressLoadBalancerIngress{
{
IP: "8.8.8.8",
},
Expand All @@ -421,7 +421,7 @@ func TestGenerateExternalEndpointsFromStatus(t *testing.T) {
},
{
su: statusUpdater{
status: []v1.LoadBalancerIngress{
status: []networking.IngressLoadBalancerIngress{
{
Hostname: "my-loadbalancer.example.com",
},
Expand Down

0 comments on commit c38353a

Please sign in to comment.