From 235a7201cb97b458419f6880cefdbbaced493e4f Mon Sep 17 00:00:00 2001 From: Hordur Freyr Yngvason Date: Tue, 15 Mar 2022 01:46:59 +0000 Subject: [PATCH] fix: unset default service.nodePort value --- assets/auto-deploy-app/Chart.yaml | 2 +- .../test/templates/service_test.go | 16 +++++++++++----- assets/auto-deploy-app/values.yaml | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/assets/auto-deploy-app/Chart.yaml b/assets/auto-deploy-app/Chart.yaml index 60b69d1..5f97810 100644 --- a/assets/auto-deploy-app/Chart.yaml +++ b/assets/auto-deploy-app/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v1 description: GitLab's Auto-deploy Helm Chart name: auto-deploy-app -version: 2.22.0 +version: 2.22.1 icon: https://gitlab.com/gitlab-com/gitlab-artwork/raw/master/logo/logo-square.png diff --git a/assets/auto-deploy-app/test/templates/service_test.go b/assets/auto-deploy-app/test/templates/service_test.go index d1a53e3..79156a0 100644 --- a/assets/auto-deploy-app/test/templates/service_test.go +++ b/assets/auto-deploy-app/test/templates/service_test.go @@ -30,10 +30,16 @@ func TestServiceTemplate_ServiceType(t *testing.T) { }, { - name: "with NodePort", + name: "with type NodePort but no nodePort value", values: map[string]string{ "service.type": "NodePort" }, expectedType: "NodePort", - expectedPort: coreV1.ServicePort{Port: 5000, TargetPort: intstr.FromInt(5000), NodePort: 30001, Protocol: "TCP", Name: "web"}, + expectedPort: coreV1.ServicePort{Port: 5000, TargetPort: intstr.FromInt(5000), NodePort: 0, Protocol: "TCP", Name: "web"}, + }, + { + name: "with type NodePort and nodePort set", + values: map[string]string{ "service.type": "NodePort", "service.nodePort": "12345" }, + expectedType: "NodePort", + expectedPort: coreV1.ServicePort{Port: 5000, TargetPort: intstr.FromInt(5000), NodePort: 12345, Protocol: "TCP", Name: "web"}, }, } @@ -159,14 +165,14 @@ func TestServiceExtraPortsServiceDefinition(t *testing.T) { name: "with extra service port", valueFiles: []string{"../testdata/service-definition.yaml"}, expectedPorts: []coreV1.ServicePort{ - coreV1.ServicePort { + { Name: "web", Protocol: "TCP", Port: 5000, TargetPort: intstr.FromInt(5000), NodePort: 0, }, - coreV1.ServicePort { + { Name: "port-443", Protocol: "TCP", Port: 443, @@ -195,4 +201,4 @@ func TestServiceExtraPortsServiceDefinition(t *testing.T) { require.Equal(t, tc.expectedPorts, service.Spec.Ports) }) } -} \ No newline at end of file +} diff --git a/assets/auto-deploy-app/values.yaml b/assets/auto-deploy-app/values.yaml index 40c28a9..016c923 100644 --- a/assets/auto-deploy-app/values.yaml +++ b/assets/auto-deploy-app/values.yaml @@ -67,7 +67,7 @@ service: commonName: externalPort: 5000 internalPort: 5000 - nodePort: 30001 + # nodePort: 30001 extraPorts: [] ingress: enabled: true -- GitLab