Skip to content

Commit ff9547a

Browse files
authored
Proposal update: Extend service invocation to non-Dapr endpoints #20 (#25)
* feat(secrets): update proposal crd to more easily work with secrets + examples Signed-off-by: Samantha Coyle <[email protected]> * style: rm unnecessary comment Signed-off-by: Samantha Coyle <[email protected]> * feat(crd): update resource specifications Signed-off-by: Samantha Coyle <[email protected]> * fix: address pr feedback Signed-off-by: Samantha Coyle <[email protected]> * docs: add clarity on order Signed-off-by: Samantha Coyle <[email protected]> --------- Signed-off-by: Samantha Coyle <[email protected]>
1 parent e3c0047 commit ff9547a

File tree

1 file changed

+38
-13
lines changed

1 file changed

+38
-13
lines changed

0006-B-external-service-invocation.md

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Cons:
8585

8686
How will this work, technically?
8787

88-
Allow configuration of pieces needed for external service invocation through creation of new CRD titled `ExternalHTTPEndpoint`.
88+
Allow configuration of pieces needed for external service invocation through creation of new CRD titled `HTTPEndpoint`.
8989
It is HTTP specific in it's `Kind`.
9090
This has benefits in being obvious upfront that it supports only `http`,
9191
and makes it to where we do not need `spec.allowed.protocols`.
@@ -94,30 +94,51 @@ The sample `yaml` file snippet below represents the proposed configuration.
9494

9595
```
9696
apiVersion: dapr.io/v1alpha1
97-
kind: ExternalHTTPEndpoint
97+
kind: HTTPEndpoint
9898
metadata:
99-
name: externalserviceinvocation
99+
name: "github"
100100
spec:
101-
allowed:
102-
- name: github
103-
baseUrl: "github.com"
104-
headers:
105-
- "Accept-Language": "en-US"
106-
metadata:
107-
- name: mymetadata
101+
baseUrl: "http://api.github.com"
102+
headers:
103+
- name: "Accept-Language"
104+
value: "en-US"
105+
- name: "Content-Type"
106+
value: "application/json"
107+
- name: "Authorization"
108108
secretKeyRef:
109-
name: my-secret
110-
key: mymetadataSecret
109+
name: "my-secret"
110+
key: "mymetadataSecret"
111111
auth:
112-
secretStore: my-secretstore
112+
secretStore: "my-secretstore"
113113
```
114114

115+
Noteworthy caveat:
116+
If `Authorization` header is specified,
117+
then it is assumed that the [auth-scheme](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization) prefix (ie token, basic, etc)
118+
is specified within the value for the `Authorization` header field.
119+
This allows for headers to match with the existing HTTP header schema,
120+
thus leading to a better user experience that is straightforward to use.
121+
115122
Implementation for external service invocation will sit alongside the existing service invocation building block implementation with API changes to support external invocation.
116123

117124
User facing changes include overriding the URL when calling Dapr for service invocation.
118125
Users will use the existing service invocation API, but instead of using an app ID,
119126
they can use an external URL and optionally overwrite fields at the time of invocation.
120127

128+
To summarize, there would be two ways of working with external service invocations:
129+
1. The URL format programatically.
130+
This allows for convenience and includes a single HTTP call.
131+
2. HTTPEndpoint resource creation declaratively,
132+
where the `HTTPEndpoint.Name` would be used as the AppId in the existing service invocation URL.
133+
134+
#### Examples
135+
136+
1. URL format overwritten:
137+
`http://localhost:${daprPort}/v1.0/invoke/http://api.github.com/method/`
138+
139+
2. HTTPEndpoint resource creation declaratively using the HTTPEndpoint resource definition above.
140+
`http://localhost:${daprPort}/v1.0/invoke/github/method/`
141+
121142

122143
### Feature lifecycle outline
123144

@@ -139,6 +160,10 @@ N/A
139160

140161
* Compabitility requirements
141162
This feature will need to be fully compatible with existing service invocation API.
163+
In the case that a user adds an `HTTPEndpoint` with the same name as an AppId in the same namespace and performs service invocation,
164+
then the `HTTPEndpoint` will be invoked.
165+
Calls for service invocation will first check if the AppId matches an `HTTPEndpoint` CRD,
166+
and in the case that it does, then external service invocation will occur.
142167

143168
* Metrics
144169
Existing service invocation tracing and metrics capabilities when calling external enpoints will be fully functional.

0 commit comments

Comments
 (0)