Skip to content

chore(app-manifest): soft-pin dev workloads to agentpool node pool - #88

Merged
hakan-persson merged 2 commits into
mainfrom
chore/dev-node-affinity
Jul 26, 2026
Merged

chore(app-manifest): soft-pin dev workloads to agentpool node pool#88
hakan-persson merged 2 commits into
mainfrom
chore/dev-node-affinity

Conversation

@hakan-persson

@hakan-persson hakan-persson commented Jul 26, 2026

Copy link
Copy Markdown
Member

What

Adds a soft nodeAffinity preference (weight 100) toward the original agentpool node pool on every dev workload in app-manifest/ — 15 Deployments + the two sync CronJobs (16 apps).

Why

During camp we added a second node pool (userpool, Standard_D8as_v5, 8 vCPU) to give prod CPU headroom after the booking-app surge saturated the single 4-vCPU node (peaked at 97% CPU / load1 ~42). This change keeps dev workloads on the old agentpool node so they can't compete with prod for CPU on the new node.

It is a preference, not a hard rule — dev pods still schedule onto userpool if agentpool is full, so nothing ever gets stuck unschedulable.

Scope / safety

  • Dev only. Prod (app-manifest-prod/) overlays are self-contained and do not inherit these dev bases — verified no leak into prod.
  • Monitoring untouched — it keeps its PVs and the old node's larger allocatable RAM; a brief scrape/UI slowdown under load is acceptable (non-critical).
  • Lazy rollout — template edits; existing dev pods relocate only on their next restart/redeploy. No forced restarts.
  • All 16 kustomizations validated with kubectl kustomize (18 affinity blocks render correctly).

🤖 Generated with Claude Code

Keep dev off the prod userpool node during camp so dev workloads can't
compete with prod for CPU. Soft nodeAffinity preference (weight 100) for
the agentpool pool on all dev deployments + sync CronJobs; preference only
so pods still schedule if agentpool is full. Prod/monitoring untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 26, 2026 09:11
@github-actions github-actions Bot added the prod-review Touches a dev base (k8s/app-manifest/) — decide if it must be carried to prod label Jul 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the dev k8s/app-manifest/** kustomizations to prefer scheduling workloads onto the original agentpool node pool (via nodeAffinity.preferredDuringSchedulingIgnoredDuringExecution), reducing contention with prod workloads on the newer userpool.

Changes:

  • Added a Kustomize patch to dev Deployment workloads to soft-prefer the agentpool node pool.
  • Added a similar patch for the j26-scoutid-sync dev CronJob workloads.
  • Minor kustomization formatting adjustment (resource list line alignment) in j26-signupinfo.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 16 comments.

Show a summary per file
File Description
k8s/app-manifest/j26-app/kustomization.yaml Adds nodeAffinity preference patch for Deployments.
k8s/app-manifest/j26-auth/kustomization.yaml Adds nodeAffinity preference patch for Deployments.
k8s/app-manifest/j26-booking/kustomization.yaml Adds nodeAffinity preference patch for Deployments.
k8s/app-manifest/j26-bracelet-checker/kustomization.yaml Adds nodeAffinity preference patch for Deployments.
k8s/app-manifest/j26-cms/kustomization.yaml Adds nodeAffinity preference patch for Deployments.
k8s/app-manifest/j26-interactive-screens/kustomization.yaml Adds nodeAffinity preference patch for Deployments.
k8s/app-manifest/j26-keycloak-scoutid/kustomization.yaml Adds nodeAffinity preference patch for Deployments.
k8s/app-manifest/j26-map/kustomization.yaml Adds nodeAffinity preference patch for Deployments.
k8s/app-manifest/j26-notifications/kustomization.yaml Adds nodeAffinity preference patch for Deployments (applies to multiple Deployments).
k8s/app-manifest/j26-photo-permission/kustomization.yaml Adds nodeAffinity preference patch for Deployments.
k8s/app-manifest/j26-platsbank/kustomization.yaml Adds nodeAffinity preference patch for Deployments.
k8s/app-manifest/j26-reports/kustomization.yaml Adds nodeAffinity preference patch for Deployments.
k8s/app-manifest/j26-screens/kustomization.yaml Adds nodeAffinity preference patch for Deployments.
k8s/app-manifest/j26-scoutid-sync/kustomization.yaml Adds nodeAffinity preference patch for CronJobs.
k8s/app-manifest/j26-scoutin-2/kustomization.yaml Adds nodeAffinity preference patch for Deployments.
k8s/app-manifest/j26-signupinfo/kustomization.yaml Adds nodeAffinity preference patch for Deployments and adjusts resource list formatting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread k8s/app-manifest/j26-app/kustomization.yaml Outdated
Comment thread k8s/app-manifest/j26-auth/kustomization.yaml Outdated
Comment thread k8s/app-manifest/j26-booking/kustomization.yaml Outdated
Comment thread k8s/app-manifest/j26-bracelet-checker/kustomization.yaml Outdated
Comment thread k8s/app-manifest/j26-cms/kustomization.yaml Outdated
Comment thread k8s/app-manifest/j26-reports/kustomization.yaml Outdated
Comment thread k8s/app-manifest/j26-screens/kustomization.yaml Outdated
Comment thread k8s/app-manifest/j26-scoutin-2/kustomization.yaml Outdated
Comment thread k8s/app-manifest/j26-signupinfo/kustomization.yaml Outdated
Comment thread k8s/app-manifest/j26-scoutid-sync/kustomization.yaml Outdated
Address Copilot review on #88: the JSON6902 `op: add` at
/spec/template/spec/affinity replaces the whole affinity object, which
would wipe an existing/future podAntiAffinity. Switch to strategic-merge
patches so nodeAffinity is merged in and any other affinity settings are
preserved. No existing dev workload has an affinity block today, so this
is a no-op on current render (verified) but future-proofs the patch.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.

@hakan-persson
hakan-persson merged commit 575e7a1 into main Jul 26, 2026
2 checks passed
hakan-persson added a commit that referenced this pull request Jul 26, 2026
Mirror of #88 for the monitoring stack: add a soft nodeAffinity preference
(weight 100) toward the original agentpool node pool on the four stateful,
memory-heavy components — Grafana, Prometheus, Alertmanager (kube-prometheus
-stack values) and Loki (singleBinary). Keeps them off the prod userpool node.

Both nodes share zone swedencentral-1, so the PVC/zone binding alone does NOT
keep these on the old node across a restart — this affinity makes that intent
explicit. Preference only, so they still schedule if agentpool is full.
DaemonSets (alloy, node-exporter) run on every node and are untouched.

Verified with helm template (kube-prometheus-stack 80.2.2, loki 6.49.0):
affinity renders on grafana/prometheus/alertmanager/loki only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

prod-review Touches a dev base (k8s/app-manifest/) — decide if it must be carried to prod

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants