Skip to content

Propagate Prometheus image version to statefulset - #3358

Merged
brancz merged 3 commits into
prometheus-operator:masterfrom
jbfavre:fix_prometheus_version_propagation
Jul 27, 2020
Merged

brancz merged 3 commits into
prometheus-operator:masterfrom
jbfavre:fix_prometheus_version_propagation

Conversation

@jbfavre

@jbfavre jbfavre commented Jul 24, 2020

Copy link
Copy Markdown
Contributor

Since 0.35.0 release, some fields have been deprecated:

  • spec.baseImage
  • spec.tag
  • spec.sha

In code, pkg/prometheus/statefulset.go line 284 and later, operator build prometheusImagePath using deprecated fields and spec.Version. At line 287, if spec.Image is defined, operator will simply replace prometheusImagePath value with spec.Image value.

This skip the version, which is not propagated anymore to statefulset definition.
This patch intends to be able to use either version or tag information to set Prometheus version for statefulset.
This brings back the old behaviour while keeping the deprecation mechanism

@brancz

brancz commented Jul 24, 2020

Copy link
Copy Markdown
Contributor

Could we add some tests for these scenarios?

@jbfavre

jbfavre commented Jul 24, 2020

Copy link
Copy Markdown
Contributor Author

@brancz sure I can. What scenarios do you want to test ?
I'll also fix the TestTagAndShaAndVersion unit test


resultImage := sset.Spec.Template.Spec.Containers[0].Image
expected := "my-reg/prometheus:latest"
expected := "my-reg/prometheus:latest@sha256:7384a79f4b4991bf8269e7452390249b7c70bcdd10509c8c1c6c6e30e32fb324"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this right? if I'm not mistaken I believe this would not work

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it's working:

> docker pull debian
Using default tag: latest
latest: Pulling from library/debian
31dd5ebca5ef: Pull complete 
Digest: sha256:68f4e2259032a4e6f5035804e64438b52af8dd5889528b305b9059183ea4cd2a
Status: Downloaded newer image for debian:latest
docker.io/library/debian:latest

> docker pull debian:latest
latest: Pulling from library/debian
Digest: sha256:68f4e2259032a4e6f5035804e64438b52af8dd5889528b305b9059183ea4cd2a
Status: Image is up to date for debian:latest
docker.io/library/debian:latest

> docker pull debian@sha256:68f4e2259032a4e6f5035804e64438b52af8dd5889528b305b9059183ea4cd2a
sha256:68f4e2259032a4e6f5035804e64438b52af8dd5889528b305b9059183ea4cd2a: Pulling from library/debian
Digest: sha256:68f4e2259032a4e6f5035804e64438b52af8dd5889528b305b9059183ea4cd2a
Status: Image is up to date for debian@sha256:68f4e2259032a4e6f5035804e64438b52af8dd5889528b305b9059183ea4cd2a
docker.io/library/debian@sha256:68f4e2259032a4e6f5035804e64438b52af8dd5889528b305b9059183ea4cd2a

> docker pull debian:latest@sha256:68f4e2259032a4e6f5035804e64438b52af8dd5889528b305b9059183ea4cd2a
sha256:68f4e2259032a4e6f5035804e64438b52af8dd5889528b305b9059183ea4cd2a: Pulling from library/debian
Digest: sha256:68f4e2259032a4e6f5035804e64438b52af8dd5889528b305b9059183ea4cd2a
Status: Image is up to date for debian@sha256:68f4e2259032a4e6f5035804e64438b52af8dd5889528b305b9059183ea4cd2a
docker.io/library/debian:latest@sha256:68f4e2259032a4e6f5035804e64438b52af8dd5889528b305b9059183ea4cd2a

@brancz brancz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm thank you!

@brancz
brancz merged commit f1e0131 into prometheus-operator:master Jul 27, 2020
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.

2 participants