From d875d9aff81a6bab58cf310eb8c3b9edc6133665 Mon Sep 17 00:00:00 2001 From: Kyle Rockman Date: Mon, 4 Nov 2024 09:35:42 -0600 Subject: [PATCH] Remove cron pod from self hosted --- .../unreleased/Refactor-20241104-093536.yaml | 3 + charts/opslevel/templates/opslevel/cron.yaml | 104 ------------------ .../templates/opslevel/scheduler.yaml | 22 ++-- 3 files changed, 16 insertions(+), 113 deletions(-) create mode 100644 .changes/unreleased/Refactor-20241104-093536.yaml delete mode 100644 charts/opslevel/templates/opslevel/cron.yaml diff --git a/.changes/unreleased/Refactor-20241104-093536.yaml b/.changes/unreleased/Refactor-20241104-093536.yaml new file mode 100644 index 0000000..856ea92 --- /dev/null +++ b/.changes/unreleased/Refactor-20241104-093536.yaml @@ -0,0 +1,3 @@ +kind: Refactor +body: Crontab usage has been removed from the app in favor of the scheduler +time: 2024-11-04T09:35:36.363734-06:00 diff --git a/charts/opslevel/templates/opslevel/cron.yaml b/charts/opslevel/templates/opslevel/cron.yaml deleted file mode 100644 index e1cc35c..0000000 --- a/charts/opslevel/templates/opslevel/cron.yaml +++ /dev/null @@ -1,104 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: opslevel-cron - labels: - app.kubernetes.io/component: cron - app.kubernetes.io/part-of: opslevel -spec: - replicas: 1 - strategy: - type: Recreate - selector: - matchLabels: - app.kubernetes.io/component: cron - app.kubernetes.io/part-of: opslevel - revisionHistoryLimit: 3 - template: - metadata: - labels: - app.kubernetes.io/component: cron - app.kubernetes.io/part-of: opslevel - spec: - {{- template "opslevel.pullSecrets" . }} - {{- template "global.nodeSelector" . }} - priorityClassName: opslevel-normal - initContainers: - {{- if .Values.global.certificate }} - - name: init-certs - image: "{{ template "opslevel.image" . }}" - imagePullPolicy: IfNotPresent - command: - - sh - - -c - - sleep 10; update-ca-certificates; cp -r /etc/ssl/certs/. /data; - volumeMounts: - - name: certificate - mountPath: /usr/local/share/ca-certificates/custom-cert.crt - subPath: custom-cert.crt - readOnly: false - - name: ca - mountPath: /data - readOnly: false - {{- end }} - - name: migrations - image: "{{ template "opslevel.image" . }}" - imagePullPolicy: IfNotPresent - args: - - ./bin/init-db - env: &env - - name: DD_AGENT_HOST - valueFrom: - fieldRef: - fieldPath: status.hostIP - envFrom: &envFrom - - configMapRef: - name: 'opslevel' - - secretRef: - name: 'opslevel' - - secretRef: - name: '{{ .Values.redis.secret.name }}' - - secretRef: - name: '{{ .Values.elasticsearch.secret.name }}' - {{- template "opslevel.integration.secrets" . }} - {{- if .Values.global.certificate }} - volumeMounts: - - name: certificate - mountPath: /usr/local/share/ca-certificates/custom-cert.crt - subPath: custom-cert.crt - readOnly: false - - name: ca - mountPath: /etc/ssl/certs - {{- end }} - containers: - - name: cron - image: "{{ template "opslevel.image" . }}" - imagePullPolicy: IfNotPresent - args: - - ./bin/cron - env: *env - envFrom: *envFrom - resources: - requests: - cpu: '200m' - memory: '500Mi' - limits: - cpu: '1' - memory: '2Gi' - {{- if .Values.global.certificate }} - volumeMounts: - - name: certificate - mountPath: /usr/local/share/ca-certificates/custom-cert.crt - subPath: custom-cert.crt - readOnly: false - - name: ca - mountPath: /etc/ssl/certs - {{- end }} - {{- if .Values.global.certificate }} - volumes: - - name: ca - emptyDir: {} - - name: certificate - secret: - secretName: opslevel-certificate - {{- end }} \ No newline at end of file diff --git a/charts/opslevel/templates/opslevel/scheduler.yaml b/charts/opslevel/templates/opslevel/scheduler.yaml index 839d932..b7cb9ff 100644 --- a/charts/opslevel/templates/opslevel/scheduler.yaml +++ b/charts/opslevel/templates/opslevel/scheduler.yaml @@ -51,10 +51,16 @@ spec: - name: migrations image: "{{ template "opslevel.image" . }}" args: - - bundle - - exec - - rake - - db:abort_if_pending_migrations + - ./bin/init-db + env: &env + - name: SIDEKIQ_CONCURRENCY + value: "1" + - name: SIDEKIQ_SCHEDULER + value: "true" + - name: DD_AGENT_HOST + valueFrom: + fieldRef: + fieldPath: status.hostIP envFrom: &envFrom - configMapRef: name: 'opslevel' @@ -62,6 +68,8 @@ spec: name: 'opslevel' - secretRef: name: '{{ .Values.redis.secret.name }}' + - secretRef: + name: '{{ .Values.elasticsearch.secret.name }}' {{- template "opslevel.integration.secrets" . }} {{- if .Values.global.certificate }} volumeMounts: @@ -81,11 +89,7 @@ spec: - exec - sidekiq envFrom: *envFrom - env: - - name: SIDEKIQ_CONCURRENCY - value: "1" - - name: SIDEKIQ_SCHEDULER - value: "true" + env: *env {{- with .Values.opslevel.workerLow.resources }} resources: {{- toYaml . | nindent 12 }}