Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expose username and password environment variables #140

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions charts/openfga/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,28 @@ spec:
key: "uri"
{{- end }}

{{- if .Values.datastore.username }}
- name: OPENFGA_DATASTORE_USERNAME
value: "{{ .Values.datastore.username }}"
{{- else if .Values.datastore.credentialsSecret }}
- name: OPENFGA_DATASTORE_USERNAME
valueFrom:
secretKeyRef:
name: "{{ .Values.datastore.credentialsSecret }}"
key: "{{ .Values.datastore.credentialsSecretUsernameKey }}"
{{- end }}

{{- if .Values.datastore.password }}
- name: OPENFGA_DATASTORE_PASSWORD
value: "{{ .Values.datastore.password }}"
{{- else if .Values.datastore.credentialsSecret }}
- name: OPENFGA_DATASTORE_PASSWORD
valueFrom:
secretKeyRef:
name: "{{ .Values.datastore.credentialsSecret }}"
key: "{{ .Values.datastore.credentialsSecretPasswordKey }}"
{{- end }}

{{- if .Values.datastore.maxCacheSize }}
- name: OPENFGA_DATASTORE_MAX_CACHE_SIZE
value: "{{ .Values.datastore.maxCacheSize }}"
Expand Down
22 changes: 22 additions & 0 deletions charts/openfga/templates/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,28 @@ spec:
key: "uri"
{{- end }}

{{- if .Values.datastore.username }}
- name: OPENFGA_DATASTORE_USERNAME
value: "{{ .Values.datastore.username }}"
{{- else if .Values.datastore.credentialsSecret }}
- name: OPENFGA_DATASTORE_USERNAME
valueFrom:
secretKeyRef:
name: "{{ .Values.datastore.credentialsSecret }}"
key: "{{ .Values.datastore.credentialsSecretUsernameKey }}"
{{- end }}

{{- if .Values.datastore.password }}
- name: OPENFGA_DATASTORE_PASSWORD
value: "{{ .Values.datastore.password }}"
{{- else if .Values.datastore.credentialsSecret }}
- name: OPENFGA_DATASTORE_PASSWORD
valueFrom:
secretKeyRef:
name: "{{ .Values.datastore.credentialsSecret }}"
key: "{{ .Values.datastore.credentialsSecretPasswordKey }}"
{{- end }}

{{- if .Values.migrate.timeout }}
- name: OPENFGA_TIMEOUT
value: "{{ .Values.migrate.timeout }}"
Expand Down
37 changes: 36 additions & 1 deletion charts/openfga/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
},
"additionalLabels": {
"type": "object",
"description": "additional labels to be added to the serivceMonitor resource",
"description": "additional labels to be added to the serviceMonitor resource",
"default": {}
},
"annotations": {
Expand Down Expand Up @@ -280,6 +280,41 @@
],
"description": "the secret name where to get the datastore URI, it expects a key named uri to exist in the secret"
},
"username": {
"type": [
"string",
"null"
],
"description": "the connection username to connect to the datastore (overwrites any username provided in the connection uri)"
},
"password": {
"type": [
"string",
"null"
],
"description": "the connection password to connect to the datastore (overwrites any password provided in the connection uri)"
},
"credentialsSecret": {
"type": [
"string",
"null"
],
"description": "the secret name where to get the username and password for the datastore database"
},
"credentialsSecretUsernameKey": {
"type": [
"string"
],
"description": "the key for the username in the credentialsSecret",
"default": "username"
},
"credentialsSecretPasswordKey": {
"type": [
"string"
],
"description": "the key for the password in the credentialsSecret",
"default": "password"
},
"maxCacheSize": {
"type": [
"integer",
Expand Down
7 changes: 6 additions & 1 deletion charts/openfga/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ telemetry:
##
enabled: false

## @param telemetry.metrics.serviceMonitor.additionalLabels additional labels to be added to the serivceMonitor resource
## @param telemetry.metrics.serviceMonitor.additionalLabels additional labels to be added to the serviceMonitor resource
##
additionalLabels: {}

Expand Down Expand Up @@ -190,6 +190,11 @@ datastore:
engine: memory
uri:
uriSecret:
username:
password:
credentialsSecret:
credentialsSecretUsernameKey: username
credentialsSecretPasswordKey: password
maxCacheSize:
maxOpenConns:
maxIdleConns:
Expand Down