From 82c26af6e5ea3217db250e7e62cc6988b8018059 Mon Sep 17 00:00:00 2001 From: jbeemster Date: Thu, 25 Aug 2022 16:43:12 +0200 Subject: [PATCH] charts/service-deployment: Expose targetPort and protocol in service definition (closes #53) --- charts/service-deployment/README.md | 4 +++- charts/service-deployment/templates/NOTES.txt | 4 ++-- charts/service-deployment/templates/service.yaml | 4 ++-- charts/service-deployment/values.yaml | 6 +++++- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/charts/service-deployment/README.md b/charts/service-deployment/README.md index 60cc6af..cfeb35c 100644 --- a/charts/service-deployment/README.md +++ b/charts/service-deployment/README.md @@ -67,7 +67,9 @@ helm delete service-deployment | hpa.maxReplicas | int | `20` | Maximum number of pods to deploy | | hpa.averageCPUUtilization | int | `75` | Average CPU utilization before auto-scaling starts | | service.deploy | bool | `true` | Whether to setup service bindings (note: only NodePort is supported) | -| service.port | int | `80` | Port to bind and expose the service on | +| service.port | int | `8000` | Port to bind and expose the service on | +| service.targetPort | int | `80` | The Target Port that the actual application is being exposed on | +| service.protocol | string | `"TCP"` | Protocol that the service leverages (note: TCP or UDP) | | service.aws.targetGroupARN | string | `""` | EC2 TargetGroup ARN to bind the service onto | | service.gcp.networkEndpointGroupName | string | `""` | Name of the Network Endpoint Group to bind onto | | dockerconfigjson.name | string | `"snowplow-sd-dockerhub"` | Name of the secret to use for the private repository | diff --git a/charts/service-deployment/templates/NOTES.txt b/charts/service-deployment/templates/NOTES.txt index 68c84cd..9b3c271 100644 --- a/charts/service-deployment/templates/NOTES.txt +++ b/charts/service-deployment/templates/NOTES.txt @@ -10,7 +10,7 @@ The service can be accessed via port {{ .Values.service.port }} on the following To connect to your server from outside the cluster execute the following commands: - kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ include "app.fullname" . }} 8080:{{ .Values.service.port }} + kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ include "app.fullname" . }} {{ .Values.service.port }}:{{ .Values.service.port }} -You can then navigate to your service in your browser at localhost:8080 or issue request with tools like cURL. +You can then navigate to your service in your browser at localhost:{{ .Values.service.port }} or issue request with tools like cURL. {{- end }} diff --git a/charts/service-deployment/templates/service.yaml b/charts/service-deployment/templates/service.yaml index 9de3576..c681eaa 100644 --- a/charts/service-deployment/templates/service.yaml +++ b/charts/service-deployment/templates/service.yaml @@ -15,6 +15,6 @@ spec: ports: - name: http-port port: {{ .Values.service.port }} - protocol: TCP - targetPort: {{ .Values.service.port }} + protocol: {{ .Values.service.protocol }} + targetPort: {{ .Values.service.targetPort }} {{- end }} diff --git a/charts/service-deployment/values.yaml b/charts/service-deployment/values.yaml index 54c247d..26dfdb7 100644 --- a/charts/service-deployment/values.yaml +++ b/charts/service-deployment/values.yaml @@ -74,7 +74,11 @@ service: # -- Whether to setup service bindings (note: only NodePort is supported) deploy: true # -- Port to bind and expose the service on - port: 80 + port: 8000 + # -- The Target Port that the actual application is being exposed on + targetPort: 80 + # -- Protocol that the service leverages (note: TCP or UDP) + protocol: "TCP" aws: # -- EC2 TargetGroup ARN to bind the service onto targetGroupARN: ""