Skip to content

Commit

Permalink
redpanda: exclude repo from version checks
Browse files Browse the repository at this point in the history
Prior to this commit version checks of redpanda would first check that the repo
was `docker.redpanda.com/redpandadata/redpanda`. This check was in place to
ensure that version checks could be relied upon as redpanda controls the
tagging of that repo.

Said check has led to more issues than it's prevented. Users may wish to self
host images or even use a pull through cache which would result in silently
incorrect `redpanda.yaml`.

This commit removes the long standing behavior. We'll instead rely on the
verification that the redpanda tag is a valid semver (which is asserted by the
Tag function). Should users need non-semver tags (such as specifying SHA256
digests) we'll need to decouple the container image from the version and use
some clever defaulting to preserve the current behavior.

Fixes #1334
  • Loading branch information
chrisseto committed Jun 26, 2024
1 parent d84efb0 commit 7d1ab26
Show file tree
Hide file tree
Showing 6 changed files with 4,373 additions and 11 deletions.
3 changes: 3 additions & 0 deletions charts/redpanda/chart_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ func VersionGoldenTestsCases(t *testing.T) []TemplateTestCase {
{
Image: redpanda.PartialImage{Repository: ptr.To("somecustomrepo"), Tag: ptr.To(redpanda.ImageTag("v24.1.0"))},
},
{
Image: redpanda.PartialImage{Repository: ptr.To("somecustomrepo"), Tag: ptr.To(redpanda.ImageTag("v23.2.8"))},
},
}

// A collection of features that are protected by the various above version
Expand Down
6 changes: 0 additions & 6 deletions charts/redpanda/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,6 @@ func RedpandaAtLeast_23_3_0(dot *helmette.Dot) bool {
}

func redpandaAtLeast(dot *helmette.Dot, constraint string) bool {
values := helmette.Unwrap[Values](dot.Values)

if values.Image.Repository != "docker.redpanda.com/redpandadata/redpanda" {
return true
}

version := strings.TrimPrefix(Tag(dot), "v")

result, err := helmette.SemverCompare(constraint, version)
Expand Down
5 changes: 0 additions & 5 deletions charts/redpanda/templates/_helpers.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,6 @@
{{- $dot := (index .a 0) -}}
{{- $constraint := (index .a 1) -}}
{{- range $_ := (list 1) -}}
{{- $values := $dot.Values.AsMap -}}
{{- if (ne $values.image.repository "docker.redpanda.com/redpandadata/redpanda") -}}
{{- (dict "r" true) | toJson -}}
{{- break -}}
{{- end -}}
{{- $version := (trimPrefix "v" (get (fromJson (include "redpanda.Tag" (dict "a" (list $dot) ))) "r")) -}}
{{- $tmp_tuple_3 := (get (fromJson (include "_shims.compact" (dict "a" (list (list (semverCompare $constraint $version) nil)) ))) "r") -}}
{{- $err := $tmp_tuple_3.T2 -}}
Expand Down
Loading

0 comments on commit 7d1ab26

Please sign in to comment.