Azure / application-gateway-kubernetes-ingress

This is an ingress controller that can be run on Azure Kubernetes Service (AKS) to allow an Azure Application Gateway to act as the ingress for an AKS cluster.
https://azure.github.io/application-gateway-kubernetes-ingress
MIT License
677 stars 420 forks source link

Fix bug in determining frontend to use when no ingress is present on cluster #1538

Closed akshaysngupta closed 1 year ago

akshaysngupta commented 1 year ago

Checklist

Description

This PR fixes a bug which was introduced as part of changes to support Private Only Application Gateway.

When a cluster doesn't have any/valid ingresses, then AGIC adds a default listener to the AppGW as AppGW requires a listener. To select what frontend IP configuration to use, AGIC checks if

In following image, true corresponds to finding a private frontend. image

This was causing a panic as denoted in the attached issue. Because AGIC was looking for private IP instead public IP, it was returning nil and dereferencing that caused a panic.

To fix this, instead of passing a Boolean to look for public or private, we use FrontendType with value Public or Private. This will allow to reduce ambiguity and bugs in the future.

Multiple test files got updated due to this as AppGW resources are named using the listener struct hash. As this struct is now taking an enum instead of bool, it has changed hashes across multiple test files. Some places, it has the changes the order of rules in the array.

Fixes

1532

cloebig commented 1 year ago

Hello,

is the segmentation fault now fixed? And is there new Version for that ? I See only the 1.7.0 from 27 March 2023.