From 40d5a84e84d5d22d8a0b7bf4f496d85dacd9a49f Mon Sep 17 00:00:00 2001 From: Robert Fairburn <8029478+rfairburn@users.noreply.github.com> Date: Mon, 24 Jun 2024 10:43:47 -0500 Subject: [PATCH] Support different port/targetPort for service in helm chart (#19889) --- charts/fleet/Chart.yaml | 2 +- charts/fleet/templates/ingress.yaml | 2 +- charts/fleet/templates/service.yaml | 3 ++- charts/fleet/values.yaml | 6 +++++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/charts/fleet/Chart.yaml b/charts/fleet/Chart.yaml index 9fb4886fe1..a9427c8094 100644 --- a/charts/fleet/Chart.yaml +++ b/charts/fleet/Chart.yaml @@ -4,7 +4,7 @@ name: fleet keywords: - fleet - osquery -version: v6.0.3 +version: v6.1.0 home: https://github.com/fleetdm/fleet sources: - https://github.com/fleetdm/fleet.git diff --git a/charts/fleet/templates/ingress.yaml b/charts/fleet/templates/ingress.yaml index 97ff93a0f3..0a7326d995 100644 --- a/charts/fleet/templates/ingress.yaml +++ b/charts/fleet/templates/ingress.yaml @@ -1,6 +1,6 @@ {{- if .Values.ingress.enabled -}} {{- $fullName := include "fleet.fullname" . -}} -{{- $svcPort := .Values.fleet.listenPort -}} +{{- $svcPort := ternary .Values.fleet.listenPort .Values.fleet.servicePort (eq .Values.fleet.servicePort nil) -}} {{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} diff --git a/charts/fleet/templates/service.yaml b/charts/fleet/templates/service.yaml index a04b0540dc..1a22e48fc0 100644 --- a/charts/fleet/templates/service.yaml +++ b/charts/fleet/templates/service.yaml @@ -19,7 +19,8 @@ spec: release: {{ .Release.Name }} ports: - name: fleet - port: {{ .Values.fleet.listenPort }} + port: {{ ternary .Values.fleet.listenPort .Values.fleet.servicePort (eq .Values.fleet.servicePort nil) }} + targetPort: {{ .Values.fleet.listenPort }} {{- if .Values.gke.ingress.useGKEIngress }} {{- if .Values.gke.ingress.nodePort }} nodePort: {{ .Values.gke.ingress.nodePort }} diff --git a/charts/fleet/values.yaml b/charts/fleet/values.yaml index 0327a52cce..07e528e993 100644 --- a/charts/fleet/values.yaml +++ b/charts/fleet/values.yaml @@ -56,7 +56,10 @@ ingress: ## Section: Fleet # All of the settings relating to configuring the Fleet server fleet: + # Will also be the targetPort for the service listenPort: 8080 + # servicePort is optional. Use if the service port needs to differ from the listenPort above. + # servicePort: 9080 # Name of the Secret resource storing S3 bucket and optionally TLS secrets secretName: fleet # Whether or not to run `fleet db prepare` to run SQL migrations before starting Fleet @@ -205,7 +208,8 @@ gke: environments: # MDM Settings # The following environment variable is required if you are using - # Fleet's macOS MDM features. + # Fleet's macOS MDM features. In a production environment, it is recommended that + # you store this private key in a secret and use envsFrom to reference the secret below. # To more information: https://fleetdm.com/docs/using-fleet/fleet-server-configuration#server-private-key FLEET_SERVER_PRIVATE_KEY: ""