Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chart: bump k8s requirement to 1.19 #1049

Merged
merged 6 commits into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/consul/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: consul
version: 0.41.0
appVersion: 1.11.3
kubeVersion: ">=1.18.0-0"
kubeVersion: ">=1.19.0-0"
description: Official HashiCorp Consul Chart
home: https://www.consul.io
icon: https://raw.githubusercontent.com/hashicorp/consul-k8s/main/assets/icon.png
Expand Down
2 changes: 0 additions & 2 deletions charts/consul/templates/ui-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ metadata:
{{ tpl .Values.ui.ingress.annotations . | nindent 4 | trim }}
{{- end }}
spec:
{{- if or ( gt .Capabilities.KubeVersion.Major "1" ) ( ge .Capabilities.KubeVersion.Minor "18" ) }}
ingressClassName: {{ .Values.ui.ingress.ingressClassName }}
{{- end }}
rules:
{{ $global := .Values.global }}
{{- if or ( gt .Capabilities.KubeVersion.Major "1" ) ( ge .Capabilities.KubeVersion.Minor "19" ) }}
Expand Down
66 changes: 4 additions & 62 deletions charts/consul/test/unit/ui-ingress.bats
Original file line number Diff line number Diff line change
Expand Up @@ -59,109 +59,51 @@ load _helpers
[ "${actual}" = "foo.com" ]
}

@test "ui/Ingress: exposes single port 80 when global.tls.enabled=false when Kube version < 1.19" {
cd `chart_dir`
local actual=$(helm template \
-s templates/ui-ingress.yaml \
--set 'ui.ingress.enabled=true' \
--set 'global.tls.enabled=false' \
--set 'ui.ingress.hosts[0].host=foo.com' \
--kube-version "1.18" \
. | tee /dev/stderr |
yq -r '.spec.rules[0].http.paths[0].backend.servicePort' | tee /dev/stderr)
[ "${actual}" = "80" ]
}

@test "ui/Ingress: exposes single port 80 when global.tls.enabled=false when Kube version >= 1.19" {
@test "ui/Ingress: exposes single port 80 when global.tls.enabled=false" {
cd `chart_dir`
local actual=$(helm template \
-s templates/ui-ingress.yaml \
--set 'ui.ingress.enabled=true' \
--set 'global.tls.enabled=false' \
--set 'ui.ingress.hosts[0].host=foo.com' \
--kube-version "1.19" \
. | tee /dev/stderr |
yq -r '.spec.rules[0].http.paths[0].backend.service.port.number' | tee /dev/stderr)
[ "${actual}" = "80" ]
}

@test "ui/Ingress: exposes single port 443 when global.tls.enabled=true and global.tls.httpsOnly=true when Kube version < 1.19" {
cd `chart_dir`
local actual=$(helm template \
-s templates/ui-ingress.yaml \
--set 'ui.ingress.enabled=true' \
--set 'global.tls.enabled=true' \
--set 'ui.ingress.hosts[0].host=foo.com' \
--kube-version "1.18" \
. | tee /dev/stderr |
yq -r '.spec.rules[0].http.paths[0].backend.servicePort' | tee /dev/stderr)
[ "${actual}" = "443" ]
}

@test "ui/Ingress: exposes single port 443 when global.tls.enabled=true and global.tls.httpsOnly=true when Kube version >= 1.19" {
@test "ui/Ingress: exposes single port 443 when global.tls.enabled=true and global.tls.httpsOnly=true" {
cd `chart_dir`
local actual=$(helm template \
-s templates/ui-ingress.yaml \
--set 'ui.ingress.enabled=true' \
--set 'global.tls.enabled=true' \
--set 'ui.ingress.hosts[0].host=foo.com' \
--kube-version "1.19" \
. | tee /dev/stderr |
yq -r '.spec.rules[0].http.paths[0].backend.service.port.number' | tee /dev/stderr)
[ "${actual}" = "443" ]
}

@test "ui/Ingress: exposes the port 80 when global.tls.enabled=true and global.tls.httpsOnly=false when Kube version < 1.19" {
cd `chart_dir`
local actual=$(helm template \
-s templates/ui-ingress.yaml \
--set 'ui.ingress.enabled=true' \
--set 'global.tls.enabled=true' \
--set 'global.tls.httpsOnly=false' \
--set 'ui.ingress.hosts[0].host=foo.com' \
--kube-version "1.18" \
. | tee /dev/stderr |
yq -r '.spec.rules[0].http.paths[0].backend.servicePort' | tee /dev/stderr)
[ "${actual}" = "80" ]
}

@test "ui/Ingress: exposes the port 80 when global.tls.enabled=true and global.tls.httpsOnly=false when Kube version >= 1.19" {
@test "ui/Ingress: exposes the port 80 when global.tls.enabled=true and global.tls.httpsOnly=false" {
cd `chart_dir`
local actual=$(helm template \
-s templates/ui-ingress.yaml \
--set 'ui.ingress.enabled=true' \
--set 'global.tls.enabled=true' \
--set 'global.tls.httpsOnly=false' \
--set 'ui.ingress.hosts[0].host=foo.com' \
--kube-version "1.19" \
. | tee /dev/stderr |
yq -r '.spec.rules[0].http.paths[0].backend.service.port.number' | tee /dev/stderr)
[ "${actual}" = "80" ]
}

@test "ui/Ingress: exposes the port 443 when global.tls.enabled=true and global.tls.httpsOnly=false when Kube version < 1.19" {
cd `chart_dir`
local actual=$(helm template \
-s templates/ui-ingress.yaml \
--set 'ui.ingress.enabled=true' \
--set 'global.tls.enabled=true' \
--set 'global.tls.httpsOnly=false' \
--set 'ui.ingress.hosts[0].host=foo.com' \
--kube-version "1.18" \
. | tee /dev/stderr |
yq -r '.spec.rules[0].http.paths[1].backend.servicePort' | tee /dev/stderr)
[ "${actual}" = "443" ]
}

@test "ui/Ingress: exposes the port 443 when global.tls.enabled=true and global.tls.httpsOnly=false when Kube version >= 1.19" {
@test "ui/Ingress: exposes the port 443 when global.tls.enabled=true and global.tls.httpsOnly=false" {
cd `chart_dir`
local actual=$(helm template \
-s templates/ui-ingress.yaml \
--set 'ui.ingress.enabled=true' \
--set 'global.tls.enabled=true' \
--set 'global.tls.httpsOnly=false' \
--set 'ui.ingress.hosts[0].host=foo.com' \
--kube-version "1.19" \
. | tee /dev/stderr |
yq -r '.spec.rules[0].http.paths[1].backend.service.port.number' | tee /dev/stderr)
[ "${actual}" = "443" ]
Expand Down