This repository has been archived by the owner on Aug 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
function-example.yaml
115 lines (115 loc) · 4.98 KB
/
function-example.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
---
apiVersion: functions.eigr.io/v1
kind: Function
metadata:
name: shopping-cart # Mandatory. Name of the function
# The namespace where the role will be deployed to the cluster.
# All proxies deployed in a given namespace form a cluster, that is, they are visible to each other.
# Proxies that exist in other namespaces are invisible to those in this namespace
namespace: default # Optional. Default namespace is "default"
spec:
backend:
image: cloudstateio/cloudstate-python-tck:latest # Mandatory
language: python # Optional. Default is none.This parameter is only used to define the defaults resource limits of a user container.
runtime: grpc # Optional. Default grpc. Currently only one `grpc` runtime is provided, in the future we will support webassembly/wasm runtimes
#cookie: "6eycE1E/S341t4Bcto262ffyFWklCWHQIKloJDJYR7Y=" # Cookie to authenticated with others functions in same namespace. Optional. Default is generated by operator.
features:
eventing: false # Optional. Default is false.
eventingMappings:
sources:
- name: shopping-cart-source
serviceName: ShoppingCart
rpcMethodName: AddItem
type: kafka
config:
url: kafka:9092
topic: shopping-cart-in-events
groupId: shopping-cart-group
credentials:
secrets: kafka-credentials-secret
# If the credentials are stored in a secret, the username and password are not needed.
username: kafka-user # Use only in local development
password: kafka-password # Use only in local development
sinks:
- name: shopping-cart-sink
serviceName: ShoppingCart
rpcMethodName: AddItem
type: rabbitmq
config:
url: rabbitmq:9092
topic: shopping-cart-out-events
credentials:
secrets: rabbitmq-credentials-secret
# If the credentials are stored in a secret, the username and password are not needed.
username: rabbitmq-user # Use only in local development
password: rabbitmq-password # Use only in local development
typeMappings: false # Optional. Default is false.
typeMappingsKeys:
- typeName: AddLineItem
persistentKey: user_id
- typeName: RemoveLineItem
persistentKey: user_id
- typeName: GetShoppingCart
persistentKey: user_id
httpTranscode: true # Optional. Default is false.
httpTranscodeMappings:
- serviceName: ShoppingCart
rpcMethodName: AddItem
path: /cart/{user_id}/items/add
method: POST
body: "*"
- serviceName: ShoppingCart
rpcMethodName: RemoveItem
path: /cart/{user_id}/items/{product_id}
method: DELETE
- serviceName: ShoppingCart
rpcMethodName: GetCart
path: /cart/{user_id}
method: GET
additionalBindings:
- path: /cart/{user_id}/items
method: GET
responseBody: "items"
expose:
method: ingress #ingress # Optional. Default is none. Supported values are: ingress, nodeport, loadbalancer
ingress:
className: nginx
host: shopping-cart.eigr.io # Mandatory
useTls: true # Optional. Default is false
tls:
secretName: shopping-cart-tls # Mandatory if "use-tls" is true. Name of the secret containing the TLS certificate. Defaults to the eigr-functions-tls
certManager:
clusterIssuer: eigr-functions-cluster-issuer # Mandatory
# cn: shopping-cart.eigr.io # Optional. Default is none
# duration: 2h # Optional. Default is none
# renewBefore: 1h # Optional. Default is none
# usages: # Optional. Default is none
# - "digital signature"
# - "key encipherment"
# - "server auth"
# http01IngressClass: nginx-ingress-controller # Optional. Default is none
# http01EditInplace: "true" # Optional. Default is none
#loadBalancer: # Optional. Default is none.
# port: 8080
# targetPort: 9000
#nodePort: # Optional. Default is none. Use this only in development.
# port: 8080
# targetPort: 9000
# nodePort: 30001
autoscaler: # Optional
strategy: hpa # Optional. For now, only hpa is supported
minReplicas: 1 # Optional. Default is 1
maxReplicas: 100 # Optional. Default is 100
averageCpuUtilizationPercentage: 80 # Optional. Default is 80
averageMemoryUtilizationValue: 100Mi # Optional. Default is 100Mi
resources: # Optional
requests:
cpu: 100m
memory: 100Mi
limits:
cpu: 100m
memory: 100Mi
portBindings: # Optional
type: grpc # uds, grpc
port: 8080 # 8080
socketPath: /var/run/eigr/functions.sock # Optional. Default is none. Only used if type is uds