Skip to content

Commit 91c83da

Browse files
committed
Fixed more tests.
1 parent f5ef8c5 commit 91c83da

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

helm-chart/eoapi/templates/_helpers.tpl

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,23 @@ so we use this helper function to check autoscaling rules
159159
{{- define "eoapi.validateAutoscaleRules" -}}
160160
{{- if and .Values.ingress.enabled (ne .Values.ingress.className "nginx") }}
161161
{{/* "requestRate" cannot be enabled for any service if not "nginx" so give feedback and fail */}}
162-
{{- if (or (and .Values.raster.autoscaling.enabled (eq .Values.raster.autoscaling.type "requestRate")) (and .Values.stac.autoscaling.enabled (eq .Values.stac.autoscaling.type "requestRate")) (and .Values.vector.autoscaling.enabled (eq .Values.vector.autoscaling.type "requestRate")) ) }}
162+
{{- $hasRequestRate := false }}
163+
{{- range $serviceName, $service := .Values.externalServices }}
164+
{{- if and $service.autoscaling.enabled (eq $service.autoscaling.type "requestRate") }}
165+
{{- $hasRequestRate = true }}
166+
{{- end }}
167+
{{- end }}
168+
{{- if $hasRequestRate }}
163169
{{- fail "When using an 'ingress.className' other than 'nginx' you cannot enable autoscaling by 'requestRate' at this time b/c it's solely an nginx metric" }}
164170
{{- end }}
165171
{{/* "both" cannot be enabled for any service if not "nginx" so give feedback and fail */}}
166-
{{- if (or (and .Values.raster.autoscaling.enabled (eq .Values.raster.autoscaling.type "both")) (and .Values.stac.autoscaling.enabled (eq .Values.stac.autoscaling.type "both")) (and .Values.vector.autoscaling.enabled (eq .Values.vector.autoscaling.type "both")) ) }}
172+
{{- $hasBoth := false }}
173+
{{- range $serviceName, $service := .Values.externalServices }}
174+
{{- if and $service.autoscaling.enabled (eq $service.autoscaling.type "both") }}
175+
{{- $hasBoth = true }}
176+
{{- end }}
177+
{{- end }}
178+
{{- if $hasBoth }}
167179
{{- fail "When using an 'ingress.className' other than 'nginx' you cannot enable autoscaling by 'both' at this time b/c 'requestRate' is solely an nginx metric" }}
168180
{{- end }}
169181
{{- end }}

helm-chart/eoapi/tests/ingress_tests_nginx.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ templates:
44
tests:
55
- it: "vector ingress defaults"
66
set:
7-
ingress.className: "nginx"
8-
raster.enabled: false
9-
stac.enabled: false
10-
vector.enabled: true
7+
externalServices.ingress.className: "nginx"
8+
externalServices.raster.enabled: false
9+
externalServices.stac.enabled: false
10+
externalServices.vector.enabled: true
1111
asserts:
1212
- isKind:
1313
of: Ingress
@@ -26,10 +26,10 @@ tests:
2626
value: "nginx"
2727
- it: "raster ingress defaults"
2828
set:
29-
ingress.className: "nginx"
30-
raster.enabled: true
31-
stac.enabled: false
32-
vector.enabled: false
29+
externalServices.ingress.className: "nginx"
30+
externalServices.raster.enabled: true
31+
externalServices.stac.enabled: false
32+
externalServices.vector.enabled: false
3333
asserts:
3434
- isKind:
3535
of: Ingress
@@ -48,10 +48,10 @@ tests:
4848
value: "nginx"
4949
- it: "stac ingress defaults"
5050
set:
51-
ingress.className: "nginx"
52-
raster.enabled: false
53-
stac.enabled: true
54-
vector.enabled: false
51+
externalServices.ingress.className: "nginx"
52+
externalServices.raster.enabled: false
53+
externalServices.stac.enabled: true
54+
externalServices.vector.enabled: false
5555
asserts:
5656
- isKind:
5757
of: Ingress

0 commit comments

Comments
 (0)