Skip to content

Commit

Permalink
Fixed more tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
pantierra committed Feb 6, 2025
1 parent f5ef8c5 commit 91c83da
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
16 changes: 14 additions & 2 deletions helm-chart/eoapi/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,23 @@ so we use this helper function to check autoscaling rules
{{- define "eoapi.validateAutoscaleRules" -}}
{{- if and .Values.ingress.enabled (ne .Values.ingress.className "nginx") }}
{{/* "requestRate" cannot be enabled for any service if not "nginx" so give feedback and fail */}}
{{- 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")) ) }}
{{- $hasRequestRate := false }}
{{- range $serviceName, $service := .Values.externalServices }}
{{- if and $service.autoscaling.enabled (eq $service.autoscaling.type "requestRate") }}
{{- $hasRequestRate = true }}
{{- end }}
{{- end }}
{{- if $hasRequestRate }}
{{- 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" }}
{{- end }}
{{/* "both" cannot be enabled for any service if not "nginx" so give feedback and fail */}}
{{- 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")) ) }}
{{- $hasBoth := false }}
{{- range $serviceName, $service := .Values.externalServices }}
{{- if and $service.autoscaling.enabled (eq $service.autoscaling.type "both") }}
{{- $hasBoth = true }}
{{- end }}
{{- end }}
{{- if $hasBoth }}
{{- 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" }}
{{- end }}
{{- end }}
Expand Down
24 changes: 12 additions & 12 deletions helm-chart/eoapi/tests/ingress_tests_nginx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ templates:
tests:
- it: "vector ingress defaults"
set:
ingress.className: "nginx"
raster.enabled: false
stac.enabled: false
vector.enabled: true
externalServices.ingress.className: "nginx"
externalServices.raster.enabled: false
externalServices.stac.enabled: false
externalServices.vector.enabled: true
asserts:
- isKind:
of: Ingress
Expand All @@ -26,10 +26,10 @@ tests:
value: "nginx"
- it: "raster ingress defaults"
set:
ingress.className: "nginx"
raster.enabled: true
stac.enabled: false
vector.enabled: false
externalServices.ingress.className: "nginx"
externalServices.raster.enabled: true
externalServices.stac.enabled: false
externalServices.vector.enabled: false
asserts:
- isKind:
of: Ingress
Expand All @@ -48,10 +48,10 @@ tests:
value: "nginx"
- it: "stac ingress defaults"
set:
ingress.className: "nginx"
raster.enabled: false
stac.enabled: true
vector.enabled: false
externalServices.ingress.className: "nginx"
externalServices.raster.enabled: false
externalServices.stac.enabled: true
externalServices.vector.enabled: false
asserts:
- isKind:
of: Ingress
Expand Down

0 comments on commit 91c83da

Please sign in to comment.