From ed211998805e6eb5b8e2d3e164260b0232ce4727 Mon Sep 17 00:00:00 2001 From: Joe Paravisini Date: Fri, 23 Sep 2022 14:25:35 -0400 Subject: [PATCH] Increase configurability for Service in daemonset chart (closes #63) --- charts/daemonset/README.md | 4 +++- charts/daemonset/templates/service.yaml | 8 ++++++-- charts/daemonset/values.yaml | 5 ++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/charts/daemonset/README.md b/charts/daemonset/README.md index 0475d4a..fa0b23b 100644 --- a/charts/daemonset/README.md +++ b/charts/daemonset/README.md @@ -69,7 +69,9 @@ helm delete daemonset | hostPaths | list | `[]` | List of host paths to mount to the deployment | | resources | object | `{}` | Map of resource constraints for the service | | terminationGracePeriodSeconds | int | `60` | Grace period for termination of the service | -| service.deploy | bool | `true` | Whether to setup service bindings (note: only NodePort is supported) | +| service.deploy | bool | `true` | Whether to setup service bindings | +| service.type | string | `"NodePort"` | Configures ServiceType for this service | +| service.name | string | `"http"` | Prefix of port name for service (appended with '-port') | | 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) | diff --git a/charts/daemonset/templates/service.yaml b/charts/daemonset/templates/service.yaml index 02a8f9f..6aa9bed 100644 --- a/charts/daemonset/templates/service.yaml +++ b/charts/daemonset/templates/service.yaml @@ -3,12 +3,16 @@ apiVersion: v1 kind: Service metadata: name: {{ include "app.fullname" . }} + labels: + {{- range $k, $v := .Values.service.labels }} + {{ $k }}: {{ $v }} + {{- end }} spec: - type: NodePort + type: {{ .Values.service.type }} selector: app: {{ include "app.fullname" . }} ports: - - name: http-port + - name: {{ .Values.service.name }}-port port: {{ .Values.service.port }} protocol: {{ .Values.service.protocol }} targetPort: {{ .Values.service.targetPort }} diff --git a/charts/daemonset/values.yaml b/charts/daemonset/values.yaml index a23d1c3..a3ce4ef 100644 --- a/charts/daemonset/values.yaml +++ b/charts/daemonset/values.yaml @@ -81,8 +81,11 @@ resources: {} terminationGracePeriodSeconds: 60 service: - # -- Whether to setup service bindings (note: only NodePort is supported) deploy: true + # -- Whether to setup service bindings + type: NodePort + # -- Name of service + name: "http" # -- Port to bind and expose the service on port: 8000 # -- The Target Port that the actual application is being exposed on