From da385f94e6193abf33b631dfbe6d6463e797a31c Mon Sep 17 00:00:00 2001 From: RITWIK G Date: Tue, 23 Jul 2024 11:42:31 +0530 Subject: [PATCH] Added targetPort to set container port number instead of using the service port. Signed-off-by: Ritwik G --- pkg/chartutil/create.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/chartutil/create.go b/pkg/chartutil/create.go index 50212f9d5..3921aaeb5 100644 --- a/pkg/chartutil/create.go +++ b/pkg/chartutil/create.go @@ -146,6 +146,7 @@ securityContext: {} service: type: ClusterIP port: 80 + targetPort: 80 ingress: enabled: false @@ -339,7 +340,7 @@ spec: imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - name: http - containerPort: {{ .Values.service.port }} + containerPort: {{ .Values.service.targetPort }} protocol: TCP livenessProbe: {{- toYaml .Values.livenessProbe | nindent 12 }} @@ -379,7 +380,7 @@ spec: type: {{ .Values.service.type }} ports: - port: {{ .Values.service.port }} - targetPort: http + targetPort: {{ .Values.service.targetPort }} protocol: TCP name: http selector: @@ -720,4 +721,4 @@ func validateChartName(name string) error { return fmt.Errorf("chart name must match the regular expression %q", chartName.String()) } return nil -} +} \ No newline at end of file