Skip to content

feat(components): make components runtime always-on across Go services - #1631

Merged
VLukiantsev merged 7 commits into
fix/dashboard-bigquery-component-rbacfrom
feat/components-always-on-services
Nov 12, 2026
Merged

VLukiantsev merged 7 commits into
fix/dashboard-bigquery-component-rbacfrom
feat/components-always-on-services

Conversation

@VLukiantsev

@VLukiantsev VLukiantsev commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Makes the Components runtime subsystem unconditionally active across all five component-aware Go services (experiment_state_server, actuator, dashboard_service, health_service, and ingestion_gateway), grants unconditional Component read RBAC to dashboard-service and actuator, removes unread enable_components ConfigMap/chart value entries, and retains an ignored -enable_components CLI flag sink solely in ingestion_gateway for rolling-upgrade compatibility.

Motivation & Context

As part of graduating XMC Components from the 0.18.x intermediate transition window to mandatory core infrastructure for 1.0.0, backend services should always register ComponentManagerService, evaluate experiment component drift and study requirements, inject workload component snapshots, resolve optional Component CRs (clickhouse, bigquery, redpanda) with static fallbacks, and report custom component health without requiring an enable_components feature toggle.

Key Changes

  • Experiment State Server & internal/experiment: Unconditionally initialize ComponentManagerService (initCMS) in cmd/experiment_state_server/main.go, remove -enable_components from cmd/experiment_state_server/config/config.go, remove CheckComponentsFeature (STUDY experiments without an active hpo component still fail pre-check with FailedPrecondition), and make DriftEvaluator always active (with nil-receiver/nil-store guard).
  • Actuator: Remove -enable_components from cmd/actuator/config.go, remove RuntimeConfig.EnableComponents gating in cmd/actuator/k8s_client/component_injection.go so WorkUnits carrying xmc.dev/component-snapshots are always evaluated, and render the xmc.dev/components read rule unconditionally in deploy/helm/templates/actuator/clusterrole.yaml.
  • Dashboard Service & Health Service: Remove enable_components config bindings, render dashboard-service-components-reader Role/RoleBinding unconditionally in deploy/helm/templates/dashboard-service/serviceaccount.yaml (so clusters without the Component CRD or CR receive 404 NotFound rather than 403 Forbidden), always run Component CR discovery (clickhouse / bigquery) via a shared nil-safe lazyComponentGetter with static fallback and store-specific startup logging (metrics_store=clickhouse) in cmd/dashboard_service/main.go, clean up stale error messages in pkg/{clickhouse,bigquery}/componentconfig/resolver.go, centralize crreadertest.IsolateInvalidKubeconfig, enforce apierrors.IsForbidden(err) across all Forbidden checks in cmd/dashboard_service/main_test.go, and always query LazyComponentsProvider (with nil-provider guards) in cmd/health_service/{health_checker,server}.go when lazyDB is initialized.
  • Ingestion Gateway & Helm Config Cleanup: Always resolve Component/redpanda with a bounded 5s timeout when (*Config).UsesRedpanda() is true (skipping kubeconfig initialization for non-redpanda buses), pass hardcoded -enable_components=true in deploy/profiles/stable-2026a/components/ingestion-gateway/templates/deployment.yaml so pinned < 1.0.0 gateway images remain component-aware during zero-downtime migration, retain -enable_components as an ignored flag via fs.Bool(...) in cmd/ingestion_gateway/ingestiongateway/config.go, and remove unread enable_components / enableComponents keys from deploy/helm/templates/{actuator,ess,dashboard-service,health-service}/configmap.yaml and deploy/profiles/stable-2026a/components/ingestion-gateway/values.yaml.

Assumptions

  • Retaining -enable_components solely on ingestion_gateway's FlagSet (fs.Bool, ignored) during 1.0.0 is preferable to hard-removing that CLI flag — Go's flag.Parse() exits 2 on unknown flags, deploy/profiles/stable-2026a/components/ingestion-gateway/templates/deployment.yaml passes -enable_components=true while xmc-cmp-ingestion-gateway pods roll independently of xmc-bridge, and deploy/helm/templates/ingestion-gateway/deployment.yaml (rendered when componentsDeployment.enabled=false until Layer 3 removes the umbrella gateway template) passes -enable_components=false — on non-component umbrella installs in Redpanda mode, the umbrella ingestion-gateway runs as ServiceAccount default without Component RBAC, so on every pod start it makes one 5s-bounded Component/redpanda GET that returns 403 Forbidden, logs a warning, and falls back to static broker and topic flags.
  • Rendering dashboard-service-components-reader Role/RoleBinding and actuator-role xmc.dev/components ClusterRole rules unconditionally (and removing unread enable_components keys from service ConfigMap templates and stable-2026a/components/ingestion-gateway/values.yaml) in this PR keeps it independently mergeable before Layer 3 — without Component get RBAC, dashboard-service receives 403 Forbidden instead of 404 NotFound when componentsDeployment.enabled=false and fails /readyz (503) — if dashboard-service is rolled out as an image-only update onto an older Helm release before applying the updated RBAC manifest, /readyz will fail closed (503) on 403 Forbidden until helm upgrade applies dashboard-service-components-reader.
  • Repository Markdown and skill documentation updates are stacked in Layer 4 (docs/mandatory-components-1-0) — keeps Go service and Helm manifest diffs isolated per vertical review slice — if Layer 2 merges ahead of Layer 4, service README.md files on main will briefly reference retired enable_components toggles until Layer 4 lands.

Verification & Testing

Automated Tests (at 2ec16d6b5)

  • Commands Executed:
    • bazel build //cmd/dashboard_service:dashboard_service
    • bazel test //cmd/dashboard_service/... --test_output=errors (4/4 tests pass)
    • bazel coverage --combined_report=lcov //cmd/dashboard_service/... --test_output=errors (833 / 1005 lines, 82.9%)
    • ./.githooks/pre-commit (gofmt, golangci-lint, buildifier, 51 out of 51 affected Bazel unit/integration tests across //cmd/actuator/..., //cmd/dashboard_service/..., //cmd/experiment_state_server/..., //cmd/health_service/..., //cmd/ingestion_gateway/..., //cmd/log_monitor/..., //cmd/reconciler/..., //cmd/rod_data_provider/..., //cmd/xid_service/..., //internal/experiment/..., //internal/storage/..., //internal/workunit/..., //pkg/clickhouse/componentconfig/..., //pkg/bigquery/componentconfig/..., //pkg/components/..., and //test/e2e/...)
  • Coverage & Test Status: All 51 affected Bazel Go unit, Spanner/PostgreSQL integration, and component tests plus 82.9% statement/line coverage in //cmd/dashboard_service/... pass cleanly at 2ec16d6b5.

Live Deployment & Manual Testing (Prior Stack Baseline)

  • Scope Note: Verified live against GKE and GitHub Actions prior to follow-up diagnostic/test commit 2ec16d6b5.
  • Deployment Target: Verified live on GKE Development Environment via python3 tools/dev_env/dev_env.py gke-upgrade
  • Cluster Health: Verified via python3 ./deploy/ctk_v2/verify_xmc.py (19/19 pods Ready, 5/5 Component CRs Ready, all sections ✅ PASS)
  • Stack-Top Nightly Build & E2E Verification (docs/align-metrics-and-helm-readmes @ 2f120512f):
  • Manual Test Scenarios Executed:
    1. Always-On ComponentManagerService & xmc-bridge Fence Handshake:
      • Action: kubectl logs -n xmc deployment/xmc-bridge-deployment --tail=15
      • Result: xmc-bridge connected to grpc-service:50051 and logged "Cluster holds the CMS ownership fence" (epoch=1) against ESS without -enable_components flags.
    2. Rolling-Upgrade Flag Compatibility & Always-On Redpanda CR Discovery (ingestion_gateway):
      • Action: kubectl logs -n xmc deployment/ingestion-gateway-deployment --tail=15
      • Result: Existing xmc-cmp-ingestion-gateway pods carrying legacy -enable_components=true args rolled cleanly onto the 1.0.0 image (0 restarts), logged "Successfully resolved and validated Redpanda configuration from Component CR", and validated topic xmc-metrics.
    3. Health Service Auth & Readiness:
      • Action: Probed /healthz (200) and unauthenticated /v1/health/configs (401) on svc/health-service.
      • Result: health-service-deployment (1/1 Running) enforces authentication while serving component-enabled health endpoints.

Related Issues / Bugs

N/A

TAG=agy
CONV=0d1e1e85-47f9-49da-a36c-92f916ef853f

@VLukiantsev
VLukiantsev added this pull request to stack #1634 November 9, 2026 19:50
@VLukiantsev VLukiantsev changed the title feat/components always on services feat(components): make components runtime always-on across Go services Nov 9, 2026

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request deprecates and removes the enable_components configuration flag across multiple services, making the components feature always enabled by default. Feedback on the changes highlights several potential nil pointer dereferences in the newly introduced lazy-loading helper functions and providers, specifically in buildClickHouseResolverWithLazy, buildBigQueryResolverWithLazy, isComponentExpectedWithLazy, and listCustomComponentConfigs, where pointers are dereferenced without defensive nil checks.

Comment thread cmd/dashboard_service/main.go Resolved
Comment thread cmd/dashboard_service/main.go Resolved
Comment thread cmd/dashboard_service/main.go Resolved
Comment thread cmd/health_service/server.go Resolved
VLukiantsev added a commit that referenced this pull request Nov 9, 2026
…rve gateway migration flag

Comment links:
- #1631 (comment)
- #1631 (comment)
- #1631 (comment)
- #1631 (comment)

TAG=agy

CONV=0d1e1e85-47f9-49da-a36c-92f916ef853f
@VLukiantsev

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request deprecates and removes the 'enable_components' configuration flag across multiple services (including the actuator, dashboard, experiment state server, health service, and ingestion gateway), making the components feature always enabled by default. Code paths and tests have been simplified accordingly. Feedback is provided to improve the robustness of the message bus validation in the ingestion gateway by trimming whitespace before checking for empty values.

Comment thread cmd/ingestion_gateway/main.go Resolved
VLukiantsev added a commit that referenced this pull request Nov 9, 2026
…panda default

Comment link: #1631 (comment)

TAG=agy

CONV=0d1e1e85-47f9-49da-a36c-92f916ef853f
@VLukiantsev VLukiantsev added the priority::1-critical needs to be review and merged quickly. label Nov 9, 2026
@VLukiantsev
VLukiantsev marked this pull request as ready for review November 10, 2026 09:51
Comment thread cmd/dashboard_service/main.go Resolved
Comment thread cmd/ingestion_gateway/main_test.go Resolved
Comment thread cmd/dashboard_service/main_test.go Resolved
Comment thread cmd/actuator/config.go Resolved
@VLukiantsev
VLukiantsev force-pushed the feat/components-always-on-services branch from bea6aee to 108cbf7 Compare November 10, 2026 12:30
Comment thread cmd/dashboard_service/main.go Resolved
Comment thread cmd/dashboard_service/main.go Resolved
Comment thread cmd/ingestion_gateway/main_test.go Resolved
Comment thread cmd/dashboard_service/main_test.go Resolved
Comment thread cmd/ingestion_gateway/main_test.go Resolved
Comment thread cmd/health_service/server.go Resolved
Comment thread cmd/actuator/config.go Resolved
janzak-dev
janzak-dev previously approved these changes Nov 10, 2026
Comment thread cmd/dashboard_service/main_test.go Resolved
Comment thread cmd/dashboard_service/main.go Resolved
Activate the Components control and data plane unconditionally across
experiment_state_server (CMS gRPC server, ownership metrics collector, drift
evaluation, and study component requirement validation), actuator (snapshot
evaluation and env/secret injection), dashboard_service (ClickHouse and
BigQuery Component CR discovery with static env fallback), health_service
(custom component health and config reporting), and ingestion_gateway
(Redpanda Component CR resolution when message_bus is redpanda).

Retain -enable_components CLI flags as deprecated no-op bindings on the four
binaries that previously registered them so rolling pod upgrades and legacy
invocations do not fail flag parsing, and drop -enable_components from the
stable-2026a ingestion-gateway component chart container arguments.

TAG=agy
CONV=0d1e1e85-47f9-49da-a36c-92f916ef853f
…late kubeconfig in tests

TAG=agy

CONV=0d1e1e85-47f9-49da-a36c-92f916ef853f
…rve gateway migration flag

Comment links:
- #1631 (comment)
- #1631 (comment)
- #1631 (comment)
- #1631 (comment)

TAG=agy

CONV=0d1e1e85-47f9-49da-a36c-92f916ef853f
…panda default

Comment link: #1631 (comment)

TAG=agy

CONV=0d1e1e85-47f9-49da-a36c-92f916ef853f
Remove redundant caller-side nil guards around lazyComponentGetter.get()
in cmd/dashboard_service/main.go so static-fallback warnings log
consistently and get()'s nil-receiver guard is exercised directly.

Remove unused -enable_components CLI flag sinks from actuator,
experiment_state_server, and health_service (which only read ConfigMap
envFrom variables, never container CLI args), retaining the unread
no-op CLI sink solely in ingestion_gateway where Helm container args
pass -enable_components=true during rolling upgrades.

Expand unit test coverage for Redpanda invalid-kubeconfig fallback in
cmd/ingestion_gateway, nil-receiver/nil-store guards in DriftEvaluator,
and shared isolateInvalidKubeconfig helpers in cmd/dashboard_service.

Comment link: #1631 (comment)
Comment link: #1631 (comment)
Comment link: #1631 (comment)
Comment link: #1631 (comment)
Comment link: #1631 (comment)

TAG=agy
CONV=0d1e1e85-47f9-49da-a36c-92f916ef853f
…ck tests

Render the dashboard-service-components-reader Role/RoleBinding and actuator
xmc.dev/components ClusterRole rule unconditionally so clusters without the
Component CRD or CR receive 404 NotFound rather than 403 Forbidden, and remove
unread enable_components keys from service ConfigMaps and the stable-2026a
ingestion-gateway chart values.

Delete test-only non-lazy wrappers in cmd/dashboard_service, clarify the
startup log when neither ClickHouse nor BigQuery is enabled (noting a pod
restart is required if enabled later), deduplicate nil lazyComponentGetter
assertions, add Forbidden fail-closed unit tests with and without static env,
centralize crreadertest.IsolateInvalidKubeconfig, export (*Config).UsesRedpanda()
with an observable getter factory in cmd/ingestion_gateway, drop the unread
Flags.DeprecatedEnableComponents field, and tighten cmd/health_service
nil-provider checks.

Comment link: #1631 (comment)
Comment link: #1631 (comment)
Comment link: #1631 (comment)
Comment link: #1631 (comment)
Comment link: #1631 (comment)
Comment link: #1631 (comment)
Comment link: #1631 (comment)
Comment link: #1631 (comment)
Comment link: #1631 (comment)

TAG=agy
CONV=0d1e1e85-47f9-49da-a36c-92f916ef853f

@github-actions github-actions Bot 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.

🤖 Incremental PR Approval

PR author is a code owner and changes since last approval (0 lines, excluding 2 test file lines) are within the 50-line grace delta.

Preserving prior approval by @janzak-dev on commit 2ad33c1.

github-actions[bot]
github-actions Bot previously approved these changes Nov 10, 2026

@github-actions github-actions Bot 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.

🤖 Incremental PR Approval

PR author is a code owner and changes since last approval (0 lines, excluding 2 test file lines) are within the 50-line grace delta.

Preserving prior approval by @janzak-dev on commit 2ad33c1.

…ickhouse accurately

- Replace `&&` with `||` and call `apierrors.IsForbidden(err)` across all
  Forbidden checks in `TestBigQueryMetricsStoreSelectionAndBuilder`
  (`cmd/dashboard_service/main_test.go`) so wrapping regressions cannot
  pass silently.
- Emit a specific startup log in `initDataEngineWithGetter` when
  `metrics_store=clickhouse` is disabled rather than claiming BigQuery was
  also checked, and add a unit subtest covering single-CR probe behavior.

Comment link: #1631 (comment)
Comment link: #1631 (comment)

TAG=agy
CONV=632bffa5-726f-467c-9524-87495fe2dfb2

@github-actions github-actions Bot 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.

🤖 Incremental PR Approval

PR author is a code owner and changes since last approval (6 lines, excluding 29 test file lines) are within the 50-line grace delta.

Preserving prior approval by @janzak-dev on commit 2ad33c1.

@VLukiantsev
VLukiantsev added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit b5acd7d Nov 12, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority::1-critical needs to be review and merged quickly.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants