Skip to content

Commit 360defa

Browse files
Merge pull request #34178 from alex-hunt-materialize/fix_swap_enabled_overrides
fix swap_enabled overrides
2 parents a9993fe + 7b07173 commit 360defa

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

misc/helm-charts/operator/templates/_helpers.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ Helper template to process cluster sizes based on storage class configuration
114114
{{- $_ := set $newConfig "disk_limit" "0" }}
115115
{{- end }}
116116

117-
{{- if and ($.Values.operator.clusters.swap_enabled) (not (index $newConfig "swap_enabled")) }}
118-
{{- $_ := set $newConfig "swap_enabled" true }}
117+
{{- if not (hasKey $newConfig "swap_enabled") }}
118+
{{- $_ := set $newConfig "swap_enabled" $.Values.operator.clusters.swap_enabled }}
119119
{{- end }}
120120

121-
{{- if (not (index $newConfig "selectors")) }}
121+
{{- if (not (hasKey $newConfig "selectors")) }}
122122
{{- $_ := set $newConfig "selectors" dict }}
123123
{{- end }}
124124
{{- if $newConfig.swap_enabled }}

misc/helm-charts/operator/tests/deployment_test.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,28 @@ tests:
9797
path: spec.template.spec.containers[0].args[13]
9898
pattern: materialize.cloud/swap":"true"
9999

100+
- it: should handle default of swap_enabled, but some sizes without
101+
set:
102+
operator.clusters.sizes.mysize:
103+
swap_enabled: false
104+
workers: 1
105+
scale: 1
106+
cpu_exclusive: false
107+
cpu_limit: 0.1
108+
credits_per_hour: "0.00"
109+
disk_limit: "1552MiB"
110+
memory_limit: "776MiB"
111+
asserts:
112+
- matchRegex:
113+
path: spec.template.spec.containers[0].args[13]
114+
pattern: '"mysize":{"cpu_exclusive":false,"cpu_limit":0.1,"credits_per_hour":"0.00","disk_limit":"0","is_cc":true,"memory_limit":"776MiB","scale":1,"selectors":{},"swap_enabled":false,"workers":1}'
115+
- matchRegex:
116+
path: spec.template.spec.containers[0].args[13]
117+
pattern: swap_enabled":true
118+
- matchRegex:
119+
path: spec.template.spec.containers[0].args[13]
120+
pattern: materialize.cloud/swap":"true"
121+
100122
- it: should configure for AWS provider correctly
101123
set:
102124
operator.cloudProvider.type: "aws"

0 commit comments

Comments
 (0)