From 0907d9b752e978ff8632778d4c406c1fa4c0b984 Mon Sep 17 00:00:00 2001 From: Thomas HERVE Date: Wed, 27 Mar 2024 16:58:07 +0100 Subject: [PATCH] WIP on statefulset in helm chart --- core/app/__init__.py | 4 ++-- core/app/handlers/core.py | 9 +++++++++ helm/templates/service.yaml | 16 +++++++++++++++- helm/templates/statefulset.yaml | 32 ++++++++++++++++++++++++++++++++ helm/values.yaml | 7 ++++++- 5 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 core/app/handlers/core.py create mode 100644 helm/templates/statefulset.yaml diff --git a/core/app/__init__.py b/core/app/__init__.py index 5f16a9d..83f9b7c 100644 --- a/core/app/__init__.py +++ b/core/app/__init__.py @@ -1,8 +1,8 @@ import hug -from handlers import test +from handlers import test, core @hug.extend_api("") def api(): - return [test] + return [test, core] diff --git a/core/app/handlers/core.py b/core/app/handlers/core.py new file mode 100644 index 0000000..657cb86 --- /dev/null +++ b/core/app/handlers/core.py @@ -0,0 +1,9 @@ +import hug + +@hug.post('/create-room') +def create_room(): + return "" + +@hug.post('/delete-room') +def delete_room(body): + return "" diff --git a/helm/templates/service.yaml b/helm/templates/service.yaml index d12b478..ca0dc0a 100644 --- a/helm/templates/service.yaml +++ b/helm/templates/service.yaml @@ -14,4 +14,18 @@ spec: selector: app.kubernetes.io/instance: asyncunitytemplate app.kubernetes.io/name: core - +--- +apiVersion: v1 +kind: Service +metadata: + name: instance + labels: + app: instance +spec: + ports: + - port: 80 + name: http + type: ClusterIP + selector: + app.kubernetes.io/instance: asyncunitytemplate + app.kubernetes.io/name: instance \ No newline at end of file diff --git a/helm/templates/statefulset.yaml b/helm/templates/statefulset.yaml new file mode 100644 index 0000000..53a0296 --- /dev/null +++ b/helm/templates/statefulset.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: instance + labels: + app.kubernetes.io/instance: asyncunitytemplate + app.kubernetes.io/name: instance + annotations: + keel.sh/policy: force + keel.sh/trigger: poll + keel.sh/pollSchedule: "@every 10m" +spec: + serviceName: instance + replicas: {{ .Values.instance.replicas }} + selector: + matchLabels: + app.kubernetes.io/instance: asyncunitytemplate + app.kubernetes.io/name: instance + template: + metadata: + labels: + app.kubernetes.io/instance: asyncunitytemplate + app.kubernetes.io/name: instance + spec: + terminationGracePeriodSeconds: 10 + containers: + - name: instance + image: "{{ .Values.instance.repository }}:{{ .Values.instance.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.instance.pullPolicy }} + ports: + - containerPort: 80 + name: web diff --git a/helm/values.yaml b/helm/values.yaml index 4a0426a..7ddcb82 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -8,9 +8,14 @@ namespace: asyncunity image: repository: thomasherve/asymetric-unity-core pullPolicy: Always - # Overrides the image tag whose default is the chart appVersion. tag: "latest" +instance: + repository: thomasherve/asymetric-unity-instance + pullPolicy: Always + tag: "latest" + replicas: 0 + imagePullSecrets: name: thomashervecredentials dockerconfigjson: ""