Skip to content

Commit

Permalink
Merge pull request #57 from antaka1/feature/dynamic-opal-server-url
Browse files Browse the repository at this point in the history
feat: Enhance client deployment to receive custom server url
  • Loading branch information
RazcoDev authored Dec 18, 2023
2 parents 116e6b2 + e95cfe4 commit f027a36
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions templates/deployment-client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,13 @@ spec:
- name: UVICORN_NUM_WORKERS
value: "1"
{{- if .Values.server }}
{{- if .Values.client.serverUrl }}
- name: OPAL_SERVER_URL
value: {{ .Values.client.serverUrl | quote }}
{{- else }}
- name: OPAL_SERVER_URL
value: {{ printf "http://%s:%v" (include "opal.serverName" .) .Values.server.port | quote }}
{{- end}}
{{- if not (or (.Values.server.dataConfigSources.external_source_url) (.Values.server.dataConfigSources.config) (hasKey .Values.client.extraEnv "OPAL_DATA_UPDATER_ENABLED") ) }}
- name: OPAL_DATA_UPDATER_ENABLED
value: "False"
Expand Down
4 changes: 4 additions & 0 deletions values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@
"opaStartupData": {
"type": "object", "title": "client startup data for embedded opa", "default": null
},
"serverUrl": {
"type": "string",
"title": "opal server url for client to connect to"
},
"secrets": {
"type": "array",
"title": "name of a kubernetes secret from where to fetch secret environment variables.",
Expand Down
6 changes: 4 additions & 2 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ server:
# external_source_url: "https://your-api.com/path/to/api/endpoint"

# Option #3 - Example static data sources (endpoint is empty by default)
# config:
# config:
# entries:
# - url: http://opal-server:7002/policy-data
# topics: ["policy_data"]
Expand All @@ -47,4 +47,6 @@ client:
port: 7000
opaPort: 8181
replicas: 1
extraEnv: {}
# If you need to specify a custom hostname for the opal-sever, configure the serverUrl property
# serverUrl: http://custom-hostname-for-opal:opal-port
extraEnv: {}

0 comments on commit f027a36

Please sign in to comment.