Skip to content

Commit d8ef764

Browse files
Add autoscaler yamls (#1030)
Signed-off-by: Arnob kumar saha <arnob@appscode.com>
1 parent a2b7b86 commit d8ef764

36 files changed

Lines changed: 532 additions & 115 deletions

File tree

charts/kubedbcom-cassandra-editor-options/values.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,5 +253,3 @@ form:
253253
enabled: true
254254
duration: "5m"
255255
severity: warning
256-
257-

charts/kubedbcom-druid-editor-options/values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,4 +316,3 @@ form:
316316
enabled: true
317317
duration: "0m"
318318
severity: critical
319-

charts/kubedbcom-elasticsearch-editor-options/values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,4 +429,3 @@ form:
429429
duration: "0m"
430430
val: 1800 # 30 minute
431431
severity: warning
432-
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{{- $hasMachines := gt (len .Values.spec.admin.machineProfiles.machines) 0 }}
2+
{{- $hasAvailable := gt (len .Values.spec.admin.machineProfiles.available) 0 }}
3+
{{- $commonCompute := dict
4+
"trigger" "Off"
5+
"podLifeTimeThreshold" "10m"
6+
"resourceDiffPercentage" 20
7+
}}
8+
{{- if $hasMachines }}
9+
{{- $_ := set $commonCompute "minAllowed" (dict
10+
"cpu" (index .Values.spec.admin.machineProfiles.machines 0).limits.cpu
11+
"memory" (index .Values.spec.admin.machineProfiles.machines 0).limits.memory
12+
) }}
13+
{{- $_ = set $commonCompute "maxAllowed" (dict
14+
"cpu" (index .Values.spec.admin.machineProfiles.machines (sub (len .Values.spec.admin.machineProfiles.machines) 1)).limits.cpu
15+
"memory" (index .Values.spec.admin.machineProfiles.machines (sub (len .Values.spec.admin.machineProfiles.machines) 1)).limits.memory
16+
) }}
17+
{{- else }}
18+
{{- $_ := set $commonCompute "minAllowed" (dict
19+
"cpu" "400m"
20+
"memory" "400Mi"
21+
) }}
22+
{{- $_ = set $commonCompute "maxAllowed" (dict
23+
"cpu" "1"
24+
"memory" "2Gi"
25+
) }}
26+
{{- end }}
27+
28+
{{- define "minmax-profiles" -}}
29+
{{- $validMachines := list }}
30+
{{- range $machine := .Values.spec.admin.machineProfiles.available }}
31+
{{- if ne $machine "custom" }}
32+
{{- $validMachines = append $validMachines $machine }}
33+
{{- end }}
34+
{{- end }}
35+
{{- $instanceStr := "" }}
36+
{{- if gt (len $validMachines) 0 }}
37+
{{- $minMachine := index $validMachines 0 }}
38+
{{- $maxMachine := index $validMachines (sub (len $validMachines) 1) }}
39+
{{- $instanceStr = printf "%s,%s" $minMachine $maxMachine }}
40+
{{- else }}
41+
{{- $instanceStr = "{}" }}
42+
{{- end }}
43+
{{- $instanceStr -}}
44+
{{- end }}
45+
46+
apiVersion: autoscaling.kubedb.com/v1alpha1
47+
kind: HanaDBAutoscaler
48+
metadata:
49+
name: {{ include "kubedbcom-hanadb-editor-options.fullname" . }}
50+
namespace: {{ .Release.Namespace }}
51+
labels:
52+
{{- include "kubedbcom-hanadb-editor-options.labels" . | nindent 4 }}
53+
{{- if $hasAvailable }}
54+
annotations:
55+
kubernetes.io/instance-type: {{ printf "%s" (include "minmax-profiles" .) | quote }}
56+
{{- end }}
57+
spec:
58+
databaseRef:
59+
name: {{ include "kubedbcom-hanadb-editor-options.fullname" . }}
60+
opsRequestOptions:
61+
timeout: 10m
62+
apply: IfReady
63+
compute:
64+
hanadb:
65+
{{- $commonCompute | toYaml | nindent 6 }}
66+
{{- if eq .Values.spec.admin.deployment.default "Dedicated" }}
67+
nodeTopology:
68+
name: {{ .Values.spec.admin.clusterTier.nodeTopology.default }}
69+
{{- else if $hasAvailable }}
70+
nodeTopology:
71+
name: kubedb-ui-machine-profiles
72+
{{- end }}

charts/kubedbcom-hanadb-editor-options/values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,4 +231,3 @@ form:
231231
enabled: true
232232
duration: "15m"
233233
severity: warning
234-
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{{- $hasMachines := gt (len .Values.spec.admin.machineProfiles.machines) 0 }}
2+
{{- $hasAvailable := gt (len .Values.spec.admin.machineProfiles.available) 0 }}
3+
{{- $commonCompute := dict
4+
"trigger" "Off"
5+
"podLifeTimeThreshold" "10m"
6+
"resourceDiffPercentage" 20
7+
}}
8+
{{- if $hasMachines }}
9+
{{- $_ := set $commonCompute "minAllowed" (dict
10+
"cpu" (index .Values.spec.admin.machineProfiles.machines 0).limits.cpu
11+
"memory" (index .Values.spec.admin.machineProfiles.machines 0).limits.memory
12+
) }}
13+
{{- $_ = set $commonCompute "maxAllowed" (dict
14+
"cpu" (index .Values.spec.admin.machineProfiles.machines (sub (len .Values.spec.admin.machineProfiles.machines) 1)).limits.cpu
15+
"memory" (index .Values.spec.admin.machineProfiles.machines (sub (len .Values.spec.admin.machineProfiles.machines) 1)).limits.memory
16+
) }}
17+
{{- else }}
18+
{{- $_ := set $commonCompute "minAllowed" (dict
19+
"cpu" "400m"
20+
"memory" "400Mi"
21+
) }}
22+
{{- $_ = set $commonCompute "maxAllowed" (dict
23+
"cpu" "1"
24+
"memory" "2Gi"
25+
) }}
26+
{{- end }}
27+
28+
{{- define "minmax-profiles" -}}
29+
{{- $validMachines := list }}
30+
{{- range $machine := .Values.spec.admin.machineProfiles.available }}
31+
{{- if ne $machine "custom" }}
32+
{{- $validMachines = append $validMachines $machine }}
33+
{{- end }}
34+
{{- end }}
35+
{{- $instanceStr := "" }}
36+
{{- if gt (len $validMachines) 0 }}
37+
{{- $minMachine := index $validMachines 0 }}
38+
{{- $maxMachine := index $validMachines (sub (len $validMachines) 1) }}
39+
{{- $instanceStr = printf "%s,%s" $minMachine $maxMachine }}
40+
{{- else }}
41+
{{- $instanceStr = "{}" }}
42+
{{- end }}
43+
{{- $instanceStr -}}
44+
{{- end }}
45+
46+
apiVersion: autoscaling.kubedb.com/v1alpha1
47+
kind: HazelcastAutoscaler
48+
metadata:
49+
name: {{ include "kubedbcom-hazelcast-editor-options.fullname" . }}
50+
namespace: {{ .Release.Namespace }}
51+
labels:
52+
{{- include "kubedbcom-hazelcast-editor-options.labels" . | nindent 4 }}
53+
{{- if $hasAvailable }}
54+
annotations:
55+
kubernetes.io/instance-type: {{ printf "%s" (include "minmax-profiles" .) | quote }}
56+
{{- end }}
57+
spec:
58+
databaseRef:
59+
name: {{ include "kubedbcom-hazelcast-editor-options.fullname" . }}
60+
opsRequestOptions:
61+
timeout: 10m
62+
apply: IfReady
63+
compute:
64+
hazelcast:
65+
{{- $commonCompute | toYaml | nindent 6 }}
66+
{{- if eq .Values.spec.admin.deployment.default "Dedicated" }}
67+
nodeTopology:
68+
name: {{ .Values.spec.admin.clusterTier.nodeTopology.default }}
69+
{{- else if $hasAvailable }}
70+
nodeTopology:
71+
name: kubedb-ui-machine-profiles
72+
{{- end }}

charts/kubedbcom-hazelcast-editor-options/values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,4 +278,3 @@ form:
278278
enabled: true
279279
duration: "0m"
280280
severity: critical
281-

charts/kubedbcom-ignite-editor-options/templates/binding.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.

charts/kubedbcom-ignite-editor-options/values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,4 +275,3 @@ form:
275275
enabled: true
276276
duration: "0m"
277277
severity: critical
278-

charts/kubedbcom-kafka-editor-options/values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,4 +336,3 @@ form:
336336
enabled: true
337337
duration: "0m"
338338
severity: critical
339-

0 commit comments

Comments
 (0)