-
Notifications
You must be signed in to change notification settings - Fork 3.4k
api: Allow middleware to be injected via Hive #29223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This allows other Makefiles in the tree to pull in those definitions if they also want to invoke Swagger. There is one functional change too: Instead of using CURDIR, we're now using ROOT_DIR in the container volume mount. This has no impact for the existing code (where CURDIR == ROOT_DIR), but allows Makefiles in subdirectories to mount the full Go module (instead of just their subdirectory), which is needed for Swagger code gen. Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
This comment was marked as resolved.
This comment was marked as resolved.
This commit extends the Cilium API server cell with the ability to inject a global middleware. The middleware injected here is a global executed after the middlewares injected by `setupGlobalMiddleware`, but before the API method dispatch. See [1] for more details. This allows the Hive-injected middleware to benefit from global middleware handlers such as our panic and metrics handlers, but before any swagger specific handlers are called. The middleware is optional, as it is intended to be used for out-of-tree API implementations. The middleware parameter is named, so it only applies to a particular OpenAPI spec, thereby allowing for specialization of that API. [1] https://goswagger.io/use/middleware.html Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
This commit makes the API basepath configurable. This is useful to build clients where the API is accessed via a reverse proxy. Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
9918581
to
02c313e
Compare
This comment was marked as resolved.
This comment was marked as resolved.
/test Edit:
|
/ci-eks |
aanm
approved these changes
Nov 20, 2023
mhofstetter
approved these changes
Nov 20, 2023
mhofstetter
reviewed
Nov 20, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/daemon
Impacts operation of the Cilium daemon.
area/modularization
Relates to code modularization and maintenance.
ready-to-merge
This PR has passed all tests and received consensus from code owners to merge.
release-note/misc
This PR makes changes that have no direct user impact.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR extends the Cilium API server cell with the ability to inject a global middleware. The middleware injected here is a global executed after the middlewares injected by
setupGlobalMiddleware
, but before the API method dispatch. See [1] for more details.This allows the Hive-injected middleware to benefit from global middleware handlers such as our panic and metrics handlers, but before any swagger specific handlers are called. The middleware is optional, as it is intended to be used for out-of-tree API implementations. The middleware parameter is named, so it only applies to a particular
OpenAPI spec, thereby allowing for specialization of that API.
[1] https://goswagger.io/use/middleware.html
The other two commits in this PR are quality-of-life improvements for users with custom API extensions.