From 6406d5907aaf5e71c3893cb928c2b7596b6dc18b Mon Sep 17 00:00:00 2001 From: 10alejospain <10alejo.est@gmail.com> Date: Thu, 7 Dec 2023 14:15:59 +0100 Subject: [PATCH] changes on k8s deployment WIP --- .dockerignore | 5 +- .../002_connection-details.yaml | 14 +++++ ...ment.yaml => 003_OMOP-CDM-Deployment.yaml} | 0 ...Service.yaml => 004-OMOP-CDM-Service.yaml} | 0 .../005_ohdsi-api-deployment.yaml | 60 +++++++++++++++++++ kubernetes/istio/001_datamesh-ns.yaml | 6 -- ...mop-secrets.yaml => 001_omop-secrets.yaml} | 1 + kubernetes/istio/002_connection-details.yaml | 14 +++++ kubernetes/istio/002_mtls-policy.yaml | 8 --- kubernetes/istio/003_gateway.yaml | 15 ----- ...t.yaml => 003_omop-db-cdm-deployment.yaml} | 0 ...esh.yaml => 004_omop-db-svc-datamesh.yaml} | 0 ...vocab-job.yaml => 005_omop-vocab-job.yaml} | 0 13 files changed, 93 insertions(+), 30 deletions(-) create mode 100644 kubernetes/bare-kubernetes/002_connection-details.yaml rename kubernetes/bare-kubernetes/{002_OMOP-CDM-Deployment.yaml => 003_OMOP-CDM-Deployment.yaml} (100%) rename kubernetes/bare-kubernetes/{003-OMOP-CDM-Service.yaml => 004-OMOP-CDM-Service.yaml} (100%) create mode 100644 kubernetes/bare-kubernetes/005_ohdsi-api-deployment.yaml delete mode 100644 kubernetes/istio/001_datamesh-ns.yaml rename kubernetes/istio/{004_omop-secrets.yaml => 001_omop-secrets.yaml} (77%) create mode 100644 kubernetes/istio/002_connection-details.yaml delete mode 100644 kubernetes/istio/002_mtls-policy.yaml delete mode 100644 kubernetes/istio/003_gateway.yaml rename kubernetes/istio/{005_omop-db-cdm-deployment.yaml => 003_omop-db-cdm-deployment.yaml} (100%) rename kubernetes/istio/{006_omop-db-svc-datamesh.yaml => 004_omop-db-svc-datamesh.yaml} (100%) rename kubernetes/istio/{007_omop-vocab-job.yaml => 005_omop-vocab-job.yaml} (100%) diff --git a/.dockerignore b/.dockerignore index 2e1fa2d..42eb8ce 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,4 @@ -*.md \ No newline at end of file +*.md +.env +assets/* +kubernetes/* \ No newline at end of file diff --git a/kubernetes/bare-kubernetes/002_connection-details.yaml b/kubernetes/bare-kubernetes/002_connection-details.yaml new file mode 100644 index 0000000..7646aec --- /dev/null +++ b/kubernetes/bare-kubernetes/002_connection-details.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: connection-details +data: + CELERY_BROKER_URL: "amqp://guest:guest@rabbitmq:5672/" + CELERY_RESULT_BACKEND: "db+postgresql://postgres:mysecretpassword@db/omopdb" + OMOP_DBMS: "postgresql" + OMOP_SERVER: "host.docker.internal" + OMOP_PORT: "5432" + OMOP_USER: "postgres" + OMOP_PASSWORD: "mysecretpassword" + OMOP_DATABASE: "omopdb" + OMOP_SCHEMA: "omopcdm" \ No newline at end of file diff --git a/kubernetes/bare-kubernetes/002_OMOP-CDM-Deployment.yaml b/kubernetes/bare-kubernetes/003_OMOP-CDM-Deployment.yaml similarity index 100% rename from kubernetes/bare-kubernetes/002_OMOP-CDM-Deployment.yaml rename to kubernetes/bare-kubernetes/003_OMOP-CDM-Deployment.yaml diff --git a/kubernetes/bare-kubernetes/003-OMOP-CDM-Service.yaml b/kubernetes/bare-kubernetes/004-OMOP-CDM-Service.yaml similarity index 100% rename from kubernetes/bare-kubernetes/003-OMOP-CDM-Service.yaml rename to kubernetes/bare-kubernetes/004-OMOP-CDM-Service.yaml diff --git a/kubernetes/bare-kubernetes/005_ohdsi-api-deployment.yaml b/kubernetes/bare-kubernetes/005_ohdsi-api-deployment.yaml new file mode 100644 index 0000000..48d6eff --- /dev/null +++ b/kubernetes/bare-kubernetes/005_ohdsi-api-deployment.yaml @@ -0,0 +1,60 @@ +#deployment of a api + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: ohdsi-apit + labels: + app: ohdsi-api +spec: + replicas: 1 + selector: + matchLabels: + app: ohdsi-api + template: + metadata: + labels: + app: ohdsi-api + spec: + containers: + - name: ohdsi-api + image: ohdsi-api:latest + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8080 + env: + - name: OMOP_DBMS + valueFrom: + configMapKeyRef: + name: connection-details + key: OMOP_DBMS + - name: OMOP_SERVER + valueFrom: + configMapKeyRef: + name: connection-details + key: OMOP_SERVER + - name: OMOP_PORT + valueFrom: + configMapKeyRef: + name: connection-details + key: OMOP_PORT + - name: OMOP_USER + valueFrom: + secretKeyRef: + name: omop-secrets + key: POSTGRES_USER + - name: OMOP_PASSWORD + valueFrom: + secretKeyRef: + name: omop-secrets + key: POSTGRES_PASSWORD + - name: OMOP_DATABASE + valueFrom: + configMapKeyRef: + name: connection-details + key: OMOP_DATABASE + - name: OMOP_SCHEMA + valueFrom: + configMapKeyRef: + name: connection-details + key: OMOP_SCHEMA \ No newline at end of file diff --git a/kubernetes/istio/001_datamesh-ns.yaml b/kubernetes/istio/001_datamesh-ns.yaml deleted file mode 100644 index d5f2720..0000000 --- a/kubernetes/istio/001_datamesh-ns.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: datamesh - labels: - istio-injection: enabled \ No newline at end of file diff --git a/kubernetes/istio/004_omop-secrets.yaml b/kubernetes/istio/001_omop-secrets.yaml similarity index 77% rename from kubernetes/istio/004_omop-secrets.yaml rename to kubernetes/istio/001_omop-secrets.yaml index 8481163..1ce04c8 100644 --- a/kubernetes/istio/004_omop-secrets.yaml +++ b/kubernetes/istio/001_omop-secrets.yaml @@ -5,4 +5,5 @@ metadata: namespace: datamesh type: Opaque data: + POSTGRES_USER: cG9zdGdyZXM= # postgres in base64 POSTGRES_PASSWORD: bXlzZWNyZXRwYXNzd29yZA== # mysecretpassword in base64 \ No newline at end of file diff --git a/kubernetes/istio/002_connection-details.yaml b/kubernetes/istio/002_connection-details.yaml new file mode 100644 index 0000000..7646aec --- /dev/null +++ b/kubernetes/istio/002_connection-details.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: connection-details +data: + CELERY_BROKER_URL: "amqp://guest:guest@rabbitmq:5672/" + CELERY_RESULT_BACKEND: "db+postgresql://postgres:mysecretpassword@db/omopdb" + OMOP_DBMS: "postgresql" + OMOP_SERVER: "host.docker.internal" + OMOP_PORT: "5432" + OMOP_USER: "postgres" + OMOP_PASSWORD: "mysecretpassword" + OMOP_DATABASE: "omopdb" + OMOP_SCHEMA: "omopcdm" \ No newline at end of file diff --git a/kubernetes/istio/002_mtls-policy.yaml b/kubernetes/istio/002_mtls-policy.yaml deleted file mode 100644 index fb3d271..0000000 --- a/kubernetes/istio/002_mtls-policy.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: security.istio.io/v1beta1 -kind: PeerAuthentication -metadata: - name: default - namespace: datamesh -spec: - mtls: - mode: STRICT \ No newline at end of file diff --git a/kubernetes/istio/003_gateway.yaml b/kubernetes/istio/003_gateway.yaml deleted file mode 100644 index c03fbb1..0000000 --- a/kubernetes/istio/003_gateway.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: networking.istio.io/v1alpha3 -kind: Gateway -metadata: - name: idea-gateway - namespace: datamesh -spec: - selector: - istio: ingressgateway - servers: - - port: - number: 80 - name: http - protocol: HTTP - hosts: - - 127.0.0.1 # for local testing purposes \ No newline at end of file diff --git a/kubernetes/istio/005_omop-db-cdm-deployment.yaml b/kubernetes/istio/003_omop-db-cdm-deployment.yaml similarity index 100% rename from kubernetes/istio/005_omop-db-cdm-deployment.yaml rename to kubernetes/istio/003_omop-db-cdm-deployment.yaml diff --git a/kubernetes/istio/006_omop-db-svc-datamesh.yaml b/kubernetes/istio/004_omop-db-svc-datamesh.yaml similarity index 100% rename from kubernetes/istio/006_omop-db-svc-datamesh.yaml rename to kubernetes/istio/004_omop-db-svc-datamesh.yaml diff --git a/kubernetes/istio/007_omop-vocab-job.yaml b/kubernetes/istio/005_omop-vocab-job.yaml similarity index 100% rename from kubernetes/istio/007_omop-vocab-job.yaml rename to kubernetes/istio/005_omop-vocab-job.yaml