Skip to content

Commit

Permalink
fix: remove k8s 1.16 from acceptance testing (#848)
Browse files Browse the repository at this point in the history
* remove 1.16 from the versions tested in .github/workflows/acceptance.yaml as kind no longer supports creating a k8s 1.16 cluster
* update vault-helm's minimum support k8s version to 1.20 in README and Chart.yaml
* refactor server-ingress's templating and unit tests applied to k8s versions < 1.20
  • Loading branch information
thyton authored Feb 27, 2023
1 parent e31e70e commit f4f05aa
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/acceptance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
fail-fast: false
matrix:
kind-k8s-version: [1.16.15, 1.20.15, 1.21.14, 1.22.15, 1.23.12, 1.24.6, 1.25.3]
kind-k8s-version: [1.20.15, 1.21.14, 1.22.15, 1.23.12, 1.24.6, 1.25.3]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Unreleased

Changes:
* Earliest Kubernetes version tested is now 1.20

Features:
* server: New `extraPorts` option for adding ports to the Vault server statefulset [GH-841](https://github.com/hashicorp/vault-helm/pull/841)

Expand Down
2 changes: 1 addition & 1 deletion Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ apiVersion: v2
name: vault
version: 0.23.0
appVersion: 1.12.1
kubeVersion: ">= 1.16.0-0"
kubeVersion: ">= 1.20.0-0"
description: Official HashiCorp Vault Chart
home: https://www.vaultproject.io
icon: https://github.com/hashicorp/vault/raw/f22d202cde2018f9455dec755118a9b84586e082/Vault_PrimaryLogo_Black.png
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ this README. Please refer to the Kubernetes and Helm documentation.
The versions required are:

* **Helm 3.6+**
* **Kubernetes 1.16+** - This is the earliest version of Kubernetes tested.
* **Kubernetes 1.20+** - This is the earliest version of Kubernetes tested.
It is possible that this chart works with earlier versions but it is
untested.

Expand Down
7 changes: 0 additions & 7 deletions templates/server-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,12 @@ spec:
{{- end }}
{{- range (.paths | default (list "/")) }}
- path: {{ . }}
{{ if semverCompare ">= 1.19.0-0" $kubeVersion }}
pathType: {{ $pathType }}
{{ end }}
backend:
{{ if semverCompare ">= 1.19.0-0" $kubeVersion }}
service:
name: {{ $serviceName }}
port:
number: {{ $servicePort }}
{{ else }}
serviceName: {{ $serviceName }}
servicePort: {{ $servicePort }}
{{ end }}
{{- end }}
{{- end }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion test/unit/injector-disruptionbudget.bats
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ load _helpers
local actual=$(helm template \
--show-only templates/injector-disruptionbudget.yaml \
--set 'injector.podDisruptionBudget.minAvailable=2' \
--kube-version 1.19.5 \
--kube-version 1.20.15 \
. | tee /dev/stderr |
yq '.apiVersion == "policy/v1beta1"' | tee /dev/stderr)
[ "${actual}" = "true" ]
Expand Down
2 changes: 1 addition & 1 deletion test/unit/server-ha-disruptionbudget.bats
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ load _helpers
--show-only templates/server-disruptionbudget.yaml \
--set 'server.ha.enabled=true' \
--set 'server.ha.replicas=1' \
--kube-version 1.19.5 \
--kube-version 1.20.15 \
. | tee /dev/stderr |
yq '.apiVersion == "policy/v1beta1"' | tee /dev/stderr)
[ "${actual}" = "true" ]
Expand Down
23 changes: 5 additions & 18 deletions test/unit/server-ingress.bats
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ load _helpers
[ "${actual}" = "release-name-vault" ]
}

@test "server/ingress: k8s 1.18.3 uses regular service when not ha - yaml" {
@test "server/ingress: k8s 1.20.15 uses correct service format when not ha - yaml" {
cd `chart_dir`

local actual=$(helm template \
Expand All @@ -206,9 +206,9 @@ load _helpers
--set 'server.dev.enabled=false' \
--set 'server.ha.enabled=false' \
--set 'server.service.enabled=true' \
--kube-version 1.18.3 \
--kube-version 1.20.15 \
. | tee /dev/stderr |
yq -r '.spec.rules[0].http.paths[0].backend.serviceName' | tee /dev/stderr)
yq -r '.spec.rules[0].http.paths[0].backend.service.name' | tee /dev/stderr)
[ "${actual}" = "release-name-vault" ]
}

Expand All @@ -227,32 +227,19 @@ load _helpers
[ "${actual}" = "release-name-vault" ]
}

@test "server/ingress: pathType is added to Kubernetes version == 1.19.0" {
@test "server/ingress: pathType is added to Kubernetes version == 1.20.15" {
cd `chart_dir`

local actual=$(helm template \
--show-only templates/server-ingress.yaml \
--set 'server.ingress.enabled=true' \
--set server.ingress.pathType=ImplementationSpecific \
--kube-version 1.19.0 \
--kube-version 1.20.15 \
. | tee /dev/stderr |
yq -r '.spec.rules[0].http.paths[0].pathType' | tee /dev/stderr)
[ "${actual}" = "ImplementationSpecific" ]
}

@test "server/ingress: pathType is not added to Kubernetes versions < 1.19" {
cd `chart_dir`

local actual=$(helm template \
--show-only templates/server-ingress.yaml \
--set 'server.ingress.enabled=true' \
--set server.ingress.pathType=ImplementationSpecific \
--kube-version 1.18.3 \
. | tee /dev/stderr |
yq -r '.spec.rules[0].http.paths[0].pathType' | tee /dev/stderr)
[ "${actual}" = "null" ]
}

@test "server/ingress: pathType is added to Kubernetes versions > 1.19" {
cd `chart_dir`

Expand Down

0 comments on commit f4f05aa

Please sign in to comment.