Add support for HTTP External Authorization Services - #7418
Conversation
47679b5 to
4651b0c
Compare
Signed-off-by: therealak12 <ak12hastam@gmail.com>
4651b0c to
e0bce55
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #7418 +/- ##
==========================================
+ Coverage 81.85% 82.32% +0.47%
==========================================
Files 130 130
Lines 15747 15789 +42
==========================================
+ Hits 12889 12998 +109
+ Misses 2574 2505 -69
- Partials 284 286 +2
🚀 New features to boost your workflow:
|
tsaarni
left a comment
There was a problem hiding this comment.
Thank you @therealak12 for the contribution!
The changes look good overall but I would like to discuss some of the API aspects and potential error scenarios.
| // HttpAuthorizationServerSettings defines configurations for interacting with an external HTTP authorization server. | ||
| // | ||
| // +optional | ||
| HTTPServerSettings *contour_v1.HTTPAuthorizationServerSettings `json:"httpSettings,omitempty"` |
There was a problem hiding this comment.
Config file is parsed as YAML
| HTTPServerSettings *contour_v1.HTTPAuthorizationServerSettings `json:"httpSettings,omitempty"` | |
| HTTPServerSettings *contour_v1.HTTPAuthorizationServerSettings `yaml:"httpSettings,omitempty"` |
| switch contourConfiguration.GlobalExternalAuthorization.ServiceAPIType { | ||
| case contour_v1.AuthorizationGRPCService: | ||
| globalExternalAuthConfig.ServiceAPIType = contour_v1.AuthorizationGRPCService |
There was a problem hiding this comment.
Should we have fall back to the gRPC authorization server type here if type is not set?
| AuthorizationResponseTimeout: *respTimeout, | ||
| } | ||
|
|
||
| switch auth.ServiceAPIType { |
There was a problem hiding this comment.
We should refactor the switch-case logic in internal/dag/httpproxy_processor.go within computeVirtualHostAuthorization() and the corresponding logic in cmd/contour/serve.go within setupGlobalExternalAuthentication() into one.
|
@therealak12 I did some experiments related to my previous comments. You are free to use any of this work: snapp-incubator/contour@http-ext-authz...Nordix:contour:http-based-ext-authz |
|
The Contour project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to the #contour channel in the Kubernetes Slack |
Signed-off-by: therealak12 <ak12hastam@gmail.com>
|
Hi, thank you for your review and the helpful suggestions. Apologies for the delay. Due to the recent war affecting my country, I was unable to continue working on this PR for some time. Now that the situation has stabilized, I applied the requested changes. Please take another look when you have a chance. |
|
The Contour project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to the #contour channel in the Kubernetes Slack |
|
/remove-lifecycle-stale |
…imeout and its tests Signed-off-by: Tero Saarni <tero.saarni@est.tech>
Hi @therealak12, You are right, sorry it was broken. I have now re-implemented it and pushed update here Nordix@19757e6. |
Signed-off-by: Tero Saarni <tero.saarni@est.tech>
Thanks. I've pushed your commits to our branch as-is. Meanwhile, I'm reviewing the rest of the PR to ensure all the changes are aligned with the original intent. |
|
Thanks @therealak12! By the way, the e2e test case is something I was experimenting yesterday as I thought e2e coverage would be good, because this functionality is quite sensitive. Previously, we tested the gRPC-based external authorization using a separate server image deployed on a Kind cluster. However, I think it would be unnecessarily complicated to introduce that. Instead we can configure Envoy to connect to the host via a
|
8c7dd93 to
19757e6
Compare
|
I reviewed the code. The local http-server idea is cool. I pushed the e2e test commit again. |
Signed-off-by: Tero Saarni <tero.saarni@est.tech>
|
Hi @therealak12, could you still apply this formatting fix Nordix@b53f49d |
Hi. Done. Sorry, I must have already done that. |
|
Please feel free to make any changes to this code as you see fit. I'll also check my email more frequently to take any necessary actions. |
tsaarni
left a comment
There was a problem hiding this comment.
Thank You for contributing @therealak12 !

Envoy external authorization filter supports HTTP and GRPC servers. Contour only supports configuring gRPC services at the moment. The PR adds support for HTTP ext-authz services.
We've been using this in production for >1 year.
Closes #6509