Skip to content

Commit

Permalink
chore(helm): add OpenFGA read replica
Browse files Browse the repository at this point in the history
  • Loading branch information
donch1989 committed Mar 28, 2024
1 parent d5d80ba commit 5cb7342
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ INFLUXDB_PORT=8086

# opengfa
OPENFGA_IMAGE=openfga/openfga
OPENFGA_VERSION=v1.3.7
OPENFGA_VERSION=v1.5.1
OPENFGA_HOST=openfga

# otel
Expand Down
2 changes: 2 additions & 0 deletions charts/core/templates/mgmt-backend/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ data:
password: {{ .Values.database.external_replica.password | default "" }}
host: {{ .Values.database.external_replica.host | default "" }}
port: {{ .Values.database.external_replica.port | default "" }}
replicationtimeframe: 1
{{- end }}
name: mgmt
version: {{ .Values.mgmtBackend.dbVersion }}
Expand Down Expand Up @@ -71,6 +72,7 @@ data:
replica:
host: {{ template "core.openfga" . }}
port: 8082
replicationtimeframe: 1
{{- end }}
temporal:
hostport: {{ default (printf "%s-frontend-headless:%s" (include "core.temporal" .) (include "core.temporal.frontend.grpcPort" .)) .Values.mgmtBackend.temporal.hostPort }}
Expand Down
2 changes: 2 additions & 0 deletions charts/core/templates/model-backend/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ data:
password: {{ .Values.database.external_replica.password | default "" }}
host: {{ .Values.database.external_replica.host | default "" }}
port: {{ .Values.database.external_replica.port | default "" }}
replicationtimeframe: 1
{{- end }}
name: model
version: {{ .Values.modelBackend.dbVersion }}
Expand Down Expand Up @@ -107,6 +108,7 @@ data:
replica:
host: {{ template "core.openfga" . }}
port: 8082
replicationtimeframe: 1
{{- end }}
registry:
host: {{ template "core.registry" . }}
Expand Down
16 changes: 6 additions & 10 deletions charts/core/templates/openfga/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,8 @@ spec:
env:
- name: OPENFGA_DATASTORE_ENGINE
value: postgres
- name: PGDATABASE
value: openfga
- name: PGHOST
value: "{{ default (include "core.database.host" .) .Values.database.external.host }}"
- name: PGPORT
value: "{{ default (include "core.database.port" .) .Values.database.external.port }}"
- name: PGUSER
value: "{{ default (include "core.database.username" .) .Values.database.external.username }}"
- name: PGPASSWORD
value: "{{ default (include "core.database.rawPassword" .) .Values.database.external.password }}"
- name: OPENFGA_DATASTORE_URI
value: postgres://{{ .Values.database.external.username }}:{{ .Values.database.external.password }}@{{ .Values.database.external.host }}:{{ .Values.database.external.port }}/openfga?sslmode=disable
containers:
- name: openfga
image: {{ .Values.openfga.image.repository }}:{{ .Values.openfga.image.tag }}
Expand Down Expand Up @@ -121,6 +113,8 @@ spec:
ports:
- containerPort: 8080
protocol: TCP
- containerPort: 8081
protocol: TCP
{{- if .Values.database.external_replica }}
- name: openfga-read-replica
image: {{ .Values.openfga.image.repository }}:{{ .Values.openfga.image.tag }}
Expand Down Expand Up @@ -152,6 +146,8 @@ spec:
ports:
- containerPort: 8082
protocol: TCP
- containerPort: 8083
protocol: TCP
{{- end }}
{{- with .Values.openfga.nodeSelector }}
nodeSelector:
Expand Down
6 changes: 6 additions & 0 deletions charts/core/templates/openfga/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@ spec:
- name: openfga
port: 8080
targetPort: 8080
- name: openfga-grpc
port: 8081
targetPort: 8081
{{- if .Values.database.external_replica }}
- name: openfga-read-replica
port: 8082
targetPort: 8082
- name: openfga-read-replica-grpc
port: 8083
targetPort: 8083
{{- end }}
selector:
{{- include "core.matchLabels" . | nindent 4 }}
Expand Down
6 changes: 4 additions & 2 deletions charts/core/templates/pipeline-backend/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ data:
password: {{ .Values.database.external_replica.password | default "" }}
host: {{ .Values.database.external_replica.host | default "" }}
port: {{ .Values.database.external_replica.port | default "" }}
replicationtimeframe: 1
{{- end }}
name: pipeline
version: {{ .Values.pipelineBackend.dbVersion }}
Expand Down Expand Up @@ -96,9 +97,10 @@ data:
port: {{ template "core.otel.port" . }}
openfga:
host: {{ template "core.openfga" . }}
port: 8080
port: 8081
{{- if .Values.database.external_replica }}
replica:
host: {{ template "core.openfga" . }}
port: 8082
port: 8083
replicationtimeframe: 1
{{- end }}
2 changes: 1 addition & 1 deletion charts/core/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1346,7 +1346,7 @@ grafana:
openfga:
image:
repository: openfga/openfga
tag: v1.3.7
tag: v1.5.1
pullPolicy: IfNotPresent
# -- Set the service account to be used, default if left empty
serviceAccountName: ""
Expand Down

0 comments on commit 5cb7342

Please sign in to comment.