From f3ceca08288fb94d400c19c2c637e90ebae72661 Mon Sep 17 00:00:00 2001 From: holysoles Date: Fri, 17 Jan 2025 17:34:58 -0600 Subject: [PATCH] fix(chart): add parameter for service.targetPort, sets APP_PORT var for nginx --- charts/pixelfed/README.md | 1 + charts/pixelfed/templates/configmap.yaml | 1 + charts/pixelfed/templates/deployment.yaml | 4 +++- charts/pixelfed/templates/service.yaml | 2 +- charts/pixelfed/values.yaml | 2 ++ 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/charts/pixelfed/README.md b/charts/pixelfed/README.md index 2e1bb3c..5963649 100644 --- a/charts/pixelfed/README.md +++ b/charts/pixelfed/README.md @@ -162,6 +162,7 @@ A Helm chart for deploying Pixelfed on Kubernetes | resources | object | `{}` | | | securityContext | object | `{}` | | | service.port | int | `80` | This sets the ports more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#field-spec-ports | +| service.targetPort | int | `80` | Port to attach to on the pods. Also sets what port nginx listens on inside the container. | | service.type | string | `"ClusterIP"` | This sets the service type more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types | | serviceAccount.annotations | object | `{}` | Annotations to add to the service account | | serviceAccount.automount | bool | `true` | Automatically mount a ServiceAccount's API credentials? | diff --git a/charts/pixelfed/templates/configmap.yaml b/charts/pixelfed/templates/configmap.yaml index 43f1948..4a9da0a 100644 --- a/charts/pixelfed/templates/configmap.yaml +++ b/charts/pixelfed/templates/configmap.yaml @@ -8,6 +8,7 @@ data: # app config vars APP_NAME={{ .Values.pixelfed.app.name }} APP_ENV={{ .Values.pixelfed.app.env }} + APP_PORT={{ .Values.service.targetPort }} APP_URL={{ .Values.pixelfed.app.url }} APP_LOCALE={{ .Values.pixelfed.app.locale }} {{- with .Values.pixelfed.app.domain }} diff --git a/charts/pixelfed/templates/deployment.yaml b/charts/pixelfed/templates/deployment.yaml index 84c6105..b55c1aa 100644 --- a/charts/pixelfed/templates/deployment.yaml +++ b/charts/pixelfed/templates/deployment.yaml @@ -38,7 +38,7 @@ spec: imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - name: http - containerPort: {{ .Values.service.port }} + containerPort: {{ .Values.service.targetPort }} protocol: TCP env: # app data @@ -46,6 +46,8 @@ spec: value: {{ .Values.pixelfed.app.name }} - name: APP_ENV value: {{ .Values.pixelfed.app.env }} + - name: APP_PORT + value: {{ .Values.service.targetPort | quote}} - name: APP_URL value: {{ .Values.pixelfed.app.url }} - name: APP_LOCALE diff --git a/charts/pixelfed/templates/service.yaml b/charts/pixelfed/templates/service.yaml index 9b85ad5..d5a4d0f 100644 --- a/charts/pixelfed/templates/service.yaml +++ b/charts/pixelfed/templates/service.yaml @@ -8,7 +8,7 @@ spec: type: {{ .Values.service.type }} ports: - port: {{ .Values.service.port }} - targetPort: http + targetPort: {{ .Values.service.targetPort }} protocol: TCP name: http selector: diff --git a/charts/pixelfed/values.yaml b/charts/pixelfed/values.yaml index 202b1a6..2c09a6e 100644 --- a/charts/pixelfed/values.yaml +++ b/charts/pixelfed/values.yaml @@ -56,6 +56,8 @@ service: type: ClusterIP # -- This sets the ports more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#field-spec-ports port: 80 + # -- Port to attach to on the pods. Also sets what port nginx listens on inside the container. + targetPort: 80 # This block is for setting up the ingress for more information can be found here: https://kubernetes.io/docs/concepts/services-networking/ingress/ ingress: