Unverified Commit 652693d9 authored by Emil Munksø's avatar Emil Munksø
Browse files

chore: made changes according to review

Renamed value from additionalServicePorts to service.extraPorts.
parent ae1d65de
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -52,11 +52,11 @@
| service.commonName            | If present, this will define the ssl certificate common name to be used by CertManager. `service.url` and `service.additionalHosts` will be added as Subject Alternative Names (SANs) | `nil` |
| service.externalPort          |             | `5000`                             |
| service.internalPort          |             | `5000`                             |
| additionalServicePorts        | List of additional service port definitions | `[]` |
| additionalServicePorts.port   | Integer external port number | `nil` |
| additionalServicePorts.targetPort | Integer container port number | `nil` |
| additionalServicePorts.protocol | Protocol of the service port definition | `nil` |
| additionalServicePorts.name | Name of the service port definition | `nil` |
| service.extraPorts        | List of additional service port definitions | `[]` |
| service.extraPorts.port   | Integer external port number | `nil` |
| service.extraPorts.targetPort | Integer container port number | `nil` |
| service.extraPorts.protocol | Protocol of the service port definition | `nil` |
| service.extraPorts.name | Name of the service port definition | `nil` |
| ingress.enabled               | If true, enables ingress | `true`                |
| ingress.path                  | Default path for the ingress | `/` |
| ingress.tls.enabled           | If true, enables SSL | `true`                    |
+7 −7
Original line number Diff line number Diff line
@@ -98,12 +98,12 @@ spec:
        ports:
        - name: "{{ .Values.service.name }}"
          containerPort: {{ .Values.service.internalPort }}
{{- if .Values.additionalServicePorts }}
{{- range .Values.additionalServicePorts }}
        - name: {{ .name }}
          containerPort: {{ .targetPort }}
          {{- if .protocol }}
          protocol: {{ .protocol }} 
{{- if .Values.service.extraPorts }}
{{- range $servicePort := .Values.service.extraPorts }}
        - name: {{ $servicePort.name }}
          containerPort: {{ $servicePort.targetPort }}
          {{- if $servicePort.protocol }}
          protocol: {{ $servicePort.protocol }} 
          {{- end }}
{{- end }}
{{- end }}
+3 −0
Original line number Diff line number Diff line
@@ -23,6 +23,9 @@ spec:
    name: {{ .Values.service.name }}
{{- if eq .Values.service.type "NodePort" }}
    nodePort: {{ .Values.service.nodePort }}
{{- end }}
{{- if .Values.service.extraPorts }}
{{ toYaml .Values.service.extraPorts | indent 2 }}
{{- end }}
  selector:
    app: {{ template "appname" . }}
+3 −3
Original line number Diff line number Diff line
@@ -619,8 +619,8 @@ func TestDeploymentTemplate(t *testing.T) {
	}
}

func TestAdditionalServicePortDefinition(t *testing.T) {
	releaseName := "deployment-additional-service-port-definition-test"
func TestServiceExtraPortServicePortDefinition(t *testing.T) {
	releaseName := "deployment-extra-ports-service-port-definition-test"
	templates := []string{"templates/deployment.yaml"}

	tcs := []struct {
@@ -632,7 +632,7 @@ func TestAdditionalServicePortDefinition(t *testing.T) {
		expectedErrorRegexp *regexp.Regexp
	}{
		{
			name:                "with additional service port",
			name:                "with extra ports service port",
			valueFiles:  []string{"../testdata/service-definition.yaml"},
			expectedPorts: []coreV1.ContainerPort{
				coreV1.ContainerPort {
+2 −4
Original line number Diff line number Diff line
@@ -144,7 +144,7 @@ func TestServiceTemplate_Disable(t *testing.T) {
	}
}

func TestAdditionalServiceDefinition(t *testing.T) {
func TestServiceExtraPortsServiceDefinition(t *testing.T) {
	releaseName := "service-definition-test"
	templates := []string{"templates/service.yaml"}

@@ -154,10 +154,9 @@ func TestAdditionalServiceDefinition(t *testing.T) {
		valueFiles []string
		expectedPorts []coreV1.ServicePort

		expectedErrorRegexp *regexp.Regexp
	}{
		{
			name:                "with additional service port",
			name:                "with extra service port",
			valueFiles:  []string{"../testdata/service-definition.yaml"},
			expectedPorts: []coreV1.ServicePort{
				coreV1.ServicePort {
@@ -175,7 +174,6 @@ func TestAdditionalServiceDefinition(t *testing.T) {
					NodePort: 0,
				},
			},
			expectedErrorRegexp: regexp.MustCompile("Error: could not find template templates/service.yaml in chart"),
		},
	}

Loading