-
Notifications
You must be signed in to change notification settings - Fork 1
/
httpapispec.yaml
52 lines (52 loc) · 1.48 KB
/
httpapispec.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Defines an "API" in Istio.
# An API identifies specific requests to services and binds API attributes
# and behavior to that request.
# In the definition below, we've defined an API named "helloworldapi" that defines
# an operation we've called "/hello" when a request calls: GET /hello.
# Then, in the binding, we've bound our API to the "helloworld" service.
# The result is that GET request to /hello on the helloworld service will be
# assigned the attributes and functions we define for the API.
# One key feature is being able to map an incoming API Key from a header or
# query parameter to the request.api_key
# This can be used to very specifically map requests to Apigee policies and
# analytics.
---
# Define an API
apiVersion: config.istio.io/v1alpha2
kind: HTTPAPISpec
metadata:
creationTimestamp: null
name: helloworldapi
namespace: default
spec:
apiKeys:
- query: apikey
- header: x-api-key
attributes:
attributes:
api.service:
stringValue: helloworld.default.svc.cluster.local
api.version:
stringValue: v1
patterns:
- attributes:
attributes:
api.operation:
stringValue: /hello
httpMethod: GET
uriTemplate: /hello
---
# Bind the API to a service
apiVersion: config.istio.io/v1alpha2
kind: HTTPAPISpecBinding
metadata:
creationTimestamp: null
name: helloworldapi-binding
namespace: default
spec:
api_specs:
- name: helloworldapi
namespace: default
services:
- name: httpbin
namespace: default