Skip to content

Commit

Permalink
🐛 Update the deployment variables for kai to match latest (#379)
Browse files Browse the repository at this point in the history
Signed-off-by: Fabian von Feilitzsch <fabian@fabianism.us>
  • Loading branch information
fabianvf authored Sep 12, 2024
1 parent c6ec495 commit 80db9e2
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 40 deletions.
1 change: 1 addition & 0 deletions roles/tackle/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ kai_jwt_secret_name: kai-jwt-secret
kai_bam_secret_key: genai_key
kai_openai_secret_base_key: api_base
kai_openai_secret_api_key: api_key
kai_google_secret_key: google_key
kai_log_level: info
kai_enable_demo_mode: "false"
kai_enable_trace: "true"
Expand Down
38 changes: 20 additions & 18 deletions roles/tackle/templates/kai/kai-api-deployment.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -20,40 +20,35 @@ spec:
ports:
- containerPort: 8080
env:
- name: POSTGRESQL_HOST
- name: KAI__INCIDENT_STORE__ARGS__HOST
valueFrom:
secretKeyRef:
name: "{{ kai_db_secret_name }}"
name: "{{ kai_database_secret_name }}"
key: POSTGRESQL_HOST
- name: POSTGRESQL_DATABASE
- name: KAI__INCIDENT_STORE__ARGS__DATABASE
valueFrom:
secretKeyRef:
name: "{{ kai_db_secret_name }}"
name: "{{ kai_database_secret_name }}"
key: POSTGRESQL_DATABASE
- name: POSTGRESQL_DB
- name: KAI__INCIDENT_STORE__ARGS__PASSWORD
valueFrom:
secretKeyRef:
name: "{{ kai_db_secret_name }}"
key: POSTGRESQL_DATABASE
- name: POSTGRESQL_PASSWORD
valueFrom:
secretKeyRef:
name: "{{ kai_db_secret_name }}"
name: "{{ kai_database_secret_name }}"
key: POSTGRESQL_PASSWORD
- name: POSTGRESQL_USER
- name: KAI__INCIDENT_STORE__ARGS__USER
valueFrom:
secretKeyRef:
name: "{{ kai_db_secret_name }}"
name: "{{ kai_database_secret_name }}"
key: POSTGRESQL_USER
- name: DEMO_MODE
- name: KAI__DEMO_MODE
value: "False"
- name: HUB_URL
- name: KAI__HUB_URL
value: "{{ hub_url }}"
- name: IMPORTER_ARGS
- name: KAI__IMPORTER_ARGS
value: ""
- name: LOGLEVEL
- name: KAI__LOG_LEVEL
value: "info"
- name: NUM_WORKERS
- name: KAI__GUNICORN_WORKERS
value: "8"
- name: USE_HUB_IMPORTER
value: "True"
Expand All @@ -77,6 +72,13 @@ spec:
secretKeyRef:
name: "{{ kai_api_key_secret_name }}"
key: "{{ kai_openai_secret_api_key }}"
{% endif %}
{% if kai_api_key_secret_status.resources.0.data[kai_google_secret_key]|default(false) %}
- name: OPENAI_API_KEY
valueFrom:
secretKeyRef:
name: "{{ kai_api_key_secret_name }}"
key: "{{ kai_openai_secret_api_key }}"
{% endif %}
volumeMounts:
- name: config-volume
Expand Down
6 changes: 0 additions & 6 deletions roles/tackle/templates/kai/kai-config.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ metadata:
namespace: "{{ app_namespace }}"
data:
kai-config.toml: |
# TODO: Make all these configurable via ansible
log_level = "{{ kai_log_level }}"
file_log_level = "debug"
log_dir = "/podman_compose/logs"
Expand All @@ -24,14 +23,9 @@ data:
host = "kai-db"
database = "kai"
user = "kai"
# TODO: This may need to be envvar only
password = "{{ pg_password }}"

[models]
provider = "{{ kai_model_provider }}"

[models.args]
model_id = "{{ kai_model_id }}"

[embeddings]
todo = true
6 changes: 3 additions & 3 deletions roles/tackle/templates/kai/kai-db-deployment.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ spec:
- name: POSTGRESQL_DATABASE
valueFrom:
secretKeyRef:
name: "{{ kai_db_secret_name }}"
name: "{{ kai_database_secret_name }}"
key: POSTGRESQL_DATABASE
- name: POSTGRESQL_PASSWORD
valueFrom:
secretKeyRef:
name: "{{ kai_db_secret_name }}"
name: "{{ kai_database_secret_name }}"
key: POSTGRESQL_PASSWORD
- name: POSTGRESQL_USER
valueFrom:
secretKeyRef:
name: "{{ kai_db_secret_name }}"
name: "{{ kai_database_secret_name }}"
key: POSTGRESQL_USER
volumeMounts:
- mountPath: /var/lib/postgresql/data
Expand Down
35 changes: 22 additions & 13 deletions roles/tackle/templates/kai/kai-importer-deployment.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,37 @@ spec:
- name: kai-hub-importer
image: "{{ kai_fqin }}"
env:
- name: POSTGRESQL_HOST
- name: CUSTOM_CONFIG_FLAG
value: "--config_filepath=/podman_compose/kai-config.toml"
- name: KAI__INCIDENT_STORE__ARGS__HOST
valueFrom:
secretKeyRef:
name: "{{ kai_database_secret_name }}"
key: POSTGRESQL_HOST
- name: POSTGRESQL_DATABASE
- name: KAI__INCIDENT_STORE__ARGS__DATABASE
valueFrom:
secretKeyRef:
name: "{{ kai_database_secret_name }}"
key: POSTGRESQL_DB
- name: POSTGRESQL_PASSWORD
key: POSTGRESQL_DATABASE
- name: KAI__INCIDENT_STORE__ARGS__PASSWORD
valueFrom:
secretKeyRef:
name: "{{ kai_database_secret_name }}"
key: POSTGRESQL_PASSWORD
- name: POSTGRESQL_USER
- name: KAI__INCIDENT_STORE__ARGS__USER
valueFrom:
secretKeyRef:
name: "{{ kai_database_secret_name }}"
key: POSTGRESQL_USER
- name: DEMO_MODE
value: "{{ kai_enable_demo_mode }}"
- name: HUB_URL
- name: KAI__DEMO_MODE
value: "False"
- name: KAI__HUB_URL
value: "{{ hub_url }}"
- name: IMPORTER_ARGS
value: "{{ kai_hub_importer_args }}"
- name: LOGLEVEL
value: "{{ kai_log_level }}"
- name: NUM_WORKERS
- name: KAI__IMPORTER_ARGS
value: ""
- name: KAI__LOG_LEVEL
value: "info"
- name: KAI__GUNICORN_WORKERS
value: "8"
- name: USE_HUB_IMPORTER
value: "True"
Expand Down Expand Up @@ -77,6 +79,13 @@ spec:
secretKeyRef:
name: "{{ kai_api_key_secret_name }}"
key: "{{ kai_openai_secret_api_key }}"
{% endif %}
{% if kai_api_key_secret_status.resources.0.data[kai_google_secret_key]|default(false) %}
- name: OPENAI_API_KEY
valueFrom:
secretKeyRef:
name: "{{ kai_api_key_secret_name }}"
key: "{{ kai_openai_secret_api_key }}"
{% endif %}
volumeMounts:
- name: config-volume
Expand Down

0 comments on commit 80db9e2

Please sign in to comment.