Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions modules/kafka/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ func validateKRaftVersion(fqName string) error {
version = "v" + version
}

// remove the architecture suffix
if strings.HasSuffix(version, ".amd64") || strings.HasSuffix(version, ".arm64") {
version = version[:strings.LastIndex(version, ".")]
Copy link
Author

Choose a reason for hiding this comment

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

@mdelapenya How about something like this? But at this point, we might as well let them use the image by fixing the version.

Suggested change
version = version[:strings.LastIndex(version, ".")]
return fmt.Errorf("invalid image tag %q: architecture suffixes like .arm64 or .amd64 are not valid semver; please use a multi-architecture image instead", tag)

Copy link
Member

Choose a reason for hiding this comment

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

Given we are using semver libraries to get a valid version, then we should honor it. I think this is a good compromise, failing if the version is not following semver.

Copy link
Member

Choose a reason for hiding this comment

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

@asahasrabuddhe let's apply that fix, so we can merge this PR

Thanks!

}

if semver.Compare(version, "v7.4.0") < 0 { // version < v7.4.0
return fmt.Errorf("version=%s. KRaft mode is only available since version 7.4.0", version)
}
Expand Down
10 changes: 10 additions & 0 deletions modules/kafka/kafka_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@ func TestValidateKRaftVersion(t *testing.T) {
image: "my-kafka:1.0.0",
wantErr: false,
},
{
name: "Official: valid, with the amd64 architecture suffix",
image: "confluentinc/confluent-local:7.5.9.amd64",
wantErr: false,
},
{
name: "Official: valid, with the arm64 architecture suffix",
image: "confluentinc/confluent-local:7.5.9.arm64",
wantErr: false,
},
}

for _, test := range tests {
Expand Down
Loading