Skip to content

Commit d7d7ac1

Browse files
authored
fix: add openshift flag for openshift deployments (#13)
* fix: add openshift flag for openshift deployments
1 parent 2a890bc commit d7d7ac1

4 files changed

Lines changed: 36 additions & 3 deletions

File tree

deploy/helm/postgresql-trino-gateway/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: v2
33
name: postgresql-trino-gateway
44
description: PostgreSQL wire-protocol gateway in front of Trino, enabling Power BI DirectQuery and other PG-only clients.
55
type: application
6-
version: 0.1.0
6+
version: 0.1.1
77
appVersion: "0.1.0"
88
home: https://stackable.tech
99
sources:

deploy/helm/postgresql-trino-gateway/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@ not configured here.
5151
and `trino.ssl=false` (cleartext password forwarded to Trino over plain
5252
HTTP). Use only with a loopback or otherwise-trusted Trino.
5353

54+
## OpenShift
55+
56+
By default the chart pins `runAsUser`, `runAsGroup` and `fsGroup` to the
57+
IDs baked into the image (the `stackable` user). OpenShift's SCCs (e.g.
58+
`restricted-v2`) instead assign a UID/fsGroup from a per-namespace range
59+
and reject any pod requesting IDs outside it, so the defaults fail
60+
admission with `... is not an allowed group` / `must be in the ranges`.
61+
62+
Set `openshift.enabled=true` to omit `runAsUser`, `runAsGroup` and
63+
`fsGroup` from the pod and container security contexts, letting the SCC
64+
inject them.
65+
5466
## Connectivity
5567

5668
The Service is `ClusterIP` on TCP/5432 by default. PG protocol is not
@@ -100,6 +112,8 @@ See `values.yaml` for the full list. Notable groups:
100112
- `livenessProbe`, `readinessProbe`, `startupProbe` — TCP socket probes.
101113
- `podSecurityContext`, `securityContext` — non-root, read-only root FS,
102114
drop ALL capabilities.
115+
- `openshift.enabled` — drop hardcoded UID/GID/fsGroup so OpenShift SCCs
116+
assign them (see [OpenShift](#openshift)).
103117
- `maxConnections` — concurrent connection cap.
104118
- `logLevel``RUST_LOG` value (e.g. `postgresql_trino_gateway=debug`).
105119

deploy/helm/postgresql-trino-gateway/templates/deployment.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,21 @@ spec:
4343
serviceAccountName: {{ include "postgresql-trino-gateway.serviceAccountName" . }}
4444
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
4545
securityContext:
46-
{{- toYaml .Values.podSecurityContext | nindent 8 }}
46+
{{- $podSecurityContext := deepCopy .Values.podSecurityContext }}
47+
{{- if .Values.openshift.enabled }}
48+
{{- $_ := unset $podSecurityContext "runAsUser" }}
49+
{{- $_ := unset $podSecurityContext "runAsGroup" }}
50+
{{- $_ := unset $podSecurityContext "fsGroup" }}
51+
{{- end }}
52+
{{- toYaml $podSecurityContext | nindent 8 }}
4753
containers:
4854
- name: gateway
4955
securityContext:
50-
{{- toYaml .Values.securityContext | nindent 12 }}
56+
{{- $securityContext := deepCopy .Values.securityContext }}
57+
{{- if .Values.openshift.enabled }}
58+
{{- $_ := unset $securityContext "runAsUser" }}
59+
{{- end }}
60+
{{- toYaml $securityContext | nindent 12 }}
5161
image: {{ include "postgresql-trino-gateway.image" . }}
5262
imagePullPolicy: {{ .Values.image.pullPolicy }}
5363
args:

deploy/helm/postgresql-trino-gateway/values.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ serviceAccount:
2828
podAnnotations: {}
2929
podLabels: {}
3030

31+
# OpenShift assigns a per-namespace UID/GID/fsGroup range via its SCCs
32+
# (e.g. restricted-v2) and rejects pods that request values outside it.
33+
# When enabled=true the chart omits runAsUser, runAsGroup and fsGroup from
34+
# the pod and container securityContext so OpenShift injects them from the
35+
# namespace range. The image (/stackable is group-0 owned with g=u perms,
36+
# readOnlyRootFilesystem is set) already runs as an arbitrary UID+GID 0.
37+
openshift:
38+
enabled: false
39+
3140
podSecurityContext:
3241
runAsNonRoot: true
3342
runAsUser: 782252253

0 commit comments

Comments
 (0)