Skip to content
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

Hot Reloading: HTTP Middleware Reloading #7286

Merged
merged 6 commits into from Jan 26, 2024

Conversation

JoshVanL
Copy link
Contributor

Part of #1172
Branched from #7260

Adds support for HTTP middleware hot reloading.

PR adds support for HTTP middlewares to be dynamically updated. The HTTP
Middleware returns a middleware.HTTP pipleine built from a config spec.
This pipeline implements a single handler which it itself runs the spec
configured HTTP middleware chain. When a middleware Component is added
or removed, the HTTP middleware store is updated and both the HTTP
server and App HTTP channel's pipeline's chains are updated dynamically.

Like today, if a pipeline spec contains handlers whose names, version,
or type does not match that from the store, then the handler is skipped
for that chain. Pipeline handler order is preserved (i.e. reverse order).

The middleware store has been made generic so can be used in future for
planned gRPC middleware support.

Middleware init has been moved from the runtime channel manager to the
runtime processor init procedure to allow for dynamic loading. The
middleware HTTP manager is passed to the runtime processor to expose the
store, and relevant built pipelines passed to the HTTP app channel and
HTTP server.

Middleware integration tests has been added for daprd to check
functionality, ordering, and hotreloading,

Signed-off-by: joshvanl me@joshvanl.dev

@JoshVanL JoshVanL added the P0 label Dec 11, 2023
@JoshVanL JoshVanL added this to the v1.13 milestone Dec 11, 2023
Copy link

codecov bot commented Dec 11, 2023

Codecov Report

Attention: 24 lines in your changes are missing coverage. Please review.

Comparison is base (cc9d51e) 62.41% compared to head (5ed4391) 62.42%.
Report is 1 commits behind head on master.

Files Patch % Lines
pkg/runtime/runtime.go 40.00% 12 Missing ⚠️
pkg/runtime/channels/channels.go 16.66% 5 Missing ⚠️
pkg/runtime/wfengine/component.go 0.00% 4 Missing ⚠️
pkg/runtime/processor/middleware/middleware.go 88.23% 1 Missing and 1 partial ⚠️
pkg/channel/http/http_channel.go 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7286      +/-   ##
==========================================
+ Coverage   62.41%   62.42%   +0.01%     
==========================================
  Files         240      244       +4     
  Lines       22062    22125      +63     
==========================================
+ Hits        13769    13811      +42     
- Misses       7153     7175      +22     
+ Partials     1140     1139       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JoshVanL JoshVanL removed the P0 label Dec 11, 2023
@JoshVanL JoshVanL force-pushed the hot-reloading-components-middleware branch from 58ae82e to 5f54ae6 Compare January 9, 2024 14:48
@JoshVanL JoshVanL marked this pull request as ready for review January 9, 2024 14:48
@JoshVanL JoshVanL requested review from a team as code owners January 9, 2024 14:48
@JoshVanL JoshVanL added the autoupdate DaprBot will keep the Pull Request up to date with master branch label Jan 10, 2024
@JoshVanL JoshVanL force-pushed the hot-reloading-components-middleware branch from ad10c8a to e40f04a Compare January 14, 2024 16:47
@JoshVanL JoshVanL mentioned this pull request Jan 18, 2024
@JoshVanL JoshVanL force-pushed the hot-reloading-components-middleware branch from 2ef1713 to 9c4cee4 Compare January 18, 2024 19:39
JoshVanL and others added 6 commits January 25, 2024 19:55
Part of dapr#1172
Branched from dapr#7260

Adds support for HTTP middleware hot reloading.

PR adds support for HTTP middlewares to be dynamically updated. The HTTP
Middleware returns a middleware.HTTP pipleine built from a config spec.
This pipeline implements a single handler which it itself runs the spec
configured HTTP middleware chain. When a middleware Component is added
or removed, the HTTP middleware store is updated and both the HTTP
server and App HTTP channel's pipeline's chains are updated dynamically.

Like today, if a pipeline spec contains handlers whose names, version,
or type does not match that from the store, then the handler is skipped
for that chain. Pipeline handler order is preserved (i.e. reverse order).

The middleware store has been made generic so can be used in future for
planned gRPC middleware support.

Middleware init has been moved from the runtime channel manager to the
runtime processor init procedure to allow for dynamic loading. The
middleware HTTP manager is passed to the runtime processor to expose the
store, and relevant built pipelines passed to the HTTP app channel and
HTTP server.

Middleware integration tests has been added for daprd to check
functionality, ordering, and hotreloading,

Signed-off-by: joshvanl <me@joshvanl.dev>
Co-authored-by: Loong Dai <long0dai@foxmail.com>
Signed-off-by: Josh van Leeuwen <me@joshvanl.dev>
Signed-off-by: joshvanl <me@joshvanl.dev>
Signed-off-by: joshvanl <me@joshvanl.dev>
Signed-off-by: joshvanl <me@joshvanl.dev>
metadata component checks

Signed-off-by: joshvanl <me@joshvanl.dev>
@JoshVanL JoshVanL force-pushed the hot-reloading-components-middleware branch from ddd2069 to 5ed4391 Compare January 25, 2024 20:05
@artursouza artursouza merged commit 3eef69f into dapr:master Jan 26, 2024
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autoupdate DaprBot will keep the Pull Request up to date with master branch
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants