Make DefaultSidecarImage operator-configurable via env var instead of compile-time constant

Open
#205 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
78/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Quiet
Tech stack
go, kubernetes

Research direction

Start with the Config struct and Validate() in internal/platform/platform.go, then inspect sidecarImage in internal/noderesource/noderesource.go and the environment entries in manifests/manager.yaml. Add the env-var override while preserving the constant fallback and existing per-SND precedence. Run the relevant controller tests, including a test showing the configured image reaches sidecarImage().

Written by the indexing model from the issue text.

Description

Problem

DefaultSidecarImage at internal/platform/platform.go:8 is a compile-time constant. Bumping the default sidecar image (e.g. when the sei-config schema gains a new field that the sidecar's vendored sei-config doesn't yet recognize) requires:

  1. Editing the constant in source.
  2. Cutting a controller PR + merge.
  3. Rebuilding the controller container image via CI.
  4. Bumping the controller image in the cluster manifest.
  5. Rolling out the new controller pod.

That's 4 layers of release cadence tied together for what's fundamentally a single config value. It also tightly couples the controller's release cycle to the sidecar's, which slows down sidecar version bumps that should be cheap.

Impact

Most recently surfaced when the harbor nightly release-test orchestrator needed evm.enabled_legacy_sei_apis overrides — the sidecar built against sei-config v0.0.13 rejected the override key, requiring the constant bump in #204 (sei-k8s-controller). That whole flow could have been a single Flux manifest update if the constant were an env var instead.

Future situations where this matters:

  • New sei-config schema fields where the sidecar must catch up.
  • Operator-side seictl security patches that don't touch the controller binary.
  • Per-cluster sidecar versioning (test clusters running a newer/older sidecar than prod for validation).

Relevant experts

  • kubernetes-specialist — owns the controller's environment / config-handling pattern.
  • platform-engineer — owns the manifest layout that operators use.

Proposed approach

Add a new env var SEI_DEFAULT_SIDECAR_IMAGE read at controller startup. Wire it into the existing platform.Config struct in internal/platform/platform.go alongside the other SEI_* config fields (SEI_NODEPOOL_NAME, SEI_TOLERATION_KEY, etc.).

// platform.Config (existing struct)
type Config struct {
    // ... existing fields ...
    DefaultSidecarImage string  // SEI_DEFAULT_SIDECAR_IMAGE
}

sidecarImage(node) at internal/noderesource/noderesource.go:285 consumes Config.DefaultSidecarImage instead of the package-level constant. The constant platform.DefaultSidecarImage becomes the fallback only if the env var is unset (preserves backward compatibility for tests, local dev, and any deployment that hasn't set the env var yet).

Architectural constraints

  • The constant must remain as a fallback — operators who haven't set the env var get the same behavior as before.
  • The env var should be required in Config.Validate() once the operator-facing manifest is updated to set it. Stage this as a non-breaking change first (constant fallback), then promote to required in a follow-up once all consumers are updated.
  • Existing per-SND override path (spec.template.spec.sidecar.image) wins over the env var, just like it currently wins over the constant. No change to sidecarImage() precedence ordering.

Acceptance criteria

  • Config.DefaultSidecarImage field added; reads from SEI_DEFAULT_SIDECAR_IMAGE env var.
  • sidecarImage(node) reads Config.DefaultSidecarImage instead of the package-level constant.
  • Constant remains as fallback; env-var-unset path is identical to today.
  • Manifest in manifests/manager.yaml (or equivalent) sets the env var.
  • Test that env-var override flows through to sidecarImage().

Out of scope

  • Removing the package-level constant entirely (keep as fallback for now).
  • Per-SeiNode-mode sidecar images (e.g., archive nodes get a different sidecar). If needed, separate issue.
  • Configuring the sidecar's bootstrap image via env var (the init sidecar, if different).

References

  • Compile-time site: internal/platform/platform.go:8.
  • Consumer: internal/noderesource/noderesource.go:285-290 (sidecarImage function).
  • Recent bump that motivated this: #204.
  • Existing env-var pattern in Config.Validate(): internal/platform/platform.go:60-93.
Dominant language
Go
Stars
1
Forks
2
Avg merge
2h 29m
Merged PRs (30d)
56

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sei-protocol/sei-k8s-controller

All issues in sei-protocol/sei-k8s-controller

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.