|
| 1 | +# Add Config to Disable Sidecar Requests to /dapr/config and /dapr/subscribe |
| 2 | + |
| 3 | +* Author(s): Tom Flenner |
| 4 | +* State: Waiting for approval to start implementation |
| 5 | +* Updated: 20250611 |
| 6 | + |
| 7 | +## Overview |
| 8 | + |
| 9 | +This proposal introduces a new configuration option that allows disabling automatic HTTP requests to `/dapr/config` and `/dapr/subscribe` during Dapr sidecar initialization. |
| 10 | + |
| 11 | +Areas affected: |
| 12 | + |
| 13 | +>/area runtime |
| 14 | +
|
| 15 | +>/area docs |
| 16 | +
|
| 17 | +What is being proposed: |
| 18 | + |
| 19 | +Based on Josh van Leeuwen thoughts : |
| 20 | + |
| 21 | +Add support for a new `--disable-init-endpoints` flag in `dapr run`, as well as a corresponding `dapr.io/disable-init-endpoints annotation`. This flag will accept a string slice of endpoints (e.g., `["config", "subscribe"]`) to disable the automatic loading behavior per sidecar instance. |
| 22 | + |
| 23 | +## Background |
| 24 | + |
| 25 | +Dapr makes automatic HTTP requests to `/dapr/config` and `/dapr/subscribe` endpoints during initialization. While this behavior is helpful for applications relying on programmatic configuration or subscriptions, it introduces several issues for applications that do not use these features: |
| 26 | + |
| 27 | +- Log Noise: Unnecessary requests produce warning logs, leading to confusion for developers who do not expect or understand these failures. |
| 28 | + |
| 29 | +- Unexpected Failures: Under certain network conditions or misconfigured routes, these automatic requests can block declarative subscriptions from being loaded correctly. This results in broken functionality even though the app only intends to use declarative configuration. |
| 30 | + |
| 31 | +As such, it is desirable to make these behaviors configurable and opt-in to better support a variety of deployment and usage patterns. |
| 32 | + |
| 33 | +## Related Items |
| 34 | + |
| 35 | +### Related proposals |
| 36 | +N/A |
| 37 | + |
| 38 | +### Related issues |
| 39 | +https://github.com/dapr/dapr/issues/8224 |
| 40 | + |
| 41 | +## Expectations and alternatives |
| 42 | + |
| 43 | +#### In Scope |
| 44 | +- New CLI flag: `--disable-init-endpoints` (string slice, e.g., `--disable-init-endpoints=subscribe,config`) |
| 45 | +- New sidecar annotation: `dapr.io/disable-init-endpoints: "subscribe,config"` |
| 46 | +- Runtime logic to skip calling `/dapr/subscribe` and/or `/dapr/config` as configured |
| 47 | +- Documentation updates to describe new options |
| 48 | + |
| 49 | +#### Not In Scope |
| 50 | +- Granular error handling improvements beyond skipping the calls |
| 51 | + |
| 52 | +#### Alternative |
| 53 | +- Separate booleans for each endpoint: leads to flag sprawl, harder to maintain. |
| 54 | +- No change |
| 55 | + |
| 56 | +#### Trade -offs |
| 57 | +- N/A |
| 58 | + |
| 59 | +## Implementation Details |
| 60 | + |
| 61 | +### Design |
| 62 | + |
| 63 | +A new CLI flag and annotation will be introduced. Internally, the Dapr runtime will check this configuration before sending requests to the respective endpoints. |
| 64 | + |
| 65 | +Example CLI usage: |
| 66 | +```bash |
| 67 | +dapr run --app-id myapp --disable-init-endpoints=subscribe,config |
| 68 | +``` |
| 69 | + |
| 70 | +Example sidecar annotation: |
| 71 | +```yaml |
| 72 | +annotations: |
| 73 | + dapr.io/disable-init-endpoints: "subscribe,config" |
| 74 | +``` |
| 75 | +
|
| 76 | +In the Dapr runtime, this will translate into logic similar to: |
| 77 | +```go |
| 78 | +if disabledEndpoints.Has("config") { |
| 79 | + return |
| 80 | +} |
| 81 | +if disabledEndpoints.Has("subscribe") { |
| 82 | + return |
| 83 | +} |
| 84 | +``` |
| 85 | + |
| 86 | + |
| 87 | +### Feature lifecycle outline |
| 88 | + |
| 89 | +- Initial implementation will allow opt-out behavior only. |
| 90 | +- Backward-compatible: default behavior remains unchanged (both endpoints enabled). |
| 91 | +- No deprecation is required. |
| 92 | + |
| 93 | +### Acceptance Criteria |
| 94 | + |
| 95 | +- CLI and annotation config are both supported. |
| 96 | +- Behavior is clearly documented and default behavior remains unchanged. |
| 97 | +- Sidecars correctly skip calls based on configuration. |
| 98 | +- Unit tests added for new logic paths. |
| 99 | + |
| 100 | +## Completion Checklist |
| 101 | + |
| 102 | +What changes or actions are required to make this proposal complete? Some examples: |
| 103 | + |
| 104 | +- [ ] Code changes to runtime |
| 105 | +- [ ] CLI support for --disable-init-endpoints |
| 106 | +- [ ] Sidecar annotation parsing |
| 107 | +- [ ] Unit and integration tests |
| 108 | +- [ ] Documentation updates (CLI, annotations, init behavior) |
| 109 | +- [ ] Changelog and release notes |
| 110 | + |
| 111 | +Release Note: |
| 112 | +``` |
| 113 | +dapr runtime: Added `--disable-init-endpoints` flag and `dapr.io/disable-init-endpoints` annotation to optionally disable automatic requests to /dapr/config and /dapr/subscribe during sidecar startup. Useful for apps that rely solely on declarative config and subscriptions. |
| 114 | +``` |
0 commit comments