operator-sdk icon indicating copy to clipboard operation
operator-sdk copied to clipboard

How to sync `RELATED_IMAGE` environment variables with `spec.relatedImages` when using image digests?

Open damemi opened this issue 8 months ago • 0 comments

Type of question

Best practices

Question

What did you do?

Hi, we have several operands which we define in our manager's kustomization file like so: https://github.com/odigos-io/odigos/blob/5b5b1c02b1184936ab223265a6087071be258da3/operator/config/manager/kustomization.yaml#L6-L11

These get updated to the latest version when we update the Makefile's VERSION variable

The manager consumes these values through RELATED_IMAGE env vars we manually defined in the manager's manifest: https://github.com/odigos-io/odigos/blob/5b5b1c02b1184936ab223265a6087071be258da3/operator/config/manager/manager.yaml#L80-L83

When the bundle is generated with USE_IMAGE_DIGESTS, the output CSV correctly updates the image SHA to the latest version under spec.relatedImages, but the environment variables in the output CSV don't get the latest SHA (unless we update those values in the manifest)

Is there a recommended best practice to keep the environment variables in sync with the digest SHA? Should we not be defining those manually? Just looking for any recommendations, thank you

What did you expect to see?

Setting USE_IMAGE_DIGESTS updates spec.relatedImages and the matching RELATED_IMAGE environment variables

What did you see instead? Under which circumstances?

RELATED_IMAGE environment variables use the digest SHA for the version specified in the manager's manifest, unless the version is updated in those variables too

Environment

Operator type:

/language go

Kubernetes cluster type:

n/a

$ operator-sdk version

operator-sdk version: "v1.39.1", commit: "b8a728e15447465a431343a664e9a27ff9db655e", kubernetes version: "v1.31.0", go version: "go1.23.4", GOOS: "darwin", GOARCH: "arm64"

$ go version (if language is Go)

go version go1.24.0 darwin/arm64

$ kubectl version

n/a

Additional context

damemi avatar Apr 07 '25 18:04 damemi