Skip to content

Commit

Permalink
Update Maps Images to multi-arch (#8085)
Browse files Browse the repository at this point in the history
Removes the special casing for Map Server as of 8.16.0 when setting the container images.
Removes the exception for Maps Server for e2e tests on ARM after 8.16.0. There was an unintentional exception for Logstash as well that is removed by this change too.
  • Loading branch information
pebrc authored Oct 9, 2024
1 parent e415ac0 commit 8ba139c
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
1 change: 0 additions & 1 deletion .buildkite/e2e/nightly-main-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
fixed:
E2E_PROVIDER: eks-arm
E2E_TEST_ENV_TAGS: arch:arm
E2E_TAGS: "es,kb,apm,ent,beat,agent"
TEST_LICENSE: "" # disabled b/c https://github.com/elastic/elasticsearch/issues/68083
MONITORING_SECRETS: "" # disabled b/c beats cannot run on ARM

Expand Down
1 change: 0 additions & 1 deletion .buildkite/e2e/release-branch-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
fixed:
E2E_PROVIDER: eks-arm
E2E_TEST_ENV_TAGS: arch:arm
E2E_TAGS: "es,kb,apm,ent,beat,agent"
TEST_LICENSE: "" # disabled b/c https://github.com/elastic/elasticsearch/issues/68083
MONITORING_SECRETS: "" # disabled b/c beats cannot run on ARM

Expand Down
11 changes: 10 additions & 1 deletion pkg/controller/common/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ const (
LogstashImage Image = "logstash/logstash"
)

var MinMapsVersionOnARM = version.MinFor(8, 16, 0)

// ImageRepository returns the full container image name by concatenating the current container registry and the image path with the given version.
// A UBI suffix (-ubi8 or -ubi suffix depending on the version) is appended to the image name for the maps image,
// or any image if the operator is configured with --ubi-only.
Expand All @@ -81,7 +83,7 @@ func ImageRepository(img Image, ver version.Version) string {
suffix := ""
useUBISuffix := containerSuffix == UBISuffix
// use an UBI suffix for maps server image or any image in UBI mode
if useUBISuffix || img == MapsImage {
if useUBISuffix || isOlderMapsServerImg(img, ver) {
suffix = getUBISuffix(ver)
}
// use the global container suffix in non-UBI mode
Expand All @@ -92,6 +94,13 @@ func ImageRepository(img Image, ver version.Version) string {
return fmt.Sprintf("%s/%s%s:%s", containerRegistry, image, suffix, ver)
}

// isOderMapsServerImg returns true if the given image is a Maps server image and
// older than 8.16.0 as of which release the Maps server images are multi-arch similar to
// other stack images and come in non-UBI variants as well.
func isOlderMapsServerImg(img Image, ver version.Version) bool {
return img == MapsImage && ver.LT(MinMapsVersionOnARM)
}

// getUBISuffix returns the UBI suffix to use depending on the given version.
func getUBISuffix(ver version.Version) string {
if ver.Major == 7 && ver.LT(major7UbiSuffixMinVersion) {
Expand Down
13 changes: 13 additions & 0 deletions pkg/controller/common/container/container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,19 @@ func TestImageRepository(t *testing.T) {
suffix: "-obi1",
want: testRegistry + "/elastic-maps-service/elastic-maps-server-ubi8-obi1:8.11.0",
},
{
name: "Maps 8 image post 8.16 wolfi-based",
image: MapsImage,
version: "8.16.0",
want: testRegistry + "/elastic-maps-service/elastic-maps-server:8.16.0",
},
{
name: "Maps 8 image post 8.16 ubi requested",
image: MapsImage,
version: "8.16.0",
suffix: "-ubi",
want: testRegistry + "/elastic-maps-service/elastic-maps-server-ubi:8.16.0",
},
}

for _, tc := range testCases {
Expand Down
5 changes: 5 additions & 0 deletions test/e2e/test/maps/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

commonv1 "github.com/elastic/cloud-on-k8s/v2/pkg/apis/common/v1"
"github.com/elastic/cloud-on-k8s/v2/pkg/apis/maps/v1alpha1"
"github.com/elastic/cloud-on-k8s/v2/pkg/controller/common/container"
"github.com/elastic/cloud-on-k8s/v2/pkg/controller/common/version"
"github.com/elastic/cloud-on-k8s/v2/pkg/utils/k8s"
"github.com/elastic/cloud-on-k8s/v2/test/e2e/cmd/run"
Expand Down Expand Up @@ -152,6 +153,10 @@ func (b Builder) SkipTest() bool {
return true
}
ver := version.MustParse(b.EMS.Spec.Version)
// ARM is only supported as of 8.16.0
if test.Ctx().HasTag(test.ArchARMTag) && ver.LT(container.MinMapsVersionOnARM) {
return true
}
return version.SupportedMapsVersions.WithinRange(ver) != nil
}

Expand Down

0 comments on commit 8ba139c

Please sign in to comment.