From 578d35d55fcaf339408c8f06a62c6e86d79df14b Mon Sep 17 00:00:00 2001 From: "nurbiy.teuchezh" Date: Fri, 3 Apr 2026 15:43:11 +0300 Subject: [PATCH] switch from cronjob to scheduler service --- yonote-chart-service/Chart.lock | 3 + yonote-chart-service/Chart.yaml | 5 ++ yonote-chart-service/templates/cronjob.yaml | 69 ------------------ yonote-chart-service/values.yaml | 81 +++++++++++++++++++-- 4 files changed, 81 insertions(+), 77 deletions(-) delete mode 100644 yonote-chart-service/templates/cronjob.yaml diff --git a/yonote-chart-service/Chart.lock b/yonote-chart-service/Chart.lock index fe552e9..0ba0443 100644 --- a/yonote-chart-service/Chart.lock +++ b/yonote-chart-service/Chart.lock @@ -14,6 +14,9 @@ dependencies: - name: app repository: https://dysnix.github.io/charts version: 0.3.15 +- name: app + repository: https://dysnix.github.io/charts + version: 0.3.15 - name: postgres repository: https://groundhog2k.github.io/helm-charts/ version: 0.3.9 diff --git a/yonote-chart-service/Chart.yaml b/yonote-chart-service/Chart.yaml index f454093..0c999f8 100644 --- a/yonote-chart-service/Chart.yaml +++ b/yonote-chart-service/Chart.yaml @@ -35,6 +35,11 @@ dependencies: repository: https://dysnix.github.io/charts alias: yonote-collaboration + - name: app + version: "0.3.15" + repository: https://dysnix.github.io/charts + alias: yonote-scheduler + - name: postgres version: "0.3.9" repository: https://groundhog2k.github.io/helm-charts/ diff --git a/yonote-chart-service/templates/cronjob.yaml b/yonote-chart-service/templates/cronjob.yaml deleted file mode 100644 index 60a2763..0000000 --- a/yonote-chart-service/templates/cronjob.yaml +++ /dev/null @@ -1,69 +0,0 @@ -{{- if eq ($.Values.global.yonote_cron_calendar_events.cron_enabled | toString) "true" }} -apiVersion: batch/v1 -kind: CronJob -metadata: - name: cron-calendar-events -spec: - schedule: "*/1 * * * *" - jobTemplate: - spec: - template: - spec: - containers: - - name: cron-calendar-events - image: curlimages/curl - imagePullPolicy: IfNotPresent - envFrom: - - secretRef: - name: yonote-secrets - command: - - /bin/sh - - -c - - >- - date; - curl - -X POST - {{ .Values.global.yonote_cron_calendar_events.url }} - -H "Content-Type: application/json" - -d ' - { - "token": "$(UTILS_SECRET)" - } - ' - restartPolicy: OnFailure -{{- end }} ---- -{{- if eq ($.Values.global.yonote_cron_task_scheduler.cron_enabled | toString) "true" }} -apiVersion: batch/v1 -kind: CronJob -metadata: - name: cron-task-scheduler -spec: - schedule: "0 */1 * * *" - jobTemplate: - spec: - template: - spec: - containers: - - name: cron-task-scheduler - image: curlimages/curl - imagePullPolicy: IfNotPresent - envFrom: - - secretRef: - name: yonote-secrets - command: - - /bin/sh - - -c - - >- - date; - curl - -X POST - {{ .Values.global.yonote_cron_task_scheduler.url }} - -H "Content-Type: application/json" - -d ' - { - "token":"$(UTILS_SECRET)", "limit":"200" - } - ' - restartPolicy: OnFailure -{{- end }} \ No newline at end of file diff --git a/yonote-chart-service/values.yaml b/yonote-chart-service/values.yaml index 0bbbc83..036129f 100644 --- a/yonote-chart-service/values.yaml +++ b/yonote-chart-service/values.yaml @@ -64,14 +64,6 @@ global: SMTP_SECURE: "" # connection will be upgraded: https://nodemailer.com/smtp/ SMTP_REQUIRE_TLS: "" - yonote_cron_calendar_events: - cron_enabled: "true" - url: http://yonote-web/api/cron.calendar_events - - yonote_cron_task_scheduler: - cron_enabled: "true" - url: http://yonote-web/api/cron.schedule - ingress: enabled: true name: yonote-ingress @@ -491,6 +483,79 @@ yonote-collaboration: path: /_health port: app +yonote-scheduler: + fullnameOverride: yonote-scheduler + nameOverride: yonote-scheduler + name: scheduler + + image: + registry: images.updates.yonote.ru + repository: yonote + tag: 1.22.11 + pullPolicy: IfNotPresent + + command: ["/bin/sh", "-c"] + args: ['IS_COMPILED=true yarn bytenode ./build/server/main.jsc --services=scheduler'] + + replicaCount: 1 + maxReplicas: 1 + minReplicas: 1 + + resources: + limits: + cpu: 250m + memory: 512Mi + requests: + cpu: 150m + memory: 128Mi + + checksums: null + + containerPorts: + - containerPort: 3000 + name: app + protocol: TCP + + service: + type: ClusterIP + port: 80 + targetPort: app + + envFrom: + - configMapRef: + name: yonote-configs + - secretRef: + name: yonote-secrets + + podLabels: + redis-client: 'true' + + podAnnotations: + checksum/configmap: "{{ toJson .Values.global.yonote.config.plain | sha256sum }}" + checksum/secret: "{{ toJson .Values.global.yonote.config.secret | sha256sum }}" + + readinessProbe: + enabled: true + failureThreshold: 6 + initialDelaySeconds: 60 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + httpGet: + path: /_health + port: app + + livenessProbe: + enabled: true + failureThreshold: 6 + initialDelaySeconds: 60 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + httpGet: + path: /_health + port: app + postgres: enabled: true #settings: