Skip to content

Commit

Permalink
Use kube-authz-proxy with dbgate
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Jul 8, 2024
1 parent 9db0126 commit f6560f8
Show file tree
Hide file tree
Showing 7 changed files with 157 additions and 1 deletion.
15 changes: 15 additions & 0 deletions charts/dbgate/templates/cluster-role-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# to delegate authentication and authorization
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "dbgate.fullname" . }}-auth-delegator
labels:
{{- include "dbgate.labels" . | nindent 4 }}
roleRef:
kind: ClusterRole
apiGroup: rbac.authorization.k8s.io
name: system:auth-delegator
subjects:
- kind: ServiceAccount
name: {{ include "dbgate.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
35 changes: 35 additions & 0 deletions charts/dbgate/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,41 @@ spec:
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}

{{ if .Values.authzProxy.enabled }}
- name: authz-proxy
securityContext:
{{- toYaml .Values.authzProxy.securityContext | nindent 12 }}
image: "{{ .Values.authzProxy.repository }}:{{ .Values.authzProxy.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- run
- --listen={{ .Values.authzProxy.params.listen }}
- --metrics-addr={{ .Values.authzProxy.params.metricsAddr }}
- --platform-url={{ .Values.authzProxy.params.platformURL }}
# - --platform-ca-file=<mount-csi-driver>
- --secret-name={{ .Values.app.authSecret.name }}
- --secret-namespace={{ .Release.Namespace }}
- --target-url=http://localhost:3000
ports:
- name: proxy
containerPort: {{ .Values.authzProxy.params.listen }}
protocol: TCP
- name: metrics
containerPort: {{ .Values.authzProxy.params.metricsAddr }}
protocol: TCP
# livenessProbe:
# httpGet:
# path: /
# port: http
# readinessProbe:
# httpGet:
# path: /
# port: http
resources:
{{- toYaml .Values.authzProxy.resources | nindent 12 }}
{{ end }}

{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/dbgate/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
targetPort: {{ if .Values.authzProxy.enabled }}"proxy"{{ else }}"http"{{ end }}
protocol: TCP
name: http
selector:
Expand Down
1 change: 1 addition & 0 deletions charts/dbgate/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ metadata:
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
automountServiceAccountToken: true
{{- end }}
27 changes: 27 additions & 0 deletions charts/dbgate/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,30 @@ app:
bind:
name: ""
namespace: ""

authzProxy:
enabled: true
# KubeDB operator container image
repository: ghcr.io/appscode/kube-authz-proxy
# KubeDB operator container image tag
tag: "v0.0.1"
# Security options this container should run with
securityContext: # +doc-gen:break
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 65534
seccompProfile:
type: RuntimeDefault
# Compute Resources required by this container
resources: {}
# requests:
# cpu: 100m
# memory: 128Mi
params:
listen: 8000
metricsAddr: 8080
platformURL: https://accounts.tamal-k3s-chennai-com-nhsee.bytebuilders.xyz
platform-ca-file: <mount-csi-driver>
46 changes: 46 additions & 0 deletions charts/pgadmin/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,52 @@ spec:
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: authz-proxy
args:
- --listen=8000
- --metrics-addr=8080
- --platform-url=<https://api.appscode.com>
- --platform-ca-file=<mount-csi-driver>
- --secret-name=<auth-secret>
- --secret-namespace=${Release.namespace}
- --target-url=http://localhost:<pgadmin-port>


authProxy:
# Docker registry used to pull KubeDB operator image
registry: kubedb
# KubeDB operator container image
repository: kubedb-provisioner
# KubeDB operator container image tag
tag: ""
# Security options this container should run with
securityContext: # +doc-gen:break
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 65534
# seccompProfile:
# type: RuntimeDefault
# Compute Resources required by this container
resources: {}
# requests:
# cpu: 100m
# memory: 128Mi
enable: <>
- --listen=8000
- --metrics-addr=8080
- --platform-url=<https://api.appscode.com>
- --platform-ca-file=<mount-csi-driver>
- --secret-name=<auth-secret>
- --secret-namespace=${Release.namespace}
- --target-url=http://localhost:<pgadmin-port>





- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
Expand Down
32 changes: 32 additions & 0 deletions charts/pgadmin/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,35 @@ app:
bind:
name: ""
namespace: ""

authzProxy:
enable: <>
# Docker registry used to pull KubeDB operator image
registry: appscode
# KubeDB operator container image
repository: kube-authz-proxy
# KubeDB operator container image tag
tag: "v0.0.1"
# Security options this container should run with
securityContext: # +doc-gen:break
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 65534
seccompProfile:
type: RuntimeDefault
# Compute Resources required by this container
resources: {}
# requests:
# cpu: 100m
# memory: 128Mi
params:
listen: 8000
metricsAddr: 8080
platformURL: <https://api.appscode.com>
platform-ca-file: <mount-csi-driver>
secretName: <auth-secret>
secretNamespace: ${Release.namespace}
targetURL: http://localhost:<pgadmin-port>

0 comments on commit f6560f8

Please sign in to comment.