Skip to content

Commit

Permalink
fix: assign rule priority automatically to routing rule (#1390) (#1391)
Browse files Browse the repository at this point in the history
* assign rule priority

* skip rule with priority

* adding non-working tests

* find next free priority

* adjust jump; fix test

* remove comment

* add buffer to sig channel

Co-authored-by: Alex Z. Yang <[email protected]>

Co-authored-by: Alex Z. Yang <[email protected]>
  • Loading branch information
akshaysngupta and alxyzc authored May 6, 2022
1 parent 0a4f032 commit 78cb402
Show file tree
Hide file tree
Showing 24 changed files with 310 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cmd/appgw-ingress/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func main() {
klog.Fatal(errorLine)
}

sigChan := make(chan os.Signal)
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)
<-sigChan

Expand Down
2 changes: 1 addition & 1 deletion docs/setup/install-new.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ Values:
- `rbac.enabled`: Make sure to set this to true if you have a AKS cluster that is RBAC enabled.
Note on Identity: The `identityResourceID` and `identityClientID` are values that were created
during the [Create an Identity](https://github.com/Azure/application-gateway-kubernetes-ingress/blob/072626cb4e37f7b7a1b0c4578c38d1eadc3e8701/docs/setup/install-new.md#create-an-identity)
during the [Create an Identity](#create-an-identity)
steps, and could be obtained again using the following command:
```bash
Expand Down
1 change: 1 addition & 0 deletions functional_tests/cookie_name.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@
"httpListener": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/httpListeners/fl-e1903c8aa3446b7b3207aec6d6ecba8a"
},
"priority": 19500,
"ruleType": "PathBasedRouting",
"urlPathMap": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/urlPathMaps/url-e1903c8aa3446b7b3207aec6d6ecba8a"
Expand Down
2 changes: 2 additions & 0 deletions functional_tests/duplicate_ports.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@
"httpListener": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/httpListeners/fl-08ba2bb7da9df5927d900fca8ce96ba5"
},
"priority": 19000,
"redirectConfiguration": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/redirectConfigurations/sslr-fl-175bc9385b96d7116527143f35cdfdea"
},
Expand All @@ -217,6 +218,7 @@
"httpListener": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/httpListeners/fl-175bc9385b96d7116527143f35cdfdea"
},
"priority": 19005,
"ruleType": "Basic"
}
}
Expand Down
1 change: 1 addition & 0 deletions functional_tests/empty_cluster_with_private_ip.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
"httpListener": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/httpListeners/fl-ac133916d522c571f2d9ef8f3b8a25d3"
},
"priority": 19500,
"ruleType": "Basic"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@
"httpListener": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/httpListeners/fl-08ba2bb7da9df5927d900fca8ce96ba5"
},
"priority": 19000,
"ruleType": "PathBasedRouting",
"urlPathMap": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/urlPathMaps/url-08ba2bb7da9df5927d900fca8ce96ba5"
Expand All @@ -263,6 +264,7 @@
"httpListener": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/httpListeners/fl-175bc9385b96d7116527143f35cdfdea"
},
"priority": 19005,
"ruleType": "Basic"
}
}
Expand Down
2 changes: 2 additions & 0 deletions functional_tests/one_ingress_https_backend.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@
"httpListener": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/httpListeners/fl-c61dda7ff9748ec5f51989767db5afd0"
},
"priority": 19500,
"ruleType": "PathBasedRouting",
"urlPathMap": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/urlPathMaps/url-c61dda7ff9748ec5f51989767db5afd0"
Expand All @@ -212,6 +213,7 @@
"httpListener": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/httpListeners/fl-e1903c8aa3446b7b3207aec6d6ecba8a"
},
"priority": 19505,
"ruleType": "PathBasedRouting",
"urlPathMap": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/urlPathMaps/url-e1903c8aa3446b7b3207aec6d6ecba8a"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
"httpListener": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/httpListeners/fl-c61dda7ff9748ec5f51989767db5afd0"
},
"priority": 19500,
"ruleType": "PathBasedRouting",
"urlPathMap": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/urlPathMaps/url-c61dda7ff9748ec5f51989767db5afd0"
Expand Down
1 change: 1 addition & 0 deletions functional_tests/one_ingress_slash_nothing.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
"httpListener": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/httpListeners/fl-e1903c8aa3446b7b3207aec6d6ecba8a"
},
"priority": 19500,
"ruleType": "Basic"
}
}
Expand Down
1 change: 1 addition & 0 deletions functional_tests/one_ingress_slash_slashnothing.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
"httpListener": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/httpListeners/fl-e1903c8aa3446b7b3207aec6d6ecba8a"
},
"priority": 19500,
"ruleType": "PathBasedRouting",
"urlPathMap": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/urlPathMaps/url-e1903c8aa3446b7b3207aec6d6ecba8a"
Expand Down
1 change: 1 addition & 0 deletions functional_tests/one_ingress_with_multiple_path_rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"httpListener": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/httpListeners/fl-e1903c8aa3446b7b3207aec6d6ecba8a"
},
"priority": 19500,
"ruleType": "PathBasedRouting",
"urlPathMap": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/urlPathMaps/url-e1903c8aa3446b7b3207aec6d6ecba8a"
Expand Down
3 changes: 3 additions & 0 deletions functional_tests/three_ingresses.json
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@
"httpListener": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/httpListeners/fl-08ba2bb7da9df5927d900fca8ce96ba5"
},
"priority": 19000,
"redirectConfiguration": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/redirectConfigurations/sslr-fl-175bc9385b96d7116527143f35cdfdea"
},
Expand All @@ -324,6 +325,7 @@
"httpListener": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/httpListeners/fl-175bc9385b96d7116527143f35cdfdea"
},
"priority": 19005,
"ruleType": "Basic"
}
},
Expand All @@ -334,6 +336,7 @@
"httpListener": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/httpListeners/fl-e1903c8aa3446b7b3207aec6d6ecba8a"
},
"priority": 19500,
"ruleType": "PathBasedRouting",
"urlPathMap": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/urlPathMaps/url-e1903c8aa3446b7b3207aec6d6ecba8a"
Expand Down
2 changes: 2 additions & 0 deletions functional_tests/two_ingresses_same_domain_tls_notls.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@
"httpListener": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/httpListeners/fl-08ba2bb7da9df5927d900fca8ce96ba5"
},
"priority": 19000,
"ruleType": "PathBasedRouting",
"urlPathMap": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/urlPathMaps/url-08ba2bb7da9df5927d900fca8ce96ba5"
Expand All @@ -263,6 +264,7 @@
"httpListener": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/httpListeners/fl-175bc9385b96d7116527143f35cdfdea"
},
"priority": 19005,
"ruleType": "Basic"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
"httpListener": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/httpListeners/fl-08ba2bb7da9df5927d900fca8ce96ba5"
},
"priority": 19000,
"ruleType": "PathBasedRouting",
"urlPathMap": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/urlPathMaps/url-08ba2bb7da9df5927d900fca8ce96ba5"
Expand Down
1 change: 1 addition & 0 deletions functional_tests/two_ingresses_slash_slashsomething.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
"httpListener": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/httpListeners/fl-e1903c8aa3446b7b3207aec6d6ecba8a"
},
"priority": 19500,
"ruleType": "PathBasedRouting",
"urlPathMap": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/urlPathMaps/url-e1903c8aa3446b7b3207aec6d6ecba8a"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@
"httpListener": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/httpListeners/fl-ac80e40addbf0c0bac6b5c79b565a989"
},
"priority": 19000,
"ruleType": "PathBasedRouting",
"urlPathMap": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/urlPathMaps/url-ac80e40addbf0c0bac6b5c79b565a989"
Expand All @@ -233,6 +234,7 @@
"httpListener": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/httpListeners/fl-e1903c8aa3446b7b3207aec6d6ecba8a"
},
"priority": 19500,
"ruleType": "PathBasedRouting",
"urlPathMap": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/urlPathMaps/url-e1903c8aa3446b7b3207aec6d6ecba8a"
Expand Down
1 change: 1 addition & 0 deletions functional_tests/waf_annotation.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
"httpListener": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/httpListeners/fl-e1903c8aa3446b7b3207aec6d6ecba8a"
},
"priority": 19500,
"ruleType": "PathBasedRouting",
"urlPathMap": {
"id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/urlPathMaps/url-e1903c8aa3446b7b3207aec6d6ecba8a"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/knative/pkg v0.0.0-20190619032946-d90a9bc97dde
github.com/kylelemons/godebug v1.1.0
github.com/onsi/ginkgo v1.16.4
github.com/onsi/gomega v1.14.0
github.com/onsi/gomega v1.19.0
github.com/prometheus/client_golang v1.11.0
github.com/spf13/pflag v1.0.5
gopkg.in/yaml.v2 v2.4.0
Expand Down
Loading

0 comments on commit 78cb402

Please sign in to comment.