Skip to content

Commit 0147e84

Browse files
feat: enable site clusters to run Nautobot Celery workers locally
Nautobot currently runs entirely on the global cluster, including its Celery workers. Sites that generate heavy background task load have no way to offload that processing closer to where the work originates, and a single global worker pool becomes a bottleneck as sites scale. This adds a site-scoped ArgoCD Application that deploys only the Celery worker portion of the Nautobot helm chart. The web server, Redis, and PostgreSQL are all disabled because they remain on the global cluster — site workers connect back to those shared services. This lets operators scale worker capacity per-site independently, run queue-specific workers closer to the hardware they manage, and reduce cross-cluster task latency for site-driven automation.
1 parent b53561a commit 0147e84

File tree

6 files changed

+173
-0
lines changed

6 files changed

+173
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{{- if eq (include "understack.isEnabled" (list $.Values.site "nautobot_worker")) "true" }}
2+
---
3+
apiVersion: argoproj.io/v1alpha1
4+
kind: Application
5+
metadata:
6+
name: {{ printf "%s-%s" $.Release.Name "nautobot-worker" }}
7+
finalizers:
8+
- resources-finalizer.argocd.argoproj.io
9+
annotations:
10+
argocd.argoproj.io/compare-options: ServerSideDiff=true,IncludeMutationWebhook=true
11+
spec:
12+
destination:
13+
namespace: nautobot
14+
server: {{ $.Values.cluster_server }}
15+
project: understack
16+
sources:
17+
- chart: nautobot
18+
helm:
19+
fileParameters:
20+
- name: nautobot.config
21+
path: $understack/components/nautobot/nautobot_config.py
22+
ignoreMissingValueFiles: true
23+
releaseName: nautobot-worker
24+
valueFiles:
25+
- $understack/components/nautobot-worker/values.yaml
26+
- $deploy/{{ include "understack.deploy_path" $ }}/nautobot-worker/values.yaml
27+
repoURL: https://nautobot.github.io/helm-charts/
28+
targetRevision: 2.5.6
29+
- path: components/nautobot-worker
30+
ref: understack
31+
repoURL: {{ include "understack.understack_url" $ }}
32+
targetRevision: {{ include "understack.understack_ref" $ }}
33+
- path: {{ include "understack.deploy_path" $ }}/nautobot-worker
34+
ref: deploy
35+
repoURL: {{ include "understack.deploy_url" $ }}
36+
targetRevision: {{ include "understack.deploy_ref" $ }}
37+
syncPolicy:
38+
automated:
39+
prune: true
40+
selfHeal: true
41+
managedNamespaceMetadata:
42+
annotations:
43+
argocd.argoproj.io/sync-options: Delete=false
44+
syncOptions:
45+
- CreateNamespace=true
46+
- ServerSideApply=true
47+
- RespectIgnoreDifferences=true
48+
- ApplyOutOfSyncOnly=true
49+
{{- end }}

charts/argocd-understack/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,12 @@ site:
514514
# @default -- false
515515
enabled: false
516516

517+
# -- Nautobot Celery workers (site-level, connects to global Nautobot)
518+
nautobot_worker:
519+
# -- Enable/disable deploying Nautobot workers at the site level
520+
# @default -- false
521+
enabled: false
522+
517523
# -- Site-specific workflows and event handlers
518524
site_workflows:
519525
# -- Enable/disable deploying site workflows
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
apiVersion: kustomize.config.k8s.io/v1beta1
3+
kind: Kustomization
4+
5+
resources: []
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Nautobot Worker (site-level)
2+
#
3+
# This deploys only Celery workers that connect back to the global
4+
# Nautobot's database and Redis. The web server, Redis, and PostgreSQL
5+
# are all disabled because they live on the global cluster.
6+
---
7+
8+
# Disable the Nautobot web server — workers only
9+
nautobot:
10+
enabled: false
11+
12+
db:
13+
engine: "django.db.backends.postgresql"
14+
# Points to the global cluster's CloudNativePG instance.
15+
# Override host in your deploy repo values if the global DB
16+
# endpoint differs per site.
17+
host: "nautobot-cluster-rw.nautobot.svc"
18+
name: "app"
19+
user: "app"
20+
existingSecret: "nautobot-cluster-app"
21+
existingSecretPasswordKey: "password"
22+
23+
django:
24+
existingSecret: nautobot-django
25+
26+
celery:
27+
enabled: true
28+
concurrency: 2
29+
replicaCount: 1
30+
extraEnvVarsSecret:
31+
- nautobot-django
32+
- nautobot-custom-env
33+
livenessProbe:
34+
initialDelaySeconds: 60
35+
periodSeconds: 120
36+
timeoutSeconds: 60
37+
readinessProbe:
38+
initialDelaySeconds: 60
39+
periodSeconds: 120
40+
timeoutSeconds: 60
41+
42+
# Workers use the global Redis — do not deploy a local instance
43+
redis:
44+
enabled: false
45+
46+
# Workers use the global PostgreSQL — do not deploy a local instance
47+
postgresql:
48+
enabled: false
49+
50+
ingress:
51+
enabled: false
52+
53+
metrics:
54+
enabled: false
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
charts:
3+
- nautobot
4+
kustomize_paths:
5+
- components/nautobot-worker
6+
deploy_overrides:
7+
helm:
8+
mode: values
9+
kustomize:
10+
mode: second_source
11+
---
12+
13+
# nautobot-worker
14+
15+
Site-level Nautobot Celery workers that connect to the global Nautobot
16+
database and Redis. This allows sites to run their own worker pods for
17+
processing background tasks without deploying the full Nautobot web
18+
application.
19+
20+
## Deployment Scope
21+
22+
- Cluster scope: site
23+
- Values key: `site.nautobot_worker`
24+
- ArgoCD Application template: `charts/argocd-understack/templates/application-nautobot-worker.yaml`
25+
26+
## How ArgoCD Builds It
27+
28+
{{ component_argocd_builds() }}
29+
30+
## How to Enable
31+
32+
Enable this component in your site deployment values file:
33+
34+
```yaml title="$CLUSTER_NAME/deploy.yaml"
35+
site:
36+
nautobot_worker:
37+
enabled: true
38+
```
39+
40+
## Deployment Repo Content
41+
42+
{{ secrets_disclaimer }}
43+
44+
Required or commonly required items:
45+
46+
- `values.yaml`: Override celery worker settings such as image, replica
47+
count, concurrency, environment variables, and task queue assignments.
48+
- `nautobot-django` Secret: Provide a `NAUTOBOT_SECRET_KEY` value
49+
(must match the global Nautobot instance).
50+
- `nautobot-cluster-app` Secret: Database credentials for the global
51+
CloudNativePG cluster.
52+
53+
Optional additions:
54+
55+
- `nautobot-custom-env` Secret: Extra environment variables to inject
56+
into the worker pods.
57+
- Additional `workers` entries in `values.yaml` to run dedicated
58+
workers for specific Celery queues.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ nav:
190190
- deploy-guide/components/nautobot-site.md
191191
- deploy-guide/components/nautobot.md
192192
- deploy-guide/components/nautobotop.md
193+
- deploy-guide/components/nautobot-worker.md
193194
- deploy-guide/components/neutron.md
194195
- deploy-guide/components/nova.md
195196
- deploy-guide/components/octavia.md

0 commit comments

Comments
 (0)