-
Notifications
You must be signed in to change notification settings - Fork 21
/
statefulset.yaml
282 lines (268 loc) · 9.8 KB
/
statefulset.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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "provider.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
app: {{ include "provider.fullname" . }}
{{- include "provider.labels" . | nindent 4 }}
spec:
replicas: 1
#strategy:
# type: OnDelete
serviceName: {{ include "provider.fullname" . }}
selector:
matchLabels:
app: {{ include "provider.fullname" . }}
{{- include "provider.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
checksum/cm-boot: {{ include (print $.Template.BasePath "/configmap-boot.yaml") . | sha256sum }}
checksum/cm-bidscripts: {{ include (print $.Template.BasePath "/configmap-bidscripts.yaml") . | sha256sum }}
labels:
app: {{ include "provider.fullname" . }}
{{- include "provider.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "provider.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
- name: init
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
command: ["/bin/bash", "/boot/init.sh"]
imagePullPolicy: {{ .Values.image.pullPolicy }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
env:
- name: AKASH_DEBUG
value: "{{ $.Values.debug }}"
##
# boot config
##
# location of key export. must contain two files:
#
# key.txt: exported wallet key
# key-pass.txt: password used to encrypt exported key
- name: AKASH_BOOT_KEYS
value: "/boot-keys"
##
# cosmos-sdk client config
##
- name: AKASH_HOME
value: "{{ .Values.home }}"
- name: AKASH_FROM
value: "{{ .Values.from }}"
- name: AKASH_NODE
value: "{{ .Values.node }}"
- name: AKASH_CHAIN_ID
value: "{{ .Values.chainid }}"
- name: AKASH_KEYRING_BACKEND
value: "{{ .Values.keyringbackend }}"
- name: AKASH_BROADCAST_MODE
value: "block"
- name: AKASH_YES
value: "true"
- name: AKASH_GAS_PRICES
value: "{{ .Values.gasprices }}"
- name: AKASH_GAS
value: "{{ .Values.gas }}"
- name: AKASH_GAS_ADJUSTMENT
value: "{{ .Values.gasadjustment }}"
- name: AKASH_LOG_LEVEL
value: "info"
ports:
- name: api
containerPort: 8443
protocol: TCP
volumeMounts:
- name: boot
mountPath: /boot
readOnly: true
- name: keys
mountPath: /boot-keys
readOnly: true
- name: provider-config-volume
mountPath: /config
- name: home
mountPath: "{{ .Values.home }}"
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
command: ["/bin/bash", "/boot/run.sh"]
imagePullPolicy: {{ .Values.image.pullPolicy }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
env:
- name: AKASH_DEBUG
value: "{{ $.Values.debug }}"
##
# boot config
##
# location of key export. must contain two files:
#
# key.txt: exported wallet key
# key-pass.txt: password used to encrypt exported key
- name: AKASH_BOOT_KEYS
value: "/boot-keys"
##
# cosmos-sdk client config
##
- name: AKASH_HOME
value: "{{ .Values.home }}"
- name: AKASH_FROM
value: "{{ .Values.from }}"
- name: AKASH_NODE
value: "{{ .Values.node }}"
- name: AKASH_CHAIN_ID
value: "{{ .Values.chainid }}"
- name: AKASH_KEYRING_BACKEND
value: "{{ .Values.keyringbackend }}"
- name: AKASH_BROADCAST_MODE
value: "block"
- name: AKASH_VERSION
value: "{{ .Values.image.tag | default .Chart.AppVersion }}"
- name: AKASH_YES
value: "true"
- name: AKASH_LOG_LEVEL
value: "info"
##
# akash-provider ip operator config
##
- name: AKASH_IP_OPERATOR
value: "{{ .Values.ipoperator }}"
##
# akash-provider config
##
- name: AKASH_DEPLOYMENT_INGRESS_DOMAIN
value: "ingress.{{ .Values.domain }}"
- name: DEPLOYMENT_NETWORK_POLICIES_ENABLED
value: "{{ .Values.deploymentnetworkpoliciesenabled }}"
- name: AKASH_DEPLOYMENT_INGRESS_STATIC_HOSTS
value: "true"
- name: AKASH_DEPLOYMENT_BLOCKED_HOSTNAMES
value: ""
- name: AKASH_CLUSTER_NODE_PORT_QUANTITY
value: "2500"
- name: AKASH_GAS_PRICES
value: "{{ .Values.gasprices }}"
- name: AKASH_GAS
value: "{{ .Values.gas }}"
- name: AKASH_GAS_ADJUSTMENT
value: "{{ .Values.gasadjustment }}"
# AKASH_CLUSTER_PUBLIC_HOSTNAME need to stay as this makes to
# 'akash provider lease-status` under the forwarded_ports (nodePorts).
# This is NOT used for connecting to K8s cluster itself (6443/tcp).
# akash-provider uses kubeconfig to connect to K8s cluster.
- name: AKASH_CLUSTER_PUBLIC_HOSTNAME
value: "provider.{{ .Values.domain }}"
- name: AKASH_BID_PRICE_STRATEGY
value: "{{ ternary "scale" "shellScript" (empty .Values.bidpricescript) }}"
{{ if .Values.bidpricescript }}
- name: AKASH_BID_PRICE_SCRIPT_PATH
value: "/bidscripts/price_script.sh"
{{- end }}
{{ if .Values.whitelist_url }}
- name: WHITELIST_URL
value: "{{ .Values.whitelist_url }}"
{{- end }}
{{ if .Values.debug_bid_script }}
- name: DEBUG_BID_SCRIPT
value: "{{ .Values.debug_bid_script }}"
{{- end }}
- name: AKASH_BID_PRICE_CPU_SCALE
value: "{{ .Values.bidpricecpuscale }}"
- name: AKASH_BID_PRICE_MEMORY_SCALE
value: "{{ .Values.bidpricememoryscale }}"
- name: AKASH_BID_PRICE_ENDPOINT_SCALE
value: "{{ .Values.bidpricendpointscale }}"
- name: AKASH_BID_PRICE_STORAGE_SCALE
value: "{{ .Values.bidpricestoragescale }}"
- name: AKASH_BID_PRICE_IP_SCALE
value: "{{ .Values.bidpriceipscale }}"
- name: AKASH_OVERCOMMIT_PCT_CPU
value: "{{ .Values.overcommit_pct_cpu }}"
- name: AKASH_OVERCOMMIT_PCT_MEM
value: "{{ .Values.overcommit_pct_mem }}"
- name: AKASH_OVERCOMMIT_PCT_STORAGE
value: "{{ .Values.overcommit_pct_storage }}"
- name: AKASH_CLUSTER_K8S
value: "true"
- name: KUBE_CONFIG
value: "{{ .Values.home }}/.kube/config"
- name: AKASH_DEPLOYMENT_RUNTIME_CLASS
value: "none"
- name: AKASH_WITHDRAWAL_PERIOD
value: "{{ .Values.withdrawalperiod }}"
- name: AKASH_MINIMUM_BALANCE
value: "{{ .Values.minimumbalance }}"
- name: AKASH_BID_DEPOSIT
value: "5000000uakt"
- name: LOG_RESTART_PATTERNS
value: "{{ .Values.log_restart_patterns }}"
ports:
- name: api
containerPort: 8443
protocol: TCP
livenessProbe:
exec:
command:
- sh
- -c
- |
grep -Eq "$LOG_RESTART_PATTERNS" /var/log/provider.log && exit 1 || :
initialDelaySeconds: 60
periodSeconds: 10
failureThreshold: 1
timeoutSeconds: 10
volumeMounts:
- name: boot
mountPath: /boot
readOnly: true
- name: bidscripts
mountPath: /bidscripts
readOnly: true
- name: keys
mountPath: /boot-keys
readOnly: true
- name: provider-config-volume
mountPath: /config
- name: home
mountPath: "{{ .Values.home }}"
volumes:
- name: boot
configMap:
name: {{ include "provider.fullname" . }}-boot
- name: bidscripts
configMap:
name: {{ include "provider.fullname" . }}-bidscripts
defaultMode: 0744
- name: keys
secret:
secretName: {{ include "provider.fullname" . }}-keys
- name: provider-config-volume
hostPath:
path: /root/.akash/k8s-config
type: DirectoryOrCreate
- name: home
emptyDir: {}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}