From 8fae9e9e4c3af736c5bc9d5f445e0e523932a9bd Mon Sep 17 00:00:00 2001 From: "thibault.raquet" Date: Mon, 13 Jan 2025 11:40:15 +0100 Subject: [PATCH] add a side car container instead of queue worker --- manifest.yaml | 68 +++++++++++++++------------------------------------ 1 file changed, 20 insertions(+), 48 deletions(-) diff --git a/manifest.yaml b/manifest.yaml index d117ed0..4e9daae 100644 --- a/manifest.yaml +++ b/manifest.yaml @@ -61,6 +61,26 @@ spec: volumeMounts: - name: storage mountPath: /app/srcs/storage + - name: ${CI_PROJECT_PATH_SLUG}-queue-worker + image: $IMAGE_TAG + lifecycle: + preStop: + exec: + command: ["/bin/sh","-c","kill -s TERM 1; while test $(ps ax | grep -v grep | grep bash | wc -l) -gt 0; do sleep 2s; done"] + resources: + limits: + memory: 512Mi + cpu: "1" + command: + - "bash" + args: + - "k8s-queues.sh" + envFrom: + - configMapRef: + name: ${CI_PROJECT_PATH_SLUG}-config-map + volumeMounts: + - name: storage + mountPath: /app/srcs/storage imagePullSecrets: - name: docker-registry-credentials securityContext: @@ -152,51 +172,3 @@ spec: fsGroup: 33 fsGroupChangePolicy: "OnRootMismatch" restartPolicy: OnFailure - ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: ${CI_PROJECT_PATH_SLUG}-queue-worker-deployment -spec: - replicas: 1 - selector: - matchLabels: - app: ${CI_PROJECT_PATH_SLUG}-app-queue - template: - metadata: - labels: - app: ${CI_PROJECT_PATH_SLUG}-app-queue - spec: - containers: - - name: ${CI_PROJECT_PATH_SLUG}-queue-worker - image: $IMAGE_TAG - lifecycle: - preStop: - exec: - command: ["/bin/sh","-c","kill -s TERM 1; while test $(ps ax | grep -v grep | grep bash | wc -l) -gt 0; do sleep 2s; done"] - resources: - limits: - memory: 512Mi - cpu: "1" - command: - - "bash" - args: - - "k8s-queues.sh" - envFrom: - - configMapRef: - name: ${CI_PROJECT_PATH_SLUG}-config-map - volumeMounts: - - name: storage - mountPath: /app/srcs/storage - imagePullSecrets: - - name: docker-registry-credentials - securityContext: - runAsUser: 33 - runAsGroup: 33 - fsGroup: 33 - fsGroupChangePolicy: "OnRootMismatch" - volumes: - - name: storage - persistentVolumeClaim: - claimName: ${CI_PROJECT_PATH_SLUG}-pvc-storage