-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathpatch-loadbalancer.yaml
42 lines (40 loc) · 1.1 KB
/
patch-loadbalancer.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
# Code generated by KubeVela templates. DO NOT EDIT.
apiVersion: core.oam.dev/v1beta1
kind: TraitDefinition
metadata:
annotations:
definition.oam.dev/description: "Create a LoadBalancer for the specified Pod."
name: patch-loadbalancer
spec:
appliesToWorkloads:
- microservice
schematic:
cue:
template: |-
outputs: loadbalancer: {
apiVersion: "v1"
kind: "Service"
metadata: {
name: context.name + "-external"
}
spec: {
type: "LoadBalancer"
selector: {
app: context.name
"app.oam.dev/appRevision": context.appRevision
}
ports: [{
port: parameter.servicePort
if parameter.containerPort != _|_ {
targetPort: parameter.containerPort
}
if parameter.containerPort == _|_ {
targetPort: parameter.servicePort
}
}]
}
}
parameter: {
servicePort: int
containerPort?: int
}