From 3165ec2743cdf0e19a1eeb3c3fc80aef518b94ff Mon Sep 17 00:00:00 2001 From: Cole Arendt Date: Sat, 29 Jul 2023 05:56:27 -0400 Subject: [PATCH] update values definitions to make adminPort configurable --- charts/postgrest/Chart.yaml | 2 +- charts/postgrest/NEWS.md | 7 +++++++ charts/postgrest/README.md | 13 ++++++------- charts/postgrest/templates/_helpers.tpl | 8 -------- charts/postgrest/templates/deployment.yaml | 16 +++++++++------- charts/postgrest/templates/service.yaml | 4 ++-- charts/postgrest/values.yaml | 13 ++++++++++++- 7 files changed, 37 insertions(+), 26 deletions(-) diff --git a/charts/postgrest/Chart.yaml b/charts/postgrest/Chart.yaml index 6d88e85..997cbb8 100644 --- a/charts/postgrest/Chart.yaml +++ b/charts/postgrest/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: postgrest description: A Helm chart for deploying Postgrest to Kubernetes type: application -version: 0.3.3 +version: 0.3.4 appVersion: v11.1.0 icon: https://avatars.githubusercontent.com/u/15115011?s=200&v=4 maintainers: diff --git a/charts/postgrest/NEWS.md b/charts/postgrest/NEWS.md index a708db5..d632e90 100644 --- a/charts/postgrest/NEWS.md +++ b/charts/postgrest/NEWS.md @@ -1,3 +1,10 @@ +# 0.3.4 + +- Add configuration for the `pod.adminPort` and `service.adminPort` + - `pod.adminPort` controls the PostgREST config and deployment + - `serivce.adminPort` controls the exposure of the health check to the service definition +- Update the `readinessProbe` to use the admin health-check + # 0.3.3 - Bump PostgREST version to v11.1.0 diff --git a/charts/postgrest/README.md b/charts/postgrest/README.md index 30e27e8..73db34e 100644 --- a/charts/postgrest/README.md +++ b/charts/postgrest/README.md @@ -1,14 +1,14 @@ # postgrest -![Version: 0.3.3](https://img.shields.io/badge/Version-0.3.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v11.1.0](https://img.shields.io/badge/AppVersion-v11.1.0-informational?style=flat-square) +![Version: 0.3.4](https://img.shields.io/badge/Version-0.3.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v11.1.0](https://img.shields.io/badge/AppVersion-v11.1.0-informational?style=flat-square) ## Installing the Chart -To install the chart with the release name `my-release` at version 0.3.3: +To install the chart with the release name `my-release` at version 0.3.4: ```bash helm repo add colearendt https://colearendt.github.io/helm -helm install my-release colearendt/postgrest --version=0.3.3 +helm install my-release colearendt/postgrest --version=0.3.4 ``` #### _A Helm chart for deploying Postgrest to Kubernetes_ @@ -40,14 +40,12 @@ helm install my-release colearendt/postgrest --version=0.3.3 | initContainers | object | `{}` | | | nameOverride | string | `""` | | | nodeSelector | object | `{}` | | +| pod.adminPort | int | `9001` | The admin server port for PostgREST. Automatically sets the adminServerPort configuration value. | | pod.annotations | object | `{}` | | | pod.containerPort | int | `9000` | | | pod.env | list | `[]` | | | pod.livenessProbe | object | `{}` | | -| pod.readinessProbe.httpGet.path | string | `"/"` | | -| pod.readinessProbe.httpGet.port | string | `"http"` | | -| pod.readinessProbe.initialDelaySeconds | int | `5` | | -| pod.readinessProbe.periodSeconds | int | `5` | | +| pod.readinessProbe | object | `{"httpGet":{"path":"/ready","port":"http-admin"},"initialDelaySeconds":5,"periodSeconds":5}` | The readiness probe for PostgREST. Can also use requests to /live per https://postgrest.org/en/stable/references/admin.html#health-check | | pod.securityContext | object | `{}` | | | pod.startupProbe | object | `{}` | | | pod.volumeMounts | list | `[]` | | @@ -75,6 +73,7 @@ helm install my-release colearendt/postgrest --version=0.3.3 | resources | object | `{}` | | | secret | object | `{}` | | | securityContext | object | `{}` | | +| service.adminPort | int | `9001` | | | service.port | int | `80` | | | service.type | string | `"ClusterIP"` | | | serviceAccount.annotations | object | `{}` | | diff --git a/charts/postgrest/templates/_helpers.tpl b/charts/postgrest/templates/_helpers.tpl index c2f8b76..3c07eab 100644 --- a/charts/postgrest/templates/_helpers.tpl +++ b/charts/postgrest/templates/_helpers.tpl @@ -75,11 +75,3 @@ Usage: {{- tpl (.value | toYaml) .context }} {{- end }} {{- end -}} - -{{/* -Set the value of PGRST_ADMIN_SERVER_PORT to a fixed port. -*/}} -{{- define "postgrest.adminPort" -}} -9001 -{{- end }} - diff --git a/charts/postgrest/templates/deployment.yaml b/charts/postgrest/templates/deployment.yaml index 24b020f..cec7531 100644 --- a/charts/postgrest/templates/deployment.yaml +++ b/charts/postgrest/templates/deployment.yaml @@ -128,8 +128,10 @@ spec: - name: PGRST_RAW_MEDIA_TYPES value: {{ .Values.postgrest.rawMediaTypes }} {{- end }} + {{- if .Values.pod.adminPort }} - name: PGRST_ADMIN_SERVER_PORT - value: {{ include "postgrest.adminPort" . | quote }} + value: {{ .Values.pod.adminPort | quote }} + {{- end }} {{- if .Values.pod.env }} {{- toYaml .Values.pod.env | nindent 12 }} {{- end }} @@ -137,15 +139,15 @@ spec: - name: http containerPort: {{ .Values.pod.containerPort }} protocol: TCP + {{- if .Values.pod.adminPort }} - name: http-admin - containerPort: {{ include "postgrest.adminPort" . }} + containerPort: {{ .Values.pod.adminPort }} protocol: TCP + {{- end }} + {{- with .Values.pod.readinessProbe }} readinessProbe: - httpGet: - path: /live - port: http-admin - initialDelaySeconds: 5 - periodSeconds: 5 + {{- toYaml . | nindent 12 }} + {{- end }} {{- with .Values.pod.livenessProbe }} livenessProbe: {{- toYaml . | nindent 12 }} diff --git a/charts/postgrest/templates/service.yaml b/charts/postgrest/templates/service.yaml index 0841526..8de30ff 100644 --- a/charts/postgrest/templates/service.yaml +++ b/charts/postgrest/templates/service.yaml @@ -11,8 +11,8 @@ spec: targetPort: http protocol: TCP name: http - {{- if .Values.postgrest.adminServerPort }} - - port: {{ include "postgrest.adminPort" . }} + {{- if .Values.service.adminPort }} + - port: {{ .Values.service.adminPort }} targetPort: http-admin protocol: TCP name: http-admin diff --git a/charts/postgrest/values.yaml b/charts/postgrest/values.yaml index 1f68146..abe318c 100644 --- a/charts/postgrest/values.yaml +++ b/charts/postgrest/values.yaml @@ -60,6 +60,7 @@ postgrest: preRequest: "" rootSpec: "" rawMediaTypes: "" + # NOTE: adminServerPort is set via pod.adminPort and service.adminPort secret: {} @@ -74,16 +75,26 @@ securityContext: {} pod: annotations: {} containerPort: 9000 + # -- The admin server port for PostgREST. Automatically sets the adminServerPort configuration value. + adminPort: 9001 env: [] + # -- The readiness probe for PostgREST. Can also use requests to /live per https://postgrest.org/en/stable/references/admin.html#health-check + readinessProbe: + httpGet: + path: /ready + port: http-admin + initialDelaySeconds: 5 + periodSeconds: 5 livenessProbe: {} startupProbe: {} volumes: [] volumeMounts: [] securityContext: {} - + service: type: ClusterIP port: 80 + adminPort: 9001 ingress: enabled: false