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

Bug on version 1.7.0-rc1 when priority appgw.ingress.kubernetes.io/rule-priority annotation is added over a ingress with the annotation appgw.ingress.kubernetes.io/ssl-redirect: 'true' #1525

Open ravenmanco opened 1 year ago

ravenmanco commented 1 year ago

Describe the bug Using the new version prerelase 1.7.0-rc1 , when a Ingress yaml contains the annotation appgw.ingress.kubernetes.io/ssl-redirect:'true' and also the annotation appgw.ingress.kubernetes.io/rule-priority, the AppIngress controller pod creates 2 rules to the same Ingress one of them is related to the ssl redirect, and assign to both of them the same priority, throwing an exception like this:

Error processing event.network.ApplicationGatewaysClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="ApplicationGatewayRequestRoutingRulePriorityMustBeUnique" Message="Priority must be unique across all the request routing rules. Rules /subscriptions/2b611b67-0231-4acd-877d-f5b6a1bd30a8/resourceGroups/MC_kubernetes-RG_devopscluster_eastus/providers/Microsoft.Network/applicationGateways/ingress-appgateway-exams-helm/requestRoutingRules/rr-7781c7b093c8ca365142f464778663a3 and /subscriptions/2b611b67-0231-4acd-877d-f5b6a1bd30a8/resourceGroups/MC_kubernetes-RG_devopscluster_eastus/providers/Microsoft.Network/applicationGateways/ingress-appgateway-exams-helm/requestRoutingRules/rr-f047080adb94b1422b64527024594b0f cannot have the same priority 714." Details=[]

To Reproduce Steps to reproduce the behavior: Create an Ingress using both annotations described, setting the annotation appgw.ingress.kubernetes.io/ssl-redirect in true:

Example: apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: ingress-clr-preprodv2-ssl namespace: clr uid: e4c8df0e-da1e-4150-a2c2-795e9caf1ad0 resourceVersion: '109670000' generation: 1 creationTimestamp: '2023-03-27T13:37:30Z' annotations: appgw.ingress.kubernetes.io/rule-priority: '714' appgw.ingress.kubernetes.io/ssl-redirect: 'true' kubernetes.io/ingress.class: azure/application-gateway nginx.ingress.kubernetes.io/rewrite-target: / nginx.ingress.kubernetes.io/use-regex: 'true' spec: tls:

bamarch commented 1 year ago

I think this is a duplicate of https://github.com/Azure/application-gateway-kubernetes-ingress/issues/1515