diff --git a/deployment/kubernetes/charts/cogstack-helm-ce/Chart.lock b/deployment/kubernetes/charts/cogstack-helm-ce/Chart.lock index 3ce5072..eaa59bf 100644 --- a/deployment/kubernetes/charts/cogstack-helm-ce/Chart.lock +++ b/deployment/kubernetes/charts/cogstack-helm-ce/Chart.lock @@ -14,8 +14,8 @@ dependencies: - name: opensearch-dashboards repository: https://opensearch-project.github.io/helm-charts/ version: 3.5.0 -- name: jupyterhub +- name: cogstack-jupyterhub repository: file://charts/jupyterhub version: 0.1.0 -digest: sha256:0dbf6980653337af2efa16bb340d0a04dca9ed517bf4ab3c87044da348e8a84c -generated: "2026-02-27T16:13:56.822297965Z" +digest: sha256:d9fb8600b71642cbbdcfc0e9c4b512f3efedadf99544b3e81f97f0deb5a8469a +generated: "2026-03-03T17:30:34.27108704Z" diff --git a/deployment/kubernetes/charts/cogstack-helm-ce/README.md b/deployment/kubernetes/charts/cogstack-helm-ce/README.md index 53712fb..5002ace 100644 --- a/deployment/kubernetes/charts/cogstack-helm-ce/README.md +++ b/deployment/kubernetes/charts/cogstack-helm-ce/README.md @@ -24,19 +24,14 @@ helm install cogstack oci://registry-1.docker.io/cogstacksystems/cogstack-helm-c ``` ## Configuration - -Key values in `values.yaml`: +These are some values that are likely to need customization for your deployment: | Value | Default | Description | |-------|---------|-------------| -| `imagePullSecrets` | `[]` | Secrets for pulling images from a private registry. | -| `nameOverride` | `""` | Override the chart name used in resource names. | -| `fullnameOverride` | `""` | Override the full name used in resource names. | | `medcat-service.replicasCount` | `1` | Number of MedCAT service replicas. | | `anoncat-service.replicasCount` | `1` | Number of AnonCAT service replicas. | -| `anoncat-service.env.APP_ENABLE_DEMO_UI` | `true` | Enable AnonCAT demo UI. | -| `anoncat-service.env.DEID_MODE` | `true` | Run AnonCAT in de-identification mode. | | `anoncat-service.env.DEID_REDACT` | `false` | Redaction behaviour for de-identification. | +| `medcat-trainer.env.CSRF_TRUSTED_ORIGINS` | `"http://localhost:8080"` | CSRF trusted origins for MedCAT Trainer frontend (set correct value for your deployment, this default works for port forwarding). | Subcharts (MedCAT service, AnonCAT service, MedCAT Trainer) support additional options; see their respective charts under `../medcat-service-helm` and `../medcat-trainer-helm`. Pass them under the same keys as in this chart’s `values.yaml` (e.g. `medcat-service.*`, `anoncat-service.*`, `medcat-trainer-helm.*`). diff --git a/deployment/kubernetes/charts/cogstack-helm-ce/templates/NOTES.txt b/deployment/kubernetes/charts/cogstack-helm-ce/templates/NOTES.txt index 88b65d8..2d073a1 100644 --- a/deployment/kubernetes/charts/cogstack-helm-ce/templates/NOTES.txt +++ b/deployment/kubernetes/charts/cogstack-helm-ce/templates/NOTES.txt @@ -14,7 +14,7 @@ kubectl --namespace {{ .Release.Namespace }} port-forward $MEDCAT_POD_NAME 5000: export TRAINER_POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name=medcat-trainer,app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $TRAINER_POD_NAME -o jsonpath="{.spec.containers[?(@.name==\"nginx\")].ports[0].containerPort}") export CONTAINER_PORT_API=$(kubectl get pod --namespace {{ .Release.Namespace }} $TRAINER_POD_NAME -o jsonpath="{.spec.containers[?(@.name==\"medcat-trainer\")].ports[0].containerPort}") -kubectl --namespace {{ .Release.Namespace }} port-forward $TRAINER_POD_NAME 8000:$CONTAINER_PORT 8001:$CONTAINER_PORT_API & +kubectl --namespace {{ .Release.Namespace }} port-forward $TRAINER_POD_NAME 8080:$CONTAINER_PORT 8001:$CONTAINER_PORT_API & {{- if .Values.opensearch.enabled }} # 4. Opensearch @@ -38,7 +38,7 @@ kubectl --namespace {{ .Release.Namespace }} port-forward svc/$JUPYTERHUB_PROXY_ echo "Visit http://127.0.0.1:5000 to use MedCAT Service" echo "Visit http://127.0.0.1:5001 to use AnonCAT" -echo "Visit http://127.0.0.1:8000 to use MedCAT Trainer" +echo "Visit http://127.0.0.1:8080 to use MedCAT Trainer" {{ if .Values.opensearch.enabled }}echo "Visit https://127.0.0.1:9200 to use OpenSearch"{{- end }} {{ if index .Values "opensearch-dashboards" "enabled" }}echo "Visit http://127.0.0.1:5601 to use OpenSearch Dashboards"{{- end }} {{ if index .Values "cogstack-jupyterhub" "enabled" }}echo "Visit http://127.0.0.1:8000 to use jupyterhub"{{- end }} diff --git a/deployment/kubernetes/charts/cogstack-helm-ce/templates/medcat-trainer-provisioining.yaml b/deployment/kubernetes/charts/cogstack-helm-ce/templates/medcat-trainer-provisioining.yaml new file mode 100644 index 0000000..b0a50c4 --- /dev/null +++ b/deployment/kubernetes/charts/cogstack-helm-ce/templates/medcat-trainer-provisioining.yaml @@ -0,0 +1,29 @@ +{{- if and (index .Values "medcat-trainer" "provisioning" "enabled") (eq (index .Values "medcat-trainer" "provisioning" "existingConfigMap" "name") "cogstack-helm-ce-example-trainer-provisioining") }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ index .Values "medcat-trainer" "provisioning" "existingConfigMap" "name" }} +data: + provisioning.yaml: | + projects: + - dataset: + name: "Example Dataset - psych.csv" + url: "https://raw.githubusercontent.com/CogStack/cogstack-nlp/be9825f151da2d3b6faac80d49e5be91a1629c68/medcat-trainer/notebook_docs/example_data/psych.csv" + description: "Dataset from https://raw.githubusercontent.com/CogStack/cogstack-nlp/be9825f151da2d3b6faac80d49e5be91a1629c68/medcat-trainer/notebook_docs/example_data/psych.csv" + project: + name: "Example Project" + description: "Example project for medcat trainer using MedCAT Service" + annotationGuidelineLink: "https://docs.google.com/document/d/1xxelBOYbyVzJ7vLlztP2q1Kw9F5Vr1pRwblgrXPS7QM/edit?usp=sharing" + useModelService: true + modelServiceUrl: "http://{{ include "cogstack-helm-ce.fullname" . }}-medcat-service:5000" + - dataset: + name: "Example Dataset - psych.csv - deid" + url: "https://raw.githubusercontent.com/CogStack/cogstack-nlp/be9825f151da2d3b6faac80d49e5be91a1629c68/medcat-trainer/notebook_docs/example_data/psych.csv" + description: "Dataset from https://raw.githubusercontent.com/CogStack/cogstack-nlp/be9825f151da2d3b6faac80d49e5be91a1629c68/medcat-trainer/notebook_docs/example_data/psych.csv" + project: + name: "Example Deid project" + description: "Example project for medcat trainer using AnonCAT Service" + annotationGuidelineLink: "https://docs.google.com/document/d/1xxelBOYbyVzJ7vLlztP2q1Kw9F5Vr1pRwblgrXPS7QM/edit?usp=sharing" + useModelService: true + modelServiceUrl: "http://{{ include "cogstack-helm-ce.fullname" . }}-anoncat-service:5000" +{{- end }} \ No newline at end of file diff --git a/deployment/kubernetes/charts/cogstack-helm-ce/values.yaml b/deployment/kubernetes/charts/cogstack-helm-ce/values.yaml index 8c861f2..3d1b92b 100644 --- a/deployment/kubernetes/charts/cogstack-helm-ce/values.yaml +++ b/deployment/kubernetes/charts/cogstack-helm-ce/values.yaml @@ -24,6 +24,17 @@ medcat-service: repository: cogstacksystems/medcat-service tag: "1.2.0" + +medcat-trainer: + image: + tag: "latest@sha256:dcbd9f7c480dcb88e072189d233a146317f210a826573fd0c47d469da5360be0" + provisioning: + enabled: true + existingConfigMap: + name: "cogstack-helm-ce-example-trainer-provisioining" + env: + CSRF_TRUSTED_ORIGINS: "http://localhost:8080" + opensearch: enabled: true extraEnvs: diff --git a/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-configmap.yaml b/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-configmap.yaml index 3e86434..032564b 100644 --- a/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-configmap.yaml +++ b/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-configmap.yaml @@ -39,7 +39,3 @@ data: stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 autorestart=true -{{- if and .Values.provisioning .Values.provisioning.enabled }} - provisioning.yaml: | -{{ toYaml .Values.provisioning.config | indent 4 }} -{{- end }} \ No newline at end of file diff --git a/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-deployment.yaml b/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-deployment.yaml index d2ac692..19042f8 100644 --- a/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-deployment.yaml +++ b/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-deployment.yaml @@ -87,8 +87,8 @@ spec: name: api-static {{- if and .Values.provisioning .Values.provisioning.enabled }} - mountPath: /home/configs/provisioning.yaml - name: medcat-trainer-config - subPath: provisioning.yaml + name: medcat-trainer-provisioning-config + subPath: {{ .Values.provisioning.existingConfigMap.subPath | default "provisioning.yaml" }} {{- end }} {{- if eq .Values.DB_ENGINE "sqlite3" }} - mountPath: /home/api/db @@ -140,6 +140,15 @@ spec: - name: medcat-trainer-config configMap: name: {{ include "medcat-trainer-helm.fullname" . }}-config + {{- if and .Values.provisioning .Values.provisioning.enabled }} + - name: medcat-trainer-provisioning-config + configMap: + {{- if .Values.provisioning.existingConfigMap.name }} + name: {{ .Values.provisioning.existingConfigMap.name }} + {{- else }} + name: {{ include "medcat-trainer-helm.fullname" . }}-provisioning + {{- end }} + {{- end }} - name: api-media persistentVolumeClaim: claimName: {{ include "medcat-trainer-helm.fullname" . }}-api-media diff --git a/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-provisioning-configmap.yaml b/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-provisioning-configmap.yaml new file mode 100644 index 0000000..c967abb --- /dev/null +++ b/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-provisioning-configmap.yaml @@ -0,0 +1,11 @@ +{{- if (and .Values.provisioning .Values.provisioning.enabled) }} +{{- if not .Values.provisioning.existingConfigMap }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "medcat-trainer-helm.fullname" . }}-provisioning +data: + provisioning.yaml: | +{{ tpl (toYaml .Values.provisioning.config) . | indent 4 }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/deployment/kubernetes/charts/medcat-trainer-helm/values.yaml b/deployment/kubernetes/charts/medcat-trainer-helm/values.yaml index 70ab339..77161de 100644 --- a/deployment/kubernetes/charts/medcat-trainer-helm/values.yaml +++ b/deployment/kubernetes/charts/medcat-trainer-helm/values.yaml @@ -42,7 +42,11 @@ env: provisioning: # -- Set to true to enable provisioning of projects and models on startup.. enabled: false - # -- Put yaml file contents here.See https://docs.cogstack.org/projects/medcat-trainer/en/latest/provisioning/ + # -- Optional: Reference an existing configmap for the provisioning config. + existingConfigMap: {} + # -- The name of an existing configmap. Contains a yaml definition under the key "provisioining.yaml" + # name: "" + # -- Put yaml file contents here. Can be templated See https://docs.cogstack.org/projects/medcat-trainer/en/latest/provisioning/ config: projects: - dataset: diff --git a/deployment/kubernetes/local_dev_startup.sh b/deployment/kubernetes/local_dev_startup.sh index ddc876c..f94906d 100644 --- a/deployment/kubernetes/local_dev_startup.sh +++ b/deployment/kubernetes/local_dev_startup.sh @@ -25,4 +25,9 @@ helm test medcat-service --logs ## helm install trainer-registry oci://registry-1.docker.io/cogstacksystems/medcat-trainer-helm --wait --timeout 5m0s -helm upgrade cogstack-helm-ce ./cogstack-helm-ce --install --render-subchart-notes --wait --timeout 5m0s \ No newline at end of file +helm upgrade cogstack-helm-ce ./cogstack-helm-ce --install + +# Stop any running port forwards +# ps -ef | grep '[p]ort-forward' | awk '{print $2}' | xargs -r kill +# Port forward all services in cogstack-helm-ce +# helm get notes cogstack-helm-ce | bash \ No newline at end of file