This repository has been archived by the owner on Jan 29, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathbroker.yaml
204 lines (203 loc) · 6.03 KB
/
broker.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
{{ $randomString := randAlphaNum 5 | quote -}}
apiVersion: v1
kind: Service
metadata:
labels:
service: {{ .Release.Name }}-broker
name: {{ .Release.Name }}-broker-service
namespace: {{ .Release.Namespace }}
spec:
type: {{ .Values.broker.service.type }}
ports:
- name: http
port: 80
targetPort: broker-internal
- name: https
port: 443
targetPort: broker-internal
selector:
app: {{ .Release.Name }}-broker
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
labels:
service: {{ .Release.Name }}-broker
{{- if .Values.cluster.ssl }}
garden.sapcloud.io/purpose: managed-cert
{{- end }}
name: {{ .Release.Name }}-broker-service-ingress
namespace: {{ .Release.Namespace }}
spec:
rules:
- host: {{ .Values.cluster.host }}
http:
paths:
- backend:
serviceName: {{ .Release.Name }}-broker-service
servicePort: 80
{{- if .Values.cluster.ssl }}
tls:
- hosts:
- {{ .Values.cluster.host }}
secretName: {{ .Values.cluster.sslsecret }}
{{- end }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-broker
labels:
app: {{ .Release.Name }}-broker
spec:
replicas: {{ default .Values.replicaCount .Values.broker.replicaCount }}
selector:
matchLabels:
app: {{ .Release.Name }}-broker
template:
metadata:
labels:
app: {{ .Release.Name }}-broker
rollme: {{ $randomString }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 6 }}
{{- end }}
topologySpreadConstraints:
- maxSkew: 1
topologyKey: topology.kubernetes.io/zone
whenUnsatisfiable: ScheduleAnyway
labelSelector:
matchLabels:
app: {{ .Release.Name }}-broker
rollme: {{ $randomString }}
containers:
- name: broker
image: "{{ .Values.broker.image.repository }}:{{ .Values.broker.image.tag }}"
imagePullPolicy: {{ .Values.broker.image.pullPolicy }}
ports:
- name: broker-internal
containerPort: {{ .Values.broker.port }}
protocol: TCP
env:
- name: NODE_ENV
value: kubernetes
- name: SETTINGS_PATH
value: /opt/sf-config/settings.yml
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: BROKER_USERNAME
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-creds
key: broker_username
- name: BROKER_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-creds
key: broker_password
- name: QUOTA_APP_USERNAME
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-creds
key: quota_app_username
- name: QUOTA_APP_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-creds
key: quota_app_password
{{- if .Values.broker.quota.username }}
- name: QUOTA_USERNAME
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-creds
key: quota_username
{{- end }}
{{- if .Values.broker.quota.password }}
- name: QUOTA_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-creds
key: quota_password
{{- end }}
volumeMounts:
- name: settings
mountPath: /opt/sf-config
livenessProbe:
failureThreshold: 3
httpGet:
path: /
port: 9293
scheme: HTTP
initialDelaySeconds: 30
periodSeconds: 60
successThreshold: 1
timeoutSeconds: 1
readinessProbe:
failureThreshold: 3
httpGet:
path: /
port: 9293
scheme: HTTP
initialDelaySeconds: 30
periodSeconds: 60
successThreshold: 1
timeoutSeconds: 1
args:
- applications/osb-broker/src/server.js
command:
- node
{{- $resourceSpec := dict }}
{{- with .Values.broker.resources }}
{{- $resourceSpec = deepCopy . }}
{{- end }}
{{- if not (empty $resourceSpec) }}
{{- tpl (.Files.Get "conf/resources.yaml") (merge $resourceSpec .) | nindent 8 }}
{{- end }}
volumes:
- name: settings
configMap:
name: sf-settings-config
restartPolicy: Always
---
{{- if .Values.broker.hpa.enabled }}
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: {{ .Release.Name }}-broker
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ .Release.Name }}-broker
minReplicas: {{ default .Values.replicaCount .Values.broker.replicaCount }}
maxReplicas: {{ .Values.broker.hpa.maxReplicas }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.broker.hpa.cpu_threshold }}
behavior:
scaleUp:
selectPolicy: {{ .Values.broker.hpa.scaleUp.selectPolicy }}
stabilizationWindowSeconds: {{ .Values.broker.hpa.scaleUp.stabilizationWindowSeconds }}
policies:
- type: Percent
value: {{ .Values.broker.hpa.scaleUp.policies.percent.value }}
periodSeconds: {{ .Values.broker.hpa.scaleUp.policies.percent.periodSeconds }}
- type: Pods
value: {{ .Values.broker.hpa.scaleUp.policies.pods.value }}
periodSeconds: {{ .Values.broker.hpa.scaleUp.policies.pods.periodSeconds }}
scaleDown:
selectPolicy: {{ .Values.broker.hpa.scaleDown.selectPolicy }}
stabilizationWindowSeconds: {{ .Values.broker.hpa.scaleDown.stabilizationWindowSeconds }}
policies:
- type: Percent
value: {{ .Values.broker.hpa.scaleDown.policies.percent.value }}
periodSeconds: {{ .Values.broker.hpa.scaleDown.policies.percent.periodSeconds }}
{{- end }}