From 776f4eddbea480a27ca121760d05d4a4ae836733 Mon Sep 17 00:00:00 2001 From: Neil Hanlon Date: Tue, 28 Feb 2023 11:11:49 -0500 Subject: [PATCH] Poll for new advisories every 15 minutes --- deploy/apollo/apollo-rhworker/Chart.yaml | 2 +- .../apollo-rhworker/templates/cronjob.yaml | 38 +++++++++++++++++++ deploy/apollo/apollo-rhworker/values.yaml | 4 ++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 deploy/apollo/apollo-rhworker/templates/cronjob.yaml diff --git a/deploy/apollo/apollo-rhworker/Chart.yaml b/deploy/apollo/apollo-rhworker/Chart.yaml index 052f23b..b740c67 100644 --- a/deploy/apollo/apollo-rhworker/Chart.yaml +++ b/deploy/apollo/apollo-rhworker/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 +version: 0.1.1 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/deploy/apollo/apollo-rhworker/templates/cronjob.yaml b/deploy/apollo/apollo-rhworker/templates/cronjob.yaml new file mode 100644 index 0000000..2614984 --- /dev/null +++ b/deploy/apollo/apollo-rhworker/templates/cronjob.yaml @@ -0,0 +1,38 @@ +{{- if .Values.cron.enabled }} +apiVersion: batch/v1 +kind: CronJob +metadata: + name: {{ include "apollo-rhworker.fullname" . }} + labels: + {{- include "apollo-rhworker.labels" . | nindent 4 }} +spec: + schedule: '{{ .Values.cron.schedule }}' + jobTemplate: + spec: + template: + spec: + restartPolicy: OnFailure + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "apollo-rhworker.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | indent 8 }} + containers: + - name: {{ .Chart.Name }}-poll-rh-advisories-workflow + image: temporalio/admin-tools:1.10.5 + securityContext: + {{- toYaml .Values.securityContext | indent 12 }} + env: + - name: TEMPORAL_CLI_ADDRESS + value: workflow-temporal-frontend.workflow.svc.cluster.local:7233 + imagePullPolicy: IfNotPresent + command: ["/bin/bash", "-c"] + args: + - | + trap 'curl --max-time 2 -s -f -XPOST http://127.0.0.1:15020/quitquitquit' EXIT + while ! curl -s -f http://127.0.0.1:15020/healthz/ready; do sleep 1; done + echo "Ready!" + tctl wf run --tq v2-rhworker --wt PollRHAdvisoriesWorkflow +{{- end }} diff --git a/deploy/apollo/apollo-rhworker/values.yaml b/deploy/apollo/apollo-rhworker/values.yaml index 760f790..90652b6 100644 --- a/deploy/apollo/apollo-rhworker/values.yaml +++ b/deploy/apollo/apollo-rhworker/values.yaml @@ -80,6 +80,10 @@ autoscaling: targetCPUUtilizationPercentage: 80 # targetMemoryUtilizationPercentage: 80 +cron: + enabled: true + schedule: "*/15 * * * *" + nodeSelector: {} tolerations: []