Skip to content

feat: add legacy sidecar support for pre-1.28 Kubernetes clusters#129

Open
miyunari wants to merge 2 commits intomainfrom
feat/legacy-sidecar-support
Open

feat: add legacy sidecar support for pre-1.28 Kubernetes clusters#129
miyunari wants to merge 2 commits intomainfrom
feat/legacy-sidecar-support

Conversation

@miyunari
Copy link
Copy Markdown
Member

@miyunari miyunari commented Apr 1, 2026

Summary

  • Adds automatic Kubernetes version detection to determine native sidecar support (1.28+)
  • On pre-1.28 clusters with continuous validation enabled, falls back to injecting a one-shot init container (initial validation) plus a traditional sidecar container (periodic re-validation) instead of using native sidecars
  • Adds --skip-initial flag to validation-agent so the legacy sidecar skips redundant initial validation already performed by the init container

Changes

File Change
internal/webhooks/version.go New — NativeSidecarSupport() queries K8s API server version
internal/webhooks/pod_webhook.go NewPodInterceptor accepts nativeSidecarSupport bool; new buildLegacySidecarContainer; idempotency check covers both init and regular containers
cmd/validation-agent/main.go Added --skip-initial flag
cmd/main.go Detects native sidecar support at startup, passes to webhook
internal/constants/images.go Added ModelValidationSidecarContainerName constant
api/v1alpha1/modelvalidation_types.go Updated ContinuousValidation docs
internal/webhooks/pod_webhook_legacy_test.go New — tests for legacy sidecar path

Test plan

  • All existing unit tests pass (make test)
  • New tests cover legacy sidecar build functions, idempotency, and annotation tracking
  • Manual test on a pre-1.28 Kind cluster with continuous validation enabled
  • Manual test on a 1.29+ cluster to verify native sidecar path is unchanged

🤖 Generated with Claude Code

miyunari and others added 2 commits April 1, 2026 14:13
Continuous validation previously required native sidecars (restartPolicy:
Always on init containers), which is only available on Kubernetes 1.28+.
This adds automatic version detection and a fallback strategy for older
clusters: a one-shot init container for initial validation plus a
traditional sidecar container for periodic re-validation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds --force-legacy-sidecar flag (and FORCE_LEGACY_SIDECAR env var) to
force legacy sidecar mode on clusters that support native sidecars. This
enables e2e testing of the legacy path on modern Kind clusters.

The e2e test enables the flag via env var on the operator deployment,
deploys a ModelValidation CR with continuous validation, and verifies
that both the one-shot init container and legacy sidecar container are
injected correctly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant