Skip to content

Commit b8954f6

Browse files
Openshift support (permitio#287)
* Openshift support * openshift support added * openshift * pre commit fix * fix securityContext * fix path volume * fix permissions issue
1 parent bdfc70d commit b8954f6

File tree

4 files changed

+86
-4
lines changed

4 files changed

+86
-4
lines changed

charts/pdp/Chart.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
apiVersion: v2
22
name: pdp
3-
description: An official Helm chart for Permit.io PDP (Policy Decision Point)
4-
version: 0.0.4
3+
description: An official Helm chart for Permit.io PDP (Policy Decision Point) with OpenShift support
4+
version: 0.0.5
5+
keywords:
6+
- policy
7+
- authorization
8+
- security
9+
- permit
10+
- openshift
11+
maintainers:
12+
- name: Permit.io
13+
url: https://permit.io

charts/pdp/templates/deployment.yaml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,27 @@ spec:
2222
{{- toYaml . | nindent 8 }}
2323
{{- end }}
2424
spec:
25+
{{- if .Values.openshift.enabled }}
26+
serviceAccountName: {{ .Values.openshift.serviceAccount.name }}
27+
securityContext:
28+
runAsNonRoot: {{ .Values.openshift.securityContext.runAsNonRoot }}
29+
seccompProfile:
30+
type: RuntimeDefault
31+
{{- end }}
2532
containers:
2633
- name: permitio-pdp
2734
image: "{{ .Values.pdp.image.repository }}:{{ .Values.pdp.image.tag }}"
2835
imagePullPolicy: {{ .Values.pdp.image.pullPolicy }}
36+
{{- if .Values.openshift.enabled }}
37+
securityContext:
38+
allowPrivilegeEscalation: false
39+
capabilities:
40+
drop:
41+
- ALL
42+
runAsNonRoot: {{ .Values.openshift.securityContext.runAsNonRoot }}
43+
seccompProfile:
44+
type: RuntimeDefault
45+
{{- end }}
2946
ports:
3047
- containerPort: {{ .Values.pdp.port }}
3148
env:
@@ -90,10 +107,16 @@ spec:
90107
port: 7000
91108
initialDelaySeconds: 10
92109
periodSeconds: 10
93-
{{- if .Values.pdp.logs_forwarder.enabled }}
94110
volumeMounts:
111+
{{- if .Values.pdp.logs_forwarder.enabled }}
95112
- name: logs
96113
mountPath: /tmp/
114+
{{- else if .Values.openshift.enabled }}
115+
# OpenShift requires explicit writable volumes
116+
- name: tmp-volume
117+
mountPath: /tmp
118+
- name: opa-volume
119+
mountPath: /opa
97120
{{- end }}
98121
{{- if .Values.pdp.logs_forwarder.enabled }}
99122
- name: fluentbit
@@ -110,11 +133,17 @@ spec:
110133
fieldRef:
111134
fieldPath: metadata.labels['app']
112135
{{- end }}
113-
{{- if .Values.pdp.logs_forwarder.enabled }}
114136
volumes:
137+
{{- if .Values.pdp.logs_forwarder.enabled }}
115138
- name: fluent-bit-config
116139
configMap:
117140
name: fluentbit-config
118141
- name: logs
119142
emptyDir: {}
143+
{{- else if .Values.openshift.enabled }}
144+
# OpenShift writable volumes
145+
- name: tmp-volume
146+
emptyDir: {}
147+
- name: opa-volume
148+
emptyDir: {}
120149
{{- end }}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{{- if and .Values.openshift.enabled .Values.openshift.serviceAccount.create }}
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: {{ .Values.openshift.serviceAccount.name }}
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
{{- include "pdp.labels" . | nindent 4 }}
9+
{{- end }}
10+
11+
{{- if and .Values.openshift.enabled .Values.openshift.serviceAccount.create }}
12+
---
13+
# RoleBinding to allow the ServiceAccount to use the specified SCC
14+
apiVersion: rbac.authorization.k8s.io/v1
15+
kind: RoleBinding
16+
metadata:
17+
name: {{ .Values.openshift.serviceAccount.name }}-scc-binding
18+
namespace: {{ .Release.Namespace }}
19+
labels:
20+
{{- include "pdp.labels" . | nindent 4 }}
21+
subjects:
22+
- kind: ServiceAccount
23+
name: {{ .Values.openshift.serviceAccount.name }}
24+
namespace: {{ .Release.Namespace }}
25+
roleRef:
26+
kind: ClusterRole
27+
name: system:openshift:scc:{{ .Values.openshift.serviceAccount.sccName }}
28+
apiGroup: rbac.authorization.k8s.io
29+
{{- end }}

charts/pdp/values.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pdp:
77
# - name: custom_env
88
# value: "custom_env"
99
ApiKey: "<your PDP API Key>"
10+
1011
# Use an existing secret for the API key instead of creating one
1112
# If defined, the chart will not create a secret and will use this existing secret
1213
# existingApiKeySecret:
@@ -41,3 +42,17 @@ resources:
4142
memory: "512Mi"
4243
limits:
4344
memory: "1Gi"
45+
46+
# OpenShift configuration
47+
openshift:
48+
enabled: false # Set to true for OpenShift deployments
49+
serviceAccount:
50+
create: true
51+
name: "permitio-pdp-sa"
52+
sccName: "restricted-v2" # OpenShift Security Context Constraint
53+
# Security context (SCC will override user/group settings automatically)
54+
securityContext:
55+
runAsNonRoot: true
56+
runAsUser: 1001
57+
runAsGroup: 1001
58+
fsGroup: 1001

0 commit comments

Comments
 (0)