Skip to content

Commit

Permalink
Update Chatbots Helm charts
Browse files Browse the repository at this point in the history
Update Helm repo automaiton to include chatbots
Fix typo in readme
Refactor Chatbots deployment for Helm changes
  • Loading branch information
NeonDaniel committed Nov 7, 2023
1 parent 865ef1b commit d82b721
Show file tree
Hide file tree
Showing 20 changed files with 51 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Helm_Deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ helm install klat-chat <output_path>/klat-chat --namespace backend
```
### Chatbots
fter [the backend](#diana-backend) has been deployed, Chatbots services may also
After [the backend](#diana-backend) has been deployed, Chatbots services may also
be deployed to the same namespace. If you were prompted to configure Chatbots when setting
up the backend, then the Helm charts and configuration has already been completed.
Expand Down
11 changes: 3 additions & 8 deletions neon_diana_utils/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,24 +549,19 @@ def configure_chatbots(rmq_path: str = None,
return
try:
if orchestrator == Orchestrator.KUBERNETES:
shutil.copytree(join(dirname(__file__), "helm_charts", "chatbots"),
shutil.copytree(join(dirname(__file__), "templates", "chatbots"),
join(output_path, "chatbots"))
# Cleanup any leftover build files
for root, _, files in walk(join(output_path, "chatbots")):
for file in files:
if any((file.endswith(x) for x in (".lock", ".tgz"))):
remove(join(root, file))
else:
raise RuntimeError(f"{orchestrator} is not yet supported")

if prompt_update_rmq and click.confirm("Configure RabbitMQ for chatbots?"):
update_rmq_config(rmq_config)
click.echo(f"Updated RabbitMQ config file: {rmq_config}")
chatbots_config = _get_chatbots_mq_config(rmq_config)
with open(join(output_path, "chatbots", "chatbots_config.json"), 'w+') as f:
with open(join(output_path, "chatbots",
"chatbots_config.json"), 'w+') as f:
json.dump(chatbots_config, f, indent=2)
click.echo(f"Outputs generated in {output_path}")
# TODO: Prompt to continue to Klat Chat config

except Exception as e:
click.echo(e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ name: chatbots
description: Deploy Chatbots

type: application
version: 0.0.1
version: 0.0.2
appVersion: "1.0.1a2"
dependencies:
- name: cbf-facilitators
alias: cbf-facilitators
version: 0.0.1
repository: file://charts/facilitators
repository: file://../facilitators
- name: cbf-subminds
alias: cbf-subminds
version: 0.0.1
repository: file://charts/subminds
repository: file://../subminds
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{- define "cbf_config.configmap"}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ tpl .Values.chatbots.configMap . }}
data:
"{{ tpl .Values.chatbots.configFilename . }}": |
{{ tpl .Values.chatbots.cbfConfig . | nindent 4}}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Chart.Name }}
name: {{ default .Chart.Name .Values.serviceName }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
neon.diana.service: {{ .Chart.Name }}
neon.diana.service: {{ default .Chart.Name .Values.serviceName }}
strategy:
type: Recreate
template:
metadata:
annotations:
releaseTime: {{ dateInZone "2006-01-02 15:04:05Z" (now) "UTC"| quote }}
labels:
neon.diana.service: {{ .Chart.Name }}
neon.diana.service: {{ default .Chart.Name .Values.serviceName }}
neon.project.name: chatbots
neon.service.class: facilitators
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ kind: Service
metadata:
labels:
neon.project.name: chatbots
neon.diana.service: {{ .Chart.Name }}
neon.diana.service: {{ default .Chart.Name .Values.serviceName }}
neon.service.class: facilitators
name: {{ .Chart.Name }}
name: {{ default .Chart.Name .Values.serviceName }}
spec:
clusterIP: None
selector:
neon.diana.service: {{ .Chart.Name }}
neon.diana.service: {{ default .Chart.Name .Values.serviceName }}
ports:
- name: headless
port: 55555
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
replicaCount: 1
serviceName: cbf-facilitators
configMap: chatbots-config
configFilename: config.json
images:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Chart.Name }}
name: {{ default .Chart.Name .Values.serviceName }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
neon.diana.service: {{ .Chart.Name }}
neon.diana.service: {{ default .Chart.Name .Values.serviceName }}
strategy:
type: Recreate
template:
metadata:
annotations:
releaseTime: {{ dateInZone "2006-01-02 15:04:05Z" (now) "UTC"| quote }}
labels:
neon.diana.service: {{ .Chart.Name }}
neon.diana.service: {{ default .Chart.Name .Values.serviceName }}
neon.project.name: chatbots
neon.service.class: facilitators
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ kind: Service
metadata:
labels:
neon.project.name: chatbots
neon.diana.service: {{ .Chart.Name }}
neon.diana.service: {{ default .Chart.Name .Values.serviceName }}
neon.service.class: facilitators
name: {{ .Chart.Name }}
name: {{ default .Chart.Name .Values.serviceName }}
spec:
clusterIP: None
selector:
neon.diana.service: {{ .Chart.Name }}
neon.diana.service: {{ default .Chart.Name .Values.serviceName }}
ports:
- name: headless
port: 55555
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
replicaCount: 1
serviceName: cbf-subminds
configMap: chatbots-config
configFilename: config.json
configEnvVar: "CONFIG_PATH"
Expand Down

This file was deleted.

12 changes: 12 additions & 0 deletions neon_diana_utils/templates/chatbots/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v2
name: chatbots-deployment
description: A Helm chart to deploy Chatbots

type: application
version: 1.0.0
appVersion: "1.0.1a5"

dependencies:
- name: chatbots
version: 0.0.2
repository: https://neongeckocom.github.io/neon-diana-utils
3 changes: 3 additions & 0 deletions neon_diana_utils/templates/chatbots/templates/config-map.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{- $_cbf_config := .Files.Get "chatbots_config.json" -}}
{{ $_ := set .Values.chatbots "cbfConfig" $_cbf_config }}
{{- include "cbf_config.configmap" . }}
6 changes: 6 additions & 0 deletions scripts/build_helm_charts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ for d in ../neon_diana_utils/helm_charts/klat/*; do
done
helm package ../neon_diana_utils/helm_charts/klat/*

# Package Chatbots
for d in ../neon_diana_utils/helm_charts/chatbots/*; do
helm dependency update "${d}" > /dev/null
done
helm package ../neon_diana_utils/helm_charts/chatbots/*

# Make sure existing charts aren't touched (new charts get new versions)
git reset --hard HEAD

Expand Down

0 comments on commit d82b721

Please sign in to comment.