Skip to content

Commit 6ef8029

Browse files
JoshVanLdapr-bot
andauthored
Hot Reload: Subscription (dapr#7583)
* Hot Reload: Subscription Adds support for Subscription Hot Reloading. If the Hot Reloading preview feature is enabled, create, update and delete events to declarative Subscriptions will be reflected in the Subscriptions runtime without needing to restart the Dapr runtime. Works in both self-hosted and Kubernetes modes. Note that, because topic routes and not indexed by Subscription resources, all Subscriptions will be cancelled and topic routes re-built and re-subscribed when a Subscription event occurs. A possible improvement would to only cancel all topic route subscriptions which are related to the Subscription pubsub or include an index of the Subscription which a topic is routed for, however this is out of scope of this change. Support for per topic route cancellation will be needed for on-demand bi-directional subscriptions. In-flight messages are not effected by Subscription hot reloading. Branched from dapr#7582 Closes dapr#7139 Signed-off-by: joshvanl <[email protected]> * Load all Subscriptions before reloading on boot Signed-off-by: joshvanl <[email protected]> * Adds unit tests for subscription client side scope filtering Signed-off-by: joshvanl <[email protected]> * Linting Signed-off-by: joshvanl <[email protected]> --------- Signed-off-by: joshvanl <[email protected]> Co-authored-by: Dapr Bot <[email protected]>
1 parent fa211af commit 6ef8029

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+4500
-1470
lines changed

dapr/proto/operator/v1/operator.proto

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ service Operator {
3434
rpc ListResiliency (ListResiliencyRequest) returns (ListResiliencyResponse) {}
3535
// Returns a list of pub/sub subscriptions, ListSubscriptionsRequest to expose pod info
3636
rpc ListSubscriptionsV2 (ListSubscriptionsRequest) returns (ListSubscriptionsResponse) {}
37+
// Sends events to Dapr sidecars upon subscription changes.
38+
rpc SubscriptionUpdate (SubscriptionUpdateRequest) returns (stream SubscriptionUpdateEvent) {}
3739
// Returns a list of http endpoints
3840
rpc ListHTTPEndpoints (ListHTTPEndpointsRequest) returns (ListHTTPEndpointsResponse) {}
3941
// Sends events to Dapr sidecars upon http endpoint changes.
@@ -97,6 +99,21 @@ message ListSubscriptionsResponse {
9799
repeated bytes subscriptions = 1;
98100
}
99101

102+
// SubscriptionUpdateRequest is the request to get updates about new
103+
// subscriptions for a given namespace.
104+
message SubscriptionUpdateRequest {
105+
string namespace = 1;
106+
string podName = 2;
107+
}
108+
109+
// SubscriptionUpdateEvent includes the updated subscription event.
110+
message SubscriptionUpdateEvent {
111+
bytes subscription = 1;
112+
113+
// type is the type of event.
114+
ResourceEventType type = 2;
115+
}
116+
100117
// GetResiliencyRequest is the request to get a resiliency configuration.
101118
message GetResiliencyRequest {
102119
string name = 1;

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require (
1313
github.com/cenkalti/backoff/v4 v4.2.1
1414
github.com/cloudevents/sdk-go/v2 v2.14.0
1515
github.com/dapr/components-contrib v1.13.0-rc.10
16-
github.com/dapr/kit v0.13.0
16+
github.com/dapr/kit v0.13.1-0.20240402103809-0c7cfce53d9e
1717
github.com/evanphx/json-patch/v5 v5.8.1
1818
github.com/go-chi/chi/v5 v5.0.11
1919
github.com/go-chi/cors v1.2.1
@@ -36,7 +36,7 @@ require (
3636
github.com/jackc/pgx/v5 v5.5.2
3737
github.com/jhump/protoreflect v1.15.2
3838
github.com/kelseyhightower/envconfig v1.4.0
39-
github.com/lestrrat-go/jwx/v2 v2.0.19
39+
github.com/lestrrat-go/jwx/v2 v2.0.20
4040
github.com/microsoft/durabletask-go v0.4.1-0.20240122160106-fb5c4c05729d
4141
github.com/mitchellh/mapstructure v1.5.1-0.20220423185008-bf980b35cac4
4242
github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,8 @@ github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuA
437437
github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0=
438438
github.com/dapr/components-contrib v1.13.0-rc.10 h1:d5xGjRAl2Gm23YsMfwa7Lwz5FFCb1ad4UqCmHTmtyV4=
439439
github.com/dapr/components-contrib v1.13.0-rc.10/go.mod h1:CFCvUwS2ClqTVyzfqHEGiXM3gftWOjOI73pxECoY/Iw=
440-
github.com/dapr/kit v0.13.0 h1:4S+5QqDCreva+MBONtIgxeg6B2b1W89bB8F5lqKgTa0=
441-
github.com/dapr/kit v0.13.0/go.mod h1:VyHrelNXPbtS/VcQX0Y/uzW0lfEVuveJ+1E5bDys8mo=
440+
github.com/dapr/kit v0.13.1-0.20240402103809-0c7cfce53d9e h1:mLvqfGuppb6uhsijmwTlF5sZVtGvig+Ua5ESKF17SxA=
441+
github.com/dapr/kit v0.13.1-0.20240402103809-0c7cfce53d9e/go.mod h1:dons8V2bF6MPR2yFdxtTa86PfaE7EJtKAOkZ9hOavBQ=
442442
github.com/dave/jennifer v1.4.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg=
443443
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
444444
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -1096,8 +1096,8 @@ github.com/lestrrat-go/iter v1.0.1/go.mod h1:zIdgO1mRKhn8l9vrZJZz9TUMMFbQbLeTsbq
10961096
github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI=
10971097
github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4=
10981098
github.com/lestrrat-go/jwx v1.2.24/go.mod h1:zoNuZymNl5lgdcu6P7K6ie2QRll5HVfF4xwxBBK1NxY=
1099-
github.com/lestrrat-go/jwx/v2 v2.0.19 h1:ekv1qEZE6BVct89QA+pRF6+4pCpfVrOnEJnTnT4RXoY=
1100-
github.com/lestrrat-go/jwx/v2 v2.0.19/go.mod h1:l3im3coce1lL2cDeAjqmaR+Awx+X8Ih+2k8BuHNJ4CU=
1099+
github.com/lestrrat-go/jwx/v2 v2.0.20 h1:sAgXuWS/t8ykxS9Bi2Qtn5Qhpakw1wrcjxChudjolCc=
1100+
github.com/lestrrat-go/jwx/v2 v2.0.20/go.mod h1:UlCSmKqw+agm5BsOBfEAbTvKsEApaGNqHAEUTv5PJC4=
11011101
github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I=
11021102
github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU=
11031103
github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I=

0 commit comments

Comments
 (0)