Skip to content

feat: Add HTTP support for External Auth#4994

Merged
skriss merged 3 commits intoprojectcontour:mainfrom
clayton-gonsalves:add-support-for-http-ext-auth
Mar 20, 2023
Merged

feat: Add HTTP support for External Auth#4994
skriss merged 3 commits intoprojectcontour:mainfrom
clayton-gonsalves:add-support-for-http-ext-auth

Conversation

@clayton-gonsalves
Copy link
Contributor

@clayton-gonsalves clayton-gonsalves commented Jan 23, 2023

This change adds external authorization support for HTTP upstreams.
Fixes: #4954

Signed-off-by: Clayton Gonsalves claytonivorgonsalves@gmail.com

@github-actions
Copy link

Hi @clayton-gonsalves! Welcome to our community and thank you for opening your first Pull Request. Someone will review it soon. Thank you for committing to making Contour better. You can also join us on our mailing list and in our channel in the Kubernetes Slack Workspace

@clayton-gonsalves clayton-gonsalves force-pushed the add-support-for-http-ext-auth branch from 0cb4efc to 384194a Compare February 1, 2023 16:10
@clayton-gonsalves clayton-gonsalves force-pushed the add-support-for-http-ext-auth branch from 384194a to 8b98559 Compare February 14, 2023 16:05
@clayton-gonsalves clayton-gonsalves changed the title WIP: Add HTTP support for External Auth feat: Add HTTP support for External Auth Feb 14, 2023
@clayton-gonsalves clayton-gonsalves marked this pull request as ready for review February 14, 2023 16:07
@clayton-gonsalves clayton-gonsalves requested a review from a team as a code owner February 14, 2023 16:07
@clayton-gonsalves clayton-gonsalves requested review from skriss and tsaarni and removed request for a team February 14, 2023 16:07
@clayton-gonsalves clayton-gonsalves force-pushed the add-support-for-http-ext-auth branch from 8b98559 to e68014c Compare February 14, 2023 16:13
@codecov
Copy link

codecov bot commented Feb 14, 2023

Codecov Report

Merging #4994 (dd6a8b5) into main (9890fe9) will decrease coverage by 0.16%.
The diff coverage is 70.51%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4994      +/-   ##
==========================================
- Coverage   78.02%   77.87%   -0.16%     
==========================================
  Files         138      138              
  Lines       17545    17677     +132     
==========================================
+ Hits        13690    13766      +76     
- Misses       3591     3646      +55     
- Partials      264      265       +1     
Impacted Files Coverage Δ
internal/dag/dag.go 96.64% <ø> (ø)
pkg/config/parameters.go 86.97% <ø> (ø)
cmd/contour/serve.go 20.92% <12.16%> (-1.35%) ⬇️
internal/dag/httpproxy_processor.go 92.52% <95.65%> (-0.05%) ⬇️
cmd/contour/servecontext.go 82.06% <100.00%> (+1.22%) ⬆️
internal/envoy/v3/listener.go 98.40% <100.00%> (ø)
internal/envoy/v3/route.go 77.27% <100.00%> (-0.07%) ⬇️
internal/xdscache/v3/listener.go 91.61% <100.00%> (+0.20%) ⬆️
internal/xdscache/v3/route.go 100.00% <100.00%> (ø)

@sunjayBhatia sunjayBhatia added the release-note/minor A minor change that needs about a paragraph of explanation in the release notes. label Feb 14, 2023
@clayton-gonsalves clayton-gonsalves force-pushed the add-support-for-http-ext-auth branch from d5b8150 to 1669f31 Compare February 20, 2023 14:48
@skriss
Copy link
Member

skriss commented Feb 22, 2023

@clayton-gonsalves just wanted to let you know I'm working through review here, but you may not see comments until next week. Thanks for the patience!

@clayton-gonsalves
Copy link
Contributor Author

clayton-gonsalves commented Feb 23, 2023

Thank you, @skriss.
I have started testing this fork already, would be really nice if you could call out any major flaws in my PR. Smaller comments can wait I suppose. Thanks :)

Copy link
Member

@skriss skriss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for the PR and the patience @clayton-gonsalves! Overall this looks good; I have some suggestions for simplifying a few things. I may have a few more minor comments down the road but I think this covers the bulk of the bigger stuff. Let me know if anything is unclear or doesn't make sense to you, happy to discuss more.

@sunjayBhatia sunjayBhatia self-requested a review February 27, 2023 23:01
@clayton-gonsalves clayton-gonsalves force-pushed the add-support-for-http-ext-auth branch from 440143e to 383d7e9 Compare March 2, 2023 11:49
@clayton-gonsalves
Copy link
Contributor Author

@skriss Thanks for the review; I have addressed all but one of the comments left by you. Happy to chat about the test case and how to address it.

@clayton-gonsalves clayton-gonsalves requested review from skriss and removed request for sunjayBhatia and tsaarni March 2, 2023 12:18
Copy link
Member

@skriss skriss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates @clayton-gonsalves, couple more comments

@clayton-gonsalves clayton-gonsalves requested a review from skriss March 3, 2023 13:23
@skriss skriss requested a review from sunjayBhatia March 3, 2023 19:12
@clayton-gonsalves clayton-gonsalves force-pushed the add-support-for-http-ext-auth branch 3 times, most recently from d294d8a to ce2aea7 Compare March 7, 2023 12:45
@clayton-gonsalves clayton-gonsalves requested review from skriss and removed request for sunjayBhatia March 7, 2023 18:37
@sunjayBhatia sunjayBhatia self-requested a review March 7, 2023 22:53
@skriss
Copy link
Member

skriss commented Mar 7, 2023

@clayton-gonsalves I'm going to take one more pass through this tomorrow but I think it's looking pretty good. @sunjayBhatia will take another look as well. Thanks again for all your work on this!

Copy link
Member

@sunjayBhatia sunjayBhatia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still running some stuff locally and reading tests but some small changes to make

@clayton-gonsalves clayton-gonsalves force-pushed the add-support-for-http-ext-auth branch from ce2aea7 to 14084c0 Compare March 8, 2023 18:13
@clayton-gonsalves clayton-gonsalves requested review from sunjayBhatia and removed request for skriss March 8, 2023 18:14
@skriss skriss mentioned this pull request Mar 8, 2023
Copy link
Member

@sunjayBhatia sunjayBhatia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some testing and doc nits but looks great overall!


### Overriding global external authorization for a virtual host

Sometimes you may want a different configuration than what is defined globally. To override the global external authorization, add the `authorization` block to your HTTPProxy as shown below
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe note here which things can be overridden by HTTP vs HTTPS vhosts (i.e. you can't change auth server on an HTTP vhost)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified the heading and added a note at the bottom of the section

@sunjayBhatia
Copy link
Member

should be able to merge main/rebase to fix spellcheck

@clayton-gonsalves clayton-gonsalves force-pushed the add-support-for-http-ext-auth branch from 14084c0 to 5a3a6d5 Compare March 10, 2023 14:17
Closes projectcontour#4954.

Signed-off-by: claytonig <claytonivorgonsalves@gmail.com>

Address review comments

Signed-off-by: claytonig <claytonivorgonsalves@gmail.com>
Signed-off-by: claytonig <claytonivorgonsalves@gmail.com>
Signed-off-by: claytonig <claytonivorgonsalves@gmail.com>
@clayton-gonsalves clayton-gonsalves force-pushed the add-support-for-http-ext-auth branch from 5a3a6d5 to dd6a8b5 Compare March 10, 2023 15:48
Copy link
Member

@skriss skriss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM, thanks for all the work on it @clayton-gonsalves! Will leave for @sunjayBhatia.

@skriss skriss merged commit fac6a99 into projectcontour:main Mar 20, 2023
yangyy93 pushed a commit to projectsesame/contour that referenced this pull request Mar 27, 2023
Support globally configuring an external auth
server which is enabled by default for all vhosts,
both HTTP and HTTPS.

Closes projectcontour#4954.

Signed-off-by: claytonig <claytonivorgonsalves@gmail.com>
yangyy93 pushed a commit to projectsesame/contour that referenced this pull request Mar 27, 2023
Support globally configuring an external auth
server which is enabled by default for all vhosts,
both HTTP and HTTPS.

Closes projectcontour#4954.

Signed-off-by: claytonig <claytonivorgonsalves@gmail.com>
Signed-off-by: yy <yang.yang@daocloud.io>
yangyy93 added a commit to projectsesame/contour that referenced this pull request Mar 27, 2023
Signed-off-by: yy <yang.yang@daocloud.io>

add some unit test

Signed-off-by: yy <yang.yang@daocloud.io>

git rebase

Signed-off-by: yy <yang.yang@daocloud.io>

expose configuration for envoy's RateLimitedAsResourceExhausted (projectcontour#4971)

The Rate Limit filter in Envoy translates a 429 HTTP response code
to UNAVAILABLE as specified in the gRPC mapping document, but Google recommends
translating it to RESOURCE_EXHAUSTED
(see https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md)

This commit introduces a new setting to allow contour to forward the same parameter
introduced in envoyproxy/envoy#4879

The default value is disabled to retain the original behaviour of returning UNAVAILABLE,
as changing it would be a breaking change.

Closes projectcontour#4901.

Signed-off-by: Víctor Roldán Betancort <vroldanbet@authzed.com>
Signed-off-by: yy <yang.yang@daocloud.io>

rebase

Signed-off-by: yy <yang.yang@daocloud.io>

update tracing config validate

Signed-off-by: yy <yang.yang@daocloud.io>

make generate

Signed-off-by: yy <yang.yang@daocloud.io>

add chengelog

Signed-off-by: yy <yang.yang@daocloud.io>

update make general

Signed-off-by: yy <yang.yang@daocloud.io>

goimport

Signed-off-by: yy <yang.yang@daocloud.io>

update tracing

Signed-off-by: yy <yang.yang@daocloud.io>

fix golint

Signed-off-by: yy <yang.yang@daocloud.io>

update test

Signed-off-by: yy <yang.yang@daocloud.io>

delete unused code

Signed-off-by: yy <yang.yang@daocloud.io>

delete error file

Signed-off-by: yy <yang.yang@daocloud.io>

update changelog

Signed-off-by: yy <yang.yang@daocloud.io>

fix some mistake

Signed-off-by: yy <yang.yang@daocloud.io>

feat: Add HTTP support for External Auth (projectcontour#4994)

Support globally configuring an external auth
server which is enabled by default for all vhosts,
both HTTP and HTTPS.

Closes projectcontour#4954.

Signed-off-by: claytonig <claytonivorgonsalves@gmail.com>
Signed-off-by: yy <yang.yang@daocloud.io>

refactor DAG and DAG consumers to support >2 Listeners (projectcontour#5128)

Updates projectcontour#4960.

Signed-off-by: Steve Kriss <krisss@vmware.com>
Signed-off-by: yy <yang.yang@daocloud.io>

resolve conflict

Signed-off-by: yy <yang.yang@daocloud.io>

fix

Signed-off-by: yy <yang.yang@daocloud.io>
yangyy93 added a commit to projectsesame/contour that referenced this pull request Mar 27, 2023
Signed-off-by: yy <yang.yang@daocloud.io>

add some unit test

Signed-off-by: yy <yang.yang@daocloud.io>

git rebase

Signed-off-by: yy <yang.yang@daocloud.io>

expose configuration for envoy's RateLimitedAsResourceExhausted (projectcontour#4971)

The Rate Limit filter in Envoy translates a 429 HTTP response code
to UNAVAILABLE as specified in the gRPC mapping document, but Google recommends
translating it to RESOURCE_EXHAUSTED
(see https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md)

This commit introduces a new setting to allow contour to forward the same parameter
introduced in envoyproxy/envoy#4879

The default value is disabled to retain the original behaviour of returning UNAVAILABLE,
as changing it would be a breaking change.

Closes projectcontour#4901.

Signed-off-by: Víctor Roldán Betancort <vroldanbet@authzed.com>
Signed-off-by: yy <yang.yang@daocloud.io>

rebase

Signed-off-by: yy <yang.yang@daocloud.io>

update tracing config validate

Signed-off-by: yy <yang.yang@daocloud.io>

make generate

Signed-off-by: yy <yang.yang@daocloud.io>

add chengelog

Signed-off-by: yy <yang.yang@daocloud.io>

update make general

Signed-off-by: yy <yang.yang@daocloud.io>

goimport

Signed-off-by: yy <yang.yang@daocloud.io>

update tracing

Signed-off-by: yy <yang.yang@daocloud.io>

fix golint

Signed-off-by: yy <yang.yang@daocloud.io>

update test

Signed-off-by: yy <yang.yang@daocloud.io>

delete unused code

Signed-off-by: yy <yang.yang@daocloud.io>

delete error file

Signed-off-by: yy <yang.yang@daocloud.io>

update changelog

Signed-off-by: yy <yang.yang@daocloud.io>

fix some mistake

Signed-off-by: yy <yang.yang@daocloud.io>

feat: Add HTTP support for External Auth (projectcontour#4994)

Support globally configuring an external auth
server which is enabled by default for all vhosts,
both HTTP and HTTPS.

Closes projectcontour#4954.

Signed-off-by: claytonig <claytonivorgonsalves@gmail.com>
Signed-off-by: yy <yang.yang@daocloud.io>

refactor DAG and DAG consumers to support >2 Listeners (projectcontour#5128)

Updates projectcontour#4960.

Signed-off-by: Steve Kriss <krisss@vmware.com>
Signed-off-by: yy <yang.yang@daocloud.io>

resolve conflict

Signed-off-by: yy <yang.yang@daocloud.io>

fix

Signed-off-by: yy <yang.yang@daocloud.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/minor A minor change that needs about a paragraph of explanation in the release notes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for external auth with HTTP virtual hosts

4 participants