From fd9f7da97b4bd26d523b3d5b971902ab2a4ccf05 Mon Sep 17 00:00:00 2001 From: Ben Galewsky Date: Tue, 24 Sep 2024 08:34:37 -0500 Subject: [PATCH] Add flower celery web monitor app --- helm/servicex/templates/app/ingress.yaml | 12 +++++- .../servicex/templates/flower/deployment.yaml | 42 +++++++++++++++++++ helm/servicex/templates/flower/service.yaml | 16 +++++++ helm/servicex/values.yaml | 8 ++++ 4 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 helm/servicex/templates/flower/deployment.yaml create mode 100644 helm/servicex/templates/flower/service.yaml diff --git a/helm/servicex/templates/app/ingress.yaml b/helm/servicex/templates/app/ingress.yaml index bc2507c5..c3f70575 100644 --- a/helm/servicex/templates/app/ingress.yaml +++ b/helm/servicex/templates/app/ingress.yaml @@ -27,6 +27,16 @@ spec: backend: service: name: {{ .Release.Name }}-servicex-app - port: + port: number: 8000 + {{- if .Values.flower.enabled }} + - path: /flower + pathType: Prefix + backend: + service: + name: {{ .Release.Name }}-flower + port: + number: 8000 + {{- end }} + {{- end }} diff --git a/helm/servicex/templates/flower/deployment.yaml b/helm/servicex/templates/flower/deployment.yaml new file mode 100644 index 00000000..2b6eb8ce --- /dev/null +++ b/helm/servicex/templates/flower/deployment.yaml @@ -0,0 +1,42 @@ + +{{- if .Values.flower.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ $.Release.Name }}-flower +spec: + replicas: 1 + selector: + matchLabels: + app: {{ $.Release.Name }}-flower + template: + metadata: + labels: + app: {{ $.Release.Name }}-flower + spec: + containers: + - name: {{ $.Release.Name }}-flower + image: {{ .Values.flower.image }}:{{ .Values.flower.tag }} + tty: true + stdin: true + imagePullPolicy: {{ .Values.flower.pullPolicy }} + env: + {{- if .Values.secrets }} + - name: RMQ_PASS + valueFrom: + secretKeyRef: + name: {{ .Values.secrets }} + key: rabbitmq-password + - name: BROKER_URL + value: amqp://user:$(RMQ_PASS)@{{ .Release.Name }}-rabbitmq:5672/?heartbeat=9000 + {{- else }} + - name: BROKER_URL + value: amqp://user:{{ .Values.rabbitmq.auth.password }}@{{ .Release.Name }}-rabbitmq:5672/%2F + {{- end }} + + command: [ "/bin/sh" ] + args: [ "-c", "celery --broker $BROKER_URL flower --purge_offline_workers=60" ] + + ports: + - containerPort: 5555 +{{- end }} diff --git a/helm/servicex/templates/flower/service.yaml b/helm/servicex/templates/flower/service.yaml new file mode 100644 index 00000000..8a807fb9 --- /dev/null +++ b/helm/servicex/templates/flower/service.yaml @@ -0,0 +1,16 @@ +--- +{{- if .Values.flower.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-flower +spec: + ports: + - port: 8000 + targetPort: 5555 + name: "tcp" + protocol: TCP + selector: + app: {{ .Release.Name }}-flower + type: ClusterIP +{{- end }} \ No newline at end of file diff --git a/helm/servicex/values.yaml b/helm/servicex/values.yaml index 9b96c489..ca9dbbc2 100644 --- a/helm/servicex/values.yaml +++ b/helm/servicex/values.yaml @@ -203,3 +203,11 @@ dataLifecycle: # See https://www.geeksforgeeks.org/date-command-linux-examples/#4-how-to-display-past-dates # for examples retention: "7 days ago" + +# Flower is a web based tool for monitoring and administrating Celery clusters. +# It can be used to inspect tasks, view graphs and logs, restart workers, and more. +flower: + enabled: true + image: mher/flower + tag: master + pullPolicy: Always