← Back to Pull requests

feat(spark): check control plane version ConfigMap (#221) #846

Open
unknown opened this pull request with 386 lines diff across 4 files
View on GitHub
unknown unknown commented on Oct 09, 2026 18:12 UTC
Author

What this PR does / why we need it

Implements control-plane version check during Spark backend/client initialization, validating the kubeflow-spark-public ConfigMap in the control-plane namespace.

To support modular namespace overrides across Kubeflow components, this PR introduces a shared get_component_namespace utility in kubeflow/common. The helper resolves namespaces by prioritizing component-specific variables (KUBEFLOW_SPARK_NAMESPACE / KUBEFLOW_TRAINER_NAMESPACE), falling back to the deprecated KUBEFLOW_SYSTEM_NAMESPACE with a UserWarning, and defaulting to kubeflow-system. Both Spark and Trainer backends have been aligned to this shared resolution pattern.

Fixes #221

Changes

kubeflow/common

  • Added get_component_namespace(component_env_var: str, default: str = "kubeflow-system") -> str in kubeflow/common/utils.py with fallback and deprecation warning handling.

  • Added unit tests in kubeflow/common/utils_test.py covering precedence hierarchy, environment overrides, and warning assertions.
  • kubeflow/spark

  • Added verify_backend() to KubernetesBackend in kubeflow/spark/backends/kubernetes/backend.py and invoked it during backend __init__.

  • Checked kubeflow-spark-public ConfigMap for kubeflow_spark_version without blocking initialization or raising unhandled exceptions on read failure.

  • Updated docs/source/spark/index.rst to document KUBEFLOW_SPARK_NAMESPACE and fallback order.

  • Added mock helpers and parametrized tests in kubeflow/spark/backends/kubernetes/backend_test.py enforcing strict mock assertions (assert_called_with for name and namespace) and verifying env-var wiring.
  • kubeflow/trainer

  • Updated verify_backend() in kubeflow/trainer/backends/kubernetes/backend.py to use common_utils.get_component_namespace with KUBEFLOW_TRAINER_NAMESPACE_ENV_VAR.

  • Added test_verify_backend_respects_trainer_namespace_env_var in kubeflow/trainer/backends/kubernetes/backend_test.py to assert custom trainer namespace resolution and mock arguments.
  • Verification

  • Shared common utility tests pass:

  • Spark backend unit tests pass:

  • Trainer backend unit tests pass:

  • Pre-commit hooks and linter checks pass cleanly (pre-commit run --all-files).

  • DCO sign-off verified on git commit.
  • <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    New Features
    Spark and Trainer control-plane namespaces can now be configured independently. If a component-specific namespace is not set, the system namespace is used; otherwise, the default is kubeflow-system.
    Spark checks for installed operator version metadata in the configured control-plane namespace. If the metadata cannot be read, a warning is logged.
    Documentation
    * Added guidance on Spark version discovery and ConfigMap placement, including how to select a custom operator namespace.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 386 lines (+289 / -97) across 4 files Reviewer: tariq-hasan Review duration: 76431m
    All Vouch review confidence checks passed
    Residual risk 0.40 = Change Risk (0.73) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.73 · 386 lines diff across 4 files
    0.73
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.356
    Shallow Review Depth shallow_review_depth
    0.344
    Sensitive Paths sensitive_paths
    0.073
    Real PR Conversation Timeline
    1 comments
    "Review active on #846"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 44.7% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 73.2% (HIGH) · Higher = larger blast radius
    73.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 44.7% · Lower = rushed or shallow review
    44.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 40.5% · Moderate risk
    40.5%
    Repository