Skip to content

Commit

Permalink
fix(chart): remove hook post-upgrade, add test for chart upgrade capa…
Browse files Browse the repository at this point in the history
…bility

Signed-off-by: Viet Nguyen Duc <[email protected]>
  • Loading branch information
VietND96 committed Apr 16, 2024
1 parent bd50206 commit be0fe12
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 8 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/helm-chart-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,32 +42,38 @@ jobs:
cluster: 'kind'
helm-version: 'v3.10.3'
test-existing-keda: true
test-upgrade: true
- k8s-version: 'v1.26.15'
test-strategy: deployment
cluster: 'minikube'
helm-version: 'v3.11.3'
test-existing-keda: true
test-upgrade: true
- k8s-version: 'v1.27.12'
test-strategy: job_https
cluster: 'minikube'
helm-version: 'v3.12.3'
test-existing-keda: true
test-upgrade: true
- k8s-version: 'v1.28.8'
test-strategy: job_hostname
cluster: 'minikube'
helm-version: 'v3.13.3'
test-existing-keda: false
test-upgrade: true
- k8s-version: 'v1.29.3'
test-strategy: deployment_https
cluster: 'minikube'
helm-version: 'v3.14.3'
test-existing-keda: false
test-upgrade: true
env:
CLUSTER: ${{ matrix.cluster }}
KUBERNETES_VERSION: ${{ matrix.k8s-version }}
ARTIFACT_NAME: ${{ matrix.k8s-version }}-${{ matrix.test-strategy }}
HELM_VERSION: ${{ matrix.helm-version }}
TEST_EXISTING_KEDA: ${{ matrix.test-existing-keda }}
TEST_UPGRADE_CHART: ${{ matrix.test-upgrade }}
steps:
- uses: actions/checkout@main
- name: Output Docker info
Expand Down Expand Up @@ -138,6 +144,10 @@ jobs:
max_attempts: 3
command: |
NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} TEST_EXISTING_KEDA=${TEST_EXISTING_KEDA} make chart_test_autoscaling_${{ matrix.test-strategy }}
- name: Test chart upgrade
if: (matrix.test-upgrade == true)
run: |
NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} TEST_EXISTING_KEDA=${TEST_EXISTING_KEDA} SET_MAX_REPLICAS=10 TEST_UPGRADE_CHART=${TEST_UPGRADE_CHART} make chart_test_autoscaling_${{ matrix.test-strategy }}
- name: Cleanup Kubernetes cluster
if: always()
run: CLUSTER=${CLUSTER} make chart_cluster_cleanup
Expand Down
1 change: 0 additions & 1 deletion charts/selenium-grid/templates/chrome-node-hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ metadata:
name: {{ template "seleniumGrid.chromeNode.fullname" . }}
namespace: {{ .Release.Namespace }}
annotations:
helm.sh/resource-policy: delete
{{- with .Values.autoscaling.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
Expand Down
1 change: 0 additions & 1 deletion charts/selenium-grid/templates/edge-node-hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ metadata:
name: {{ template "seleniumGrid.edgeNode.fullname" . }}
namespace: {{ .Release.Namespace }}
annotations:
helm.sh/resource-policy: delete
{{- with .Values.autoscaling.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
Expand Down
1 change: 0 additions & 1 deletion charts/selenium-grid/templates/firefox-node-hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ metadata:
name: {{ template "seleniumGrid.firefoxNode.fullname" . }}
namespace: {{ .Release.Namespace }}
annotations:
helm.sh/resource-policy: delete
{{- with .Values.autoscaling.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
Expand Down
10 changes: 5 additions & 5 deletions charts/selenium-grid/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ autoscaling:
scalingType: job
# Annotations for KEDA resources: ScaledObject and ScaledJob
annotations:
"helm.sh/hook": post-install,post-upgrade,post-rollback
"helm.sh/hook": post-install
# Options for KEDA scaled resources (keep only common options used for both ScaledJob and ScaledObject)
scaledOptions:
minReplicaCount: 0
Expand Down Expand Up @@ -1221,19 +1221,19 @@ prometheus-stack:
defaultRules:
create: true
annotations:
"helm.sh/hook": post-install,post-upgrade,post-rollback
"helm.sh/hook": post-install
alertmanager:
enabled: true
annotations:
"helm.sh/hook": post-install,post-upgrade,post-rollback
"helm.sh/hook": post-install
grafana:
enabled: true
adminPassword: admin
forceDeployDatasources: true
forceDeployDashboards: true
annotations:
"helm.sh/hook": post-install,post-upgrade,post-rollback
"helm.sh/hook": post-install
prometheus:
enabled: true
annotations:
"helm.sh/hook": post-install,post-upgrade,post-rollback
"helm.sh/hook": post-install
6 changes: 6 additions & 0 deletions tests/charts/make/chart_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ BASIC_AUTH_USERNAME=${BASIC_AUTH_USERNAME:-"sysAdminUser"}
BASIC_AUTH_PASSWORD=${BASIC_AUTH_PASSWORD:-"myStrongPassword"}
LOG_LEVEL=${LOG_LEVEL:-"INFO"}
TEST_EXISTING_KEDA=${TEST_EXISTING_KEDA:-"true"}
TEST_UPGRADE_CHART=${TEST_UPGRADE_CHART:-"false"}

cleanup() {
# Get the list of pods
Expand Down Expand Up @@ -195,6 +196,11 @@ helm upgrade --install ${HELM_COMMAND_ARGS}

kubectl get pods -A

if [ "${TEST_UPGRADE_CHART}" = "true" ]; then
echo "Focus on verify chart upgrade, skip Selenium tests"
exit 0
fi

echo "Run Tests"
export CHART_CERT_PATH=$(readlink -f ${CHART_CERT_PATH})
export SELENIUM_GRID_PROTOCOL=${SELENIUM_GRID_PROTOCOL}
Expand Down

0 comments on commit be0fe12

Please sign in to comment.