Skip to content

Dependency Updates: Phased approach for operator and CLI #306

@hardbyte

Description

@hardbyte

Dependency Update Plan

This issue tracks a comprehensive update of dependencies across both the operator and CLI components of Netchecks.

Current Status

Operator Dependencies

  • Currently on Pydantic v1.10.x
  • Several packages need major version updates
  • Some dependencies removed/replaced (deprecated, wrapt)

CLI Dependencies

  • Using uv for dependency management
  • Needs similar update sweep

Phased Approach

Phase 1: Operator - Compatible Updates (CURRENT)

Goal: Update to latest compatible versions without breaking changes

Updates completed:

  • ✅ kopf: 1.37.1 → 1.38.0
  • ✅ kubernetes: 29.0.0 → 34.1.0
  • ✅ rich: 13.x → 14.x
  • ✅ structlog: 23.x → 25.4.0
  • ✅ prometheus-client: 0.16.0 → 0.23.1
  • ✅ opentelemetry-*: 1.24/1.25 → 1.37.0
  • ✅ ruff: 0.3.x → 0.14.0
  • ✅ pytest: 8.1.x → 8.4.x
  • ⏳ Kept pydantic at 1.10.24 (not breaking 2.x yet)

Testing Required:

  • Unit tests pass
  • Integration tests pass in kind cluster
  • Existing NetworkAssertions still work
  • PolicyReports generated correctly

Phase 2: Pydantic 2.x Migration (Operator)

Goal: Migrate to Pydantic 2.x with breaking changes

Impact Analysis:
Files using Pydantic:

  • operator/netchecks_operator/config.py - Uses BaseSettings, nested config
  • netcheck/checks/http.py - Uses BaseModel

Breaking Changes in Pydantic 2.x:

  1. BaseSettings moved to pydantic-settings package
  2. Config inner class → model_config attribute
  3. customise_sourcessettings_customise_sources
  4. env_nested_delimiter → nested model automatically parsed
  5. .json().model_dump_json()
  6. .dict().model_dump()

Migration Tasks:

  • Add pydantic-settings dependency
  • Update operator/netchecks_operator/config.py:
    • Change from pydantic import BaseSettingsfrom pydantic_settings import BaseSettings
    • Convert Config inner class to model_config
    • Update customise_sources to settings_customise_sources
  • Update netcheck/checks/http.py if using deprecated APIs
  • Search for .json() calls → replace with .model_dump_json()
  • Search for .dict() calls → replace with .model_dump()
  • Run full test suite
  • Update CLAUDE.md if migration notes needed

Phase 3: CLI Dependencies

Goal: Update netcheck CLI dependencies with uv

Current versions to update:

  • Check all outdated packages with uv
  • Similar pydantic 2.x migration needed for netcheck/checks/http.py
  • Update all test dependencies
  • Verify CLI commands still work

Testing Required:

  • uv run pytest passes
  • CLI commands work: netcheck dns, netcheck http, netcheck run
  • Docker image builds successfully
  • CEL validation still works

Phase 4: Final Integration Testing

Goal: Verify entire stack works with all updates

  • Build both Docker images with updated dependencies
  • Deploy to kind cluster
  • Run full integration test suite
  • Test all example NetworkAssertions
  • Verify PolicyReports generated correctly
  • Check operator metrics/telemetry still work
  • Performance testing (if needed)

Breaking Change Considerations

For Users

  • Operator image tag will change
  • Helm chart may need values.yaml updates
  • No CRD schema changes expected

Internal

  • Config loading mechanism may need adjustment
  • Environment variable parsing with nested models
  • JSON serialization calls need updating

Rollback Plan

If Phase 2+ causes issues:

  1. Revert pyproject.toml changes
  2. Run poetry install --sync or uv sync --frozen
  3. Rebuild Docker images from previous commit
  4. Keep Phase 1 updates (safe and tested)

Related Issues

  • None yet

Notes

  • Phase 1 is conservative - no breaking API changes
  • Phase 2 requires careful testing due to Pydantic 2.x breaking changes
  • Consider creating feature branch for Phase 2+
  • Document any migration issues in CLAUDE.md

Checklist

  • Phase 1: Compatible updates
  • Phase 1: Testing complete
  • Phase 2: Pydantic 2.x migration
  • Phase 2: Testing complete
  • Phase 3: CLI updates
  • Phase 3: Testing complete
  • Phase 4: Full integration testing
  • Update CLAUDE.md with any migration notes
  • Update README if needed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions