Skip to content

Commit 4486184

Browse files
committed
feat!: support each namespace config fields to be provided as value or via env var
1 parent 199bd31 commit 4486184

3 files changed

Lines changed: 42 additions & 16 deletions

File tree

helm-charts/pharia-kernel/templates/deployment.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,17 @@ spec:
104104
name: {{ .Values.global.phariaAIConfigMap }}
105105
key: DOCUMENT_INDEX_URL
106106
{{- end }}
107+
{{- if and .Values.defaultNamespacesEnabled .Values.global.phariaAIConfigMap }}
108+
- name: NAMESPACES__ASSISTANT__CONFIG_URL
109+
valueFrom:
110+
configMapKeyRef:
111+
name: {{ .Values.global.phariaAIConfigMap }}
112+
key: PHARIA_ASSISTANT_API_SKILL_CONFIG
113+
- name: NAMESPACES__ASSISTANT__REGISTRY__REGISTRY
114+
value: "alephalpha.jfrog.io"
115+
- name: NAMESPACES__ASSISTANT__REGISTRY__REPOSITORY
116+
value: "assistant-skills"
117+
{{- end }}
107118
{{- with .Values.env }}
108119
{{- toYaml . | nindent 12 }}
109120
{{- end }}

helm-charts/pharia-kernel/templates/operator-config.yaml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,33 @@ metadata:
44
name: pharia-kernel-operator-config
55
data:
66
operator-config.toml: |
7-
{{- $namespaces := .Values.defaultNamespacesEnabled | ternary (merge .Values.defaultNamespaces .Values.namespaces) .Values.namespaces -}}
8-
{{- if $namespaces }}
9-
{{- range $k, $v := $namespaces }}
7+
{{- if .Values.namespaces }}
8+
{{- range $k, $v := .Values.namespaces }}
9+
{{- if or $v.config_url $v.config_access_token }}
1010
[namespaces.{{ $k }}]
11+
{{- end }}
12+
{{- if $v.config_url }}
1113
config_url = {{ $v.config_url | quote }}
12-
{{- if $v.config_access_token_env_var }}
13-
config_access_token_env_var = {{ $v.config_access_token_env_var | quote }}
1414
{{- end }}
15+
{{- if $v.config_access_token }}
16+
config_access_token = {{ $v.config_access_token | quote }}
17+
{{- end }}
18+
{{- if or $v.registry $v.repository $v.user $v.password }}
1519
[namespaces.{{ $k }}.registry]
1620
type = "oci"
21+
{{- end }}
22+
{{- if $v.registry }}
1723
registry = {{ $v.registry | quote }}
24+
{{- end }}
25+
{{- if $v.repository }}
1826
repository = {{ $v.repository | quote }}
19-
user_env_var = {{ $v.user_env_var | quote }}
20-
password_env_var = {{ $v.password_env_var | quote }}
27+
{{- end }}
28+
{{- if $v.user }}
29+
user = {{ $v.user | quote }}
30+
{{- end }}
31+
{{- if $v.password }}
32+
password = {{ $v.password | quote }}
33+
{{- end }}
2134
{{ end }}
2235
{{- else }}
2336
[namespaces]

helm-charts/pharia-kernel/values.yaml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,23 @@ service:
4646
metricsProtocol: TCP
4747
serviceMonitor:
4848
enabled: false
49-
# -- If the default namespaces are enabled, the provided namespaces with existing keys are ignored
49+
# -- If the default namespaces are enabled, the provided namespaces with existing keys are overwritten
5050
defaultNamespacesEnabled: false
51-
defaultNamespaces:
52-
assistant:
53-
config_url: "http://pharia-assistant-api.pharia-ai.svc.cluster.local/skills/skill-config"
54-
registry: alephalpha.jfrog.io
55-
repository: assistant-skills
56-
user_env_var: ALEPH_ALPHA_OCI_SKILL_REGISTRY_USER
57-
password_env_var: ALEPH_ALPHA_OCI_SKILL_REGISTRY_PASSWORD
5851
# -- Active namespaces for Pharia Kernel. e.g.:
5952
# playground:
6053
# config_url: "https://gitlab.aleph-alpha.de/api/v4/projects/997/repository/files/namespace.toml/raw?ref=main"
61-
# config_access_token_env_var: "GITLAB_CONFIG_ACCESS_TOKEN"
54+
# config_access_token: "GITLAB_CONFIG_ACCESS_TOKEN"
6255
# registry: "registry.gitlab.aleph-alpha.de"
6356
# repository: "engineering/pharia-kernel-playground/skills"
57+
# user: "REGISTRY_USER"
58+
# password: "REGISTRY_PASSWORD"
59+
# Each of the value can alternatively be provided as environment variables, which have higher precedence:
60+
# NAMESPACES__PLAYGROUND__CONFIG_URL
61+
# NAMESPACES__PLAYGROUND__CONFIG_ACCESS_TOKEN
62+
# NAMESPACES__PLAYGROUND__REGISTRY__REGISTRY
63+
# NAMESPACES__PLAYGROUND__REGISTRY__REPOSITORY
64+
# NAMESPACES__PLAYGROUND__REGISTRY__USER
65+
# NAMESPACES__PLAYGROUND__REGISTRY__PASSWORD
6466
namespaces: {}
6567
logLevel: info
6668
openTelemetryEndpoint: ""

0 commit comments

Comments
 (0)