feat(infra): Allow node-role labeling for system nodes#348
Conversation
…stem Add a `system_nodes` option to both managed node groups (additional_node_groups) and Karpenter node pools. When set, the node group / pool labels its Kubernetes nodes with `posit.team/node-role=system`, enabling node affinity / anti-affinity rules to be built on the node-role label — for example so the Team Operator image prepull daemonset can be kept off system nodes. For the managed node group path this sets the real Kubernetes node label (NodeGroupArgs.Labels) rather than only an AWS resource tag, which the existing `labels` field maps to. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
.claude/settings.local.json is a personal, machine-local file and should not be tracked; it was staged inadvertently by `git add -A`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Claude finished @amdove's task in 1m 59s —— View job Review
The change is small, additive, and the intent is clear. The implementation is correct for the common case. One structural concern worth addressing before merge:
The system-nodes block assigns directly to Everything else looks good:
One nit not worth blocking on: the |
…d of overwriting The system-node label assignment overwrote template.metadata wholesale. That is safe today (single writer), but a footgun: a future field that sets template.metadata (annotations, another label) would be silently discarded. Ensure metadata and metadata.labels exist and set only the one key, matching the ngTags merge pattern in WithNodeGroup. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Description
Refresh of the closed #100 for the current Go codebase (the original targeted the removed Python/Pulumi code).
Adds a
system_nodesoption to managed node groups (additional_node_groups.<name>) and Karpenter node pools (karpenter_config.node_pools[]). When set, nodes are labeledposit.team/node-role=system, enabling node affinity rules — the motivating case being to keep the Team Operator image prepull daemonset off system nodes.This PR only adds the labeling (the enabler). The matching affinity rule lives in team-operator and is a separate change; until it lands, prepull still runs everywhere.
Code Flow
lib/types/workload.go: newSystemNodes bool(system_nodes) onNodeGroupConfigandKarpenterNodePool.lib/aws/eks_cluster.go,lib/steps/eks_aws.go): sets the real k8s node label viaawseks.NodeGroupArgs.Labels. Note the existingLabelsfield maps to AWS tags, which affinity can't match — so the label goes on the k8slabelsfield instead. Non-system groups are untouched (no state churn).lib/steps/helm_aws.go): mergesposit.team/node-role=systeminto the NodePool'stemplate.metadata.labels.Category of change
Testing
TestSystemNodesConfigFromYAMLcovers the yaml round-trip for both configs;just test-libpasses andjust clibuilds.🤖 Generated with Claude Code