diff --git a/charts/consul/Chart.yaml b/charts/consul/Chart.yaml index dc57082d06..8510ee9b10 100644 --- a/charts/consul/Chart.yaml +++ b/charts/consul/Chart.yaml @@ -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 diff --git a/charts/consul/templates/ui-ingress.yaml b/charts/consul/templates/ui-ingress.yaml index 473acd3469..0414a7cc2d 100644 --- a/charts/consul/templates/ui-ingress.yaml +++ b/charts/consul/templates/ui-ingress.yaml @@ -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" ) }} diff --git a/charts/consul/test/unit/ui-ingress.bats b/charts/consul/test/unit/ui-ingress.bats index 005236be57..e351790aae 100755 --- a/charts/consul/test/unit/ui-ingress.bats +++ b/charts/consul/test/unit/ui-ingress.bats @@ -59,73 +59,31 @@ 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 \ @@ -133,27 +91,12 @@ load _helpers --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 \ @@ -161,7 +104,6 @@ load _helpers --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" ]