feat: make sidecar container image configurable to fix forked repository deployments #505
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
When forked repositories create custom images with tags like
v0.25.1-test, the sidecar containers (healthcheck, version-check-interval, and version-check) still try to fetch the hardcoded imageghcr.io/strangelove-ventures/cosmos-operator:v0.25.1-test, which doesn't exist in the upstream registry. This causes deployment failures for forked repositories.Solution
Refactored image retrieval in pod builder to use a new
version.Image()method instead of hardcoded image references, enabling forked repositories to override the container image via build-time ldflags.Changes Made
version.Image()method ininternal/version/version.gothat returns configurable image nameinternal/fullnode/pod_builder.go) to useversion.Image()instead of hardcodedghcr.io/strangelove-ventures/cosmos-operatorIMGbuild argument and pass it via ldflagsBenefits
Usage for Forked Repositories
Forked repositories can now set their custom image during build:
go build -ldflags "-X github.com/strangelove-ventures/cosmos-operator/internal/version.image=ghcr.io/my-fork/cosmos-operator"