Skip to content

Commit

Permalink
Access control support
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonslayer27 authored and hashhar committed Apr 5, 2022
1 parent 148ee99 commit 2438f79
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 0 deletions.
1 change: 1 addition & 0 deletions charts/trino/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ The following table lists the configurable parameters of the Trino chart and the
| `server.autoscaling.enabled` | | `false` |
| `server.autoscaling.maxReplicas` | | `5` |
| `server.autoscaling.targetCPUUtilizationPercentage` | | `50` |
| `accessControl` | | `{}` |
| `additionalNodeProperties` | | `{}` |
| `additionalConfigProperties` | | `{}` |
| `additionalLogProperties` | | `{}` |
Expand Down
25 changes: 25 additions & 0 deletions charts/trino/templates/configmap-coordinator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ data:
{{- end }}
{{ .Values.server.coordinatorExtraConfig | indent 4 }}

{{- if .Values.accessControl }}{{- if eq .Values.accessControl.type "configmap" }}
access-control.properties: |
access-control.name=file
{{- if .Values.accessControl.refreshPeriod }}
security.refresh-period={{ .Values.accessControl.refreshPeriod }}
{{- end }}
security.config-file={{ .Values.server.config.path }}/access-control/{{ .Values.accessControl.configFile | default "rules.json" }}
{{- end }}{{- end }}

exchange-manager.properties: |
exchange-manager.name={{ .Values.server.exchangeManager.name }}
exchange.base-directory={{ .Values.server.exchangeManager.baseDir }}
Expand Down Expand Up @@ -89,3 +98,19 @@ data:
{{ end }}

---

{{- if .Values.accessControl }}{{- if eq .Values.accessControl.type "configmap" }}
apiVersion: v1
kind: ConfigMap
metadata:
name: trino-access-control-volume-coordinator
labels:
{{- include "trino.labels" . | nindent 4 }}
app.kubernetes.io/component: coordinator
data:
{{- range $key, $val := .Values.accessControl.rules }}
{{ $key }}: {{ $val | quote }}
{{- end }}
{{- end }}{{- end }}

---
9 changes: 9 additions & 0 deletions charts/trino/templates/deployment-coordinator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ spec:
- name: catalog-volume
configMap:
name: {{ template "trino.catalog" . }}
{{- if .Values.accessControl }}{{- if eq .Values.accessControl.type "configmap" }}
- name: access-control-volume
configMap:
name: trino-access-control-volume-coordinator
{{- end }}{{- end }}
{{- if eq .Values.server.config.authenticationType "PASSWORD" }}
- name: password-volume
secret:
Expand Down Expand Up @@ -61,6 +66,10 @@ spec:
name: config-volume
- mountPath: {{ .Values.server.config.path }}/catalog
name: catalog-volume
{{- if .Values.accessControl }}{{- if eq .Values.accessControl.type "configmap" }}
- mountPath: {{ .Values.server.config.path }}/access-control
name: access-control-volume
{{- end }}{{- end }}
{{- range .Values.secretMounts }}
- name: {{ .name }}
mountPath: {{ .path }}
Expand Down
51 changes: 51 additions & 0 deletions charts/trino/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,57 @@ server:
maxReplicas: 5
targetCPUUtilizationPercentage: 50

accessControl: {}
# type: configmap
# refreshPeriod: 60s
# # Rules file is mounted to /etc/trino/access-control
# configFile: "rules.json"
# rules:
# rules.json: |-
# {
# "catalogs": [
# {
# "user": "admin",
# "catalog": "(mysql|system)",
# "allow": "all"
# },
# {
# "group": "finance|human_resources",
# "catalog": "postgres",
# "allow": true
# },
# {
# "catalog": "hive",
# "allow": "all"
# },
# {
# "user": "alice",
# "catalog": "postgresql",
# "allow": "read-only"
# },
# {
# "catalog": "system",
# "allow": "none"
# }
# ],
# "schemas": [
# {
# "user": "admin",
# "schema": ".*",
# "owner": true
# },
# {
# "user": "guest",
# "owner": false
# },
# {
# "catalog": "default",
# "schema": "default",
# "owner": true
# }
# ]
# }

additionalNodeProperties: {}

additionalConfigProperties: {}
Expand Down

0 comments on commit 2438f79

Please sign in to comment.