From 3b66fb07fa765ab0067cf8fb227182af35be9c94 Mon Sep 17 00:00:00 2001 From: ranchodeluxe Date: Wed, 22 Nov 2023 06:55:31 -0800 Subject: [PATCH] tests and releases --- .github/workflows/release.yml | 2 +- helm-chart/eoapi/CHANGELOG.md | 5 ++++ helm-chart/eoapi/Chart.yaml | 4 +-- helm-chart/eoapi/templates/_helpers.tpl | 25 ++++++++++++++++--- .../tests/autoscaling_feedback_alb_tests.yaml | 24 ++++++++++++++++++ .../tests/autoscaling_feedback_gce_tests.yaml | 24 ++++++++++++++++++ helm-chart/eoapi/tests/hpa_tests.yaml | 7 +++--- 7 files changed, 81 insertions(+), 10 deletions(-) create mode 100644 helm-chart/eoapi/tests/autoscaling_feedback_alb_tests.yaml create mode 100644 helm-chart/eoapi/tests/autoscaling_feedback_gce_tests.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d31dc21..205f015 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,7 @@ on: jobs: release: - if: github.actor == 'ranchodeluxe' || github.actor == 'gcorradini' + if: github.actor == 'ranchodeluxe' || github.actor == 'gcorradini' || github.actor == 'sunu' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/helm-chart/eoapi/CHANGELOG.md b/helm-chart/eoapi/CHANGELOG.md index a1cffc4..219d160 100644 --- a/helm-chart/eoapi/CHANGELOG.md +++ b/helm-chart/eoapi/CHANGELOG.md @@ -1,5 +1,10 @@ version numbers below correspond to helm chart `appVersion`: see `./helm-chart/eoapi/Chart.yaml` --- +### 0.2.10 (2023-11-22) + +* give `ingress.className == "nginx"` the ability pass hosts and tls information +* more tests to give user feedback about the above functionality if the wrong `ingress.className` was given + ### 0.2.9 (2023-10-25) * removed `providerContext` and any support for minikube from the templates so this is a breaking change diff --git a/helm-chart/eoapi/Chart.yaml b/helm-chart/eoapi/Chart.yaml index 6b17a02..17a5442 100644 --- a/helm-chart/eoapi/Chart.yaml +++ b/helm-chart/eoapi/Chart.yaml @@ -17,10 +17,10 @@ kubeVersion: ">=1.23.0-0" # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: "0.1.11" +version: "0.1.12" # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "0.2.9" +appVersion: "0.2.10" diff --git a/helm-chart/eoapi/templates/_helpers.tpl b/helm-chart/eoapi/templates/_helpers.tpl index 8d4dd98..084e3e3 100644 --- a/helm-chart/eoapi/templates/_helpers.tpl +++ b/helm-chart/eoapi/templates/_helpers.tpl @@ -78,8 +78,25 @@ values.schema.json doesn't play nice combined value checks so we use this helper function to check autoscaling rules */}} {{- define "eoapi.validateAutoscaleRules" -}} -{{- if and .Values.ingress.enabled (ne .Values.ingress.className "nginx") (or (.Values.raster.autoscaling.enabled) (.Values.stac.autoscaling.enabled) (.Values.vector.autoscaling.enabled)) }} -{{- fail "When using an 'ingress.className' other than 'nginx' you cannot enable autoscaling by 'requestRate' at this time b/c it's soley an nginx metric" }} -{{- end }} -{{- end -}} +{{- 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")) + ) }} + {{- 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 }} + + {{/* "host" has to be empty if not "nginx" so give feedback and fail */}} + {{- if .Values.ingress.host }} + {{- fail "When using an 'ingress.className' other than 'nginx' you cannot provision a 'host' at this time" }} + {{- end }} + + {{/* "tls" cannot be enabled if not "nginx" so give feedback and fail */}} + {{- if .Values.ingress.tls.enabled }} + {{- fail "When using an 'ingress.className' other than 'nginx' you cannot enable 'tls' at this time" }} + {{- end }} +{{- end }} {{/* if and .Values.ingress.enabled (ne .Values.ingress.className "nginx") /*}} +{{- end -}} {{/* define */}} diff --git a/helm-chart/eoapi/tests/autoscaling_feedback_alb_tests.yaml b/helm-chart/eoapi/tests/autoscaling_feedback_alb_tests.yaml new file mode 100644 index 0000000..36b6224 --- /dev/null +++ b/helm-chart/eoapi/tests/autoscaling_feedback_alb_tests.yaml @@ -0,0 +1,24 @@ +suite: autoscaling feedback when className is alb +templates: + - templates/services/ingress-alb.yaml +tests: + - it: "fail for ingress.host" + set: + raster.enabled: false + stac.enabled: false + vector.enabled: false + ingress.className: "alb" + ingress.host: "abcd.eoapi.com" + asserts: + - failedTemplate: + errorMessage: When using an 'ingress.className' other than 'nginx' you cannot provision a 'host' at this time + - it: "fail for ingress.tls.enabled" + set: + raster.enabled: false + stac.enabled: false + vector.enabled: false + ingress.className: "alb" + ingress.tls.enabled: true + asserts: + - failedTemplate: + errorMessage: When using an 'ingress.className' other than 'nginx' you cannot enable 'tls' at this time \ No newline at end of file diff --git a/helm-chart/eoapi/tests/autoscaling_feedback_gce_tests.yaml b/helm-chart/eoapi/tests/autoscaling_feedback_gce_tests.yaml new file mode 100644 index 0000000..02e05c4 --- /dev/null +++ b/helm-chart/eoapi/tests/autoscaling_feedback_gce_tests.yaml @@ -0,0 +1,24 @@ +suite: autoscaling feedback when className is gce +templates: + - templates/services/ingress-gce.yaml +tests: + - it: "fail for ingress.host" + set: + raster.enabled: false + stac.enabled: false + vector.enabled: false + ingress.className: "gce" + ingress.host: "abcd.eoapi.com" + asserts: + - failedTemplate: + errorMessage: When using an 'ingress.className' other than 'nginx' you cannot provision a 'host' at this time + - it: "fail for ingress.tls.enabled" + set: + raster.enabled: false + stac.enabled: false + vector.enabled: false + ingress.className: "gce" + ingress.tls.enabled: true + asserts: + - failedTemplate: + errorMessage: When using an 'ingress.className' other than 'nginx' you cannot enable 'tls' at this time \ No newline at end of file diff --git a/helm-chart/eoapi/tests/hpa_tests.yaml b/helm-chart/eoapi/tests/hpa_tests.yaml index 3fa342d..1f0ca6d 100644 --- a/helm-chart/eoapi/tests/hpa_tests.yaml +++ b/helm-chart/eoapi/tests/hpa_tests.yaml @@ -1,8 +1,8 @@ -suite: service defaults deployment +suite: autoscaling feedback when className is not nginx templates: - templates/services/hpa.yaml tests: - - it: "vector hpa fail state" + - it: "vector hpa fail for requestRate" set: raster.enabled: false stac.enabled: false @@ -11,4 +11,5 @@ tests: vector.autoscaling.enabled: true asserts: - failedTemplate: - errorMessage: When using an 'ingress.className' other than 'nginx' you cannot enable autoscaling by 'requestRate' at this time b/c it's soley an nginx metric + errorMessage: 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 +