feat: node labels and selective deployment#32
Merged
TerrifiedBug merged 8 commits intomainfrom Mar 7, 2026
Merged
Conversation
…oy selector - Fleet router: updateLabels mutation, listLabels query - Heartbeat: accept and merge agent-reported labels (UI takes precedence) - Config endpoint: filter pipelines by nodeSelector vs node labels - Deploy router: accept nodeSelector, save to pipeline, include labels in env info
Contributor
Greptile SummaryThis PR successfully adds node label management and selector-based pipeline deployment to VectorFlow. Nodes can carry arbitrary key-value metadata set via the UI or reported by the agent, and pipeline deploys can be scoped to nodes matching a label selector — with no selector defaulting to deploy-to-all for full backward compatibility. Key improvements over the previous review:
One minor convention gap remains: the new Confidence Score: 4/5
Sequence DiagramsequenceDiagram
participant UI as Browser (Deploy Dialog)
participant tRPC as tRPC Router
participant DB as PostgreSQL
participant Agent as Vector Agent
UI->>tRPC: deploy.preview { pipelineId }
tRPC-->>UI: { nodeSelector, configYaml, nodes[] }
Note over UI: useEffect seeds selectedLabels<br/>from existing nodeSelector
UI->>tRPC: deploy.agent { pipelineId, nodeSelector }
tRPC->>tRPC: deployAgent() — create PipelineVersion
tRPC->>DB: pipeline.update { nodeSelector } (only on success)
tRPC-->>UI: { success, versionNumber }
Agent->>tRPC: POST /api/agent/heartbeat { labels }
tRPC->>DB: UPDATE VectorNode SET labels = agent_labels || labels
Note over DB: Atomic merge — existing DB labels win
Agent->>tRPC: GET /api/agent/config
tRPC->>DB: SELECT node.labels, pipeline.nodeSelector
Note over tRPC: Filter: selector entries must all match node labels
tRPC-->>Agent: matching pipelines only
Last reviewed commit: 469e359 |
- Replace two-step read-then-write label merge with atomic PostgreSQL JSONB operation to prevent TOCTOU race with fleet.updateLabels - Disable combobox label options whose key is already selected to prevent silent overwrites in nodeSelector - Seed selectedLabels from existing pipeline nodeSelector on dialog open to prevent re-deploy from clearing the saved node selector - Return nodeSelector from deploy.preview query so the dialog can hydrate existing selections
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
labels(JSON) field to VectorNode andnodeSelector(JSON) field to Pipeline models with database migrationupdateLabelsmutation (EDITOR access) andlistLabelsquery (VIEWER access) for managing node labelslabelsfield; merge with existing labels (UI-set labels take precedence)nodeSelectoron deploy, save to pipeline; include labels in environment infokey=value) per nodeTest plan
labelscolumn on VectorNode andnodeSelectoron Pipeline/api/agent/config