Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Commit

Permalink
add support for autoscaling API v2 (#170)
Browse files Browse the repository at this point in the history
* add support for autoscaling API v2
* update github actions to get rid of Node 12 deprecation warning
  • Loading branch information
libuweber authored Feb 6, 2023
1 parent 1665e7d commit 5379aff
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 16 deletions.
1 change: 1 addition & 0 deletions .github/kubeval.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ tar -xf /tmp/kubeval.tar.gz kubeval
# validate charts
for CHART_DIR in ${CHART_DIRS}; do
helm template "${CHART_DIR}" | ./kubeval --strict --kubernetes-version "${KUBERNETES_VERSION#v}" --schema-location "${SCHEMA_LOCATION}"
helm template -f "${CHART_DIR}/ci/dsl-values.yaml" "${CHART_DIR}" | ./kubeval --strict --kubernetes-version "${KUBERNETES_VERSION#v}" --schema-location "${SCHEMA_LOCATION}"
done
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Helm
uses: azure/setup-helm@v1
uses: azure/setup-helm@v3
with:
version: v3.4.0
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Set up chart-testing
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "'${{ secrets.TECHNICAL_USER }}'"
git config user.email "'${{ secrets.TECHNICAL_USER }}'@users.noreply.github.com"
- name: Install Helm
uses: azure/setup-helm@v1
uses: azure/setup-helm@v3
with:
version: v3.4.0
- name: Add Helm Repo
Expand Down
9 changes: 2 additions & 7 deletions charts/microgateway/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,12 @@ maintainers:
- email: [email protected]
name: Airlock
name: microgateway
version: 3.0.19
version: 3.0.20
appVersion: "3.3.0"
annotations:
artifacthub.io/changes: |
- kind: changed
description: Upgrade to Airlock Microgateway 3.3.0
links:
- name: Airlock Microgateway Release Notes
url: https://docs.airlock.com/microgateway/3.3/#data/1674151134907.html
- name: Airlock Microgateway Change Log
url: https://docs.airlock.com/microgateway/3.3/#data/1674151134909.html
description: add support for autoscaling API v2
artifacthub.io/links: |
- name: Airlock Microgateway Manual
url: https://docs.airlock.com/microgateway/latest/
Expand Down
2 changes: 1 addition & 1 deletion charts/microgateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Airlock Microgateway helps you to protect your services and APIs from unauthorized or malicious access with little effort. It is a lightweight Web Application Firewall (WAF) and API security gateway designed specifically for use in container environments.

The current chart version is: 3.0.19
The current chart version is: 3.0.20

## Table of contents
* [Introduction](#introduction)
Expand Down
4 changes: 3 additions & 1 deletion charts/microgateway/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{{- $fullName := include "microgateway.fullname" . -}}
{{- $hpa := .Values.hpa -}}
{{- if $hpa.enabled }}
{{- if semverCompare ">=1.12-0" .Capabilities.KubeVersion.GitVersion -}}
{{- if semverCompare ">=1.23-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: autoscaling/v2
{{- else if semverCompare ">=1.12-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: autoscaling/v2beta2
{{- else -}}
apiVersion: autoscaling/v2beta1
Expand Down
31 changes: 28 additions & 3 deletions charts/microgateway/tests/hpa_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ tests:
path: spec.scaleTargetRef.name
value: my-microgateway

- it: does use correct resource settings - beta1
- it: does use correct resource settings - v2beta1
capabilities:
majorVersion: 1
minorVersion: 11
Expand All @@ -61,7 +61,7 @@ tests:
path: spec.metrics[1].resource.targetAverageValue
value: 1Gi

- it: does use correct resource settings - beta2
- it: does use correct resource settings - v2beta2
capabilities:
majorVersion: 1
minorVersion: 12
Expand All @@ -86,10 +86,35 @@ tests:
path: spec.metrics[1].resource.target.averageValue
value: 1Gi

- it: does use correct resource settings - v2
capabilities:
majorVersion: 1
minorVersion: 23
set:
hpa.enabled: true
hpa.resource.memory: 1Gi
hpa.resource.cpu: 20
asserts:
- equal:
path: apiVersion
value: autoscaling/v2
- equal:
path: spec.metrics[0].resource.name
value: cpu
- equal:
path: spec.metrics[0].resource.target.averageUtilization
value: 20
- equal:
path: spec.metrics[1].resource.name
value: memory
- equal:
path: spec.metrics[1].resource.target.averageValue
value: 1Gi

- it: does use correct resource settings without cpu
capabilities:
majorVersion: 1
minorVersion: 12
minorVersion: 23
set:
hpa.enabled: true
hpa.resource.memory: 1Gi
Expand Down

0 comments on commit 5379aff

Please sign in to comment.