-
Notifications
You must be signed in to change notification settings - Fork 1
fix: Update-images #310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Update-images #310
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -9,6 +9,7 @@ import ( | |||||
| "github.com/wandb/operator/pkg/utils" | ||||||
| chkv1 "github.com/wandb/operator/pkg/vendored/altinity-clickhouse/clickhouse-keeper.altinity.com/v1" | ||||||
| chiv1 "github.com/wandb/operator/pkg/vendored/altinity-clickhouse/clickhouse.altinity.com/v1" | ||||||
| "github.com/wandb/operator/pkg/wandb/manifest" | ||||||
| corev1 "k8s.io/api/core/v1" | ||||||
| "k8s.io/apimachinery/pkg/api/resource" | ||||||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||||||
|
|
@@ -33,7 +34,7 @@ var _ = Describe("Keeper vendor spec", func() { | |||||
| }, | ||||||
| } | ||||||
|
|
||||||
| chk, err := ToKeeperVendorSpec(context.Background(), wandb, wandb.Spec.ClickHouse[apiv2.DefaultInstanceName].ManagedClickHouse, keeperScheme(), keeperNsName()) | ||||||
| chk, err := ToKeeperVendorSpec(context.Background(), wandb, wandb.Spec.ClickHouse[apiv2.DefaultInstanceName].ManagedClickHouse, keeperScheme(), keeperNsName(), manifest.Manifest{}) | ||||||
| Expect(err).NotTo(HaveOccurred()) | ||||||
| Expect(chk).NotTo(BeNil()) | ||||||
| Expect(chk.Name).To(Equal("clickhouse-chk")) | ||||||
|
|
@@ -48,7 +49,7 @@ var _ = Describe("Keeper vendor spec", func() { | |||||
|
|
||||||
| Expect(chk.Spec.Templates.PodTemplates).To(HaveLen(1)) | ||||||
| container := chk.Spec.Templates.PodTemplates[0].Spec.Containers[0] | ||||||
| Expect(container.Image).To(Equal(KeeperImage)) | ||||||
| Expect(container.Image).To(Equal(KeeperImage(manifest.ImageRef{}, ""))) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Assert the fallback independently of the implementation helper. The production value and expected value both call Proposed fix- Expect(container.Image).To(Equal(KeeperImage(manifest.ImageRef{}, "")))
+ Expect(container.Image).To(Equal(defaultKeeperImage))📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| Expect(container.Name).To(Equal(keeperContainerName)) | ||||||
| Expect(container.Resources.Requests[corev1.ResourceCPU]).To(Equal(resource.MustParse("250m"))) | ||||||
|
|
||||||
|
|
@@ -60,17 +61,36 @@ var _ = Describe("Keeper vendor spec", func() { | |||||
| Expect(*sc.RunAsNonRoot).To(BeTrue()) | ||||||
| }) | ||||||
|
|
||||||
| It("uses the Keeper image from the server manifest", func() { | ||||||
| wandb := keeperWandb() | ||||||
| wandb.Spec.Global.ImageRegistry = "myregistry.io" | ||||||
| mfst := manifest.Manifest{ | ||||||
| ClickhouseKeeper: map[string]manifest.InfraConfig{ | ||||||
| "default": { | ||||||
| Images: map[string]manifest.ImageRef{ | ||||||
| "keeper": {Registry: "docker.io", Repository: "altinity/clickhouse-keeper", Tag: "25.8"}, | ||||||
| }, | ||||||
| }, | ||||||
| }, | ||||||
| } | ||||||
|
|
||||||
| chk, err := ToKeeperVendorSpec(context.Background(), wandb, wandb.Spec.ClickHouse[apiv2.DefaultInstanceName].ManagedClickHouse, keeperScheme(), keeperNsName(), mfst) | ||||||
| Expect(err).NotTo(HaveOccurred()) | ||||||
| Expect(chk.Spec.Templates.PodTemplates[0].Spec.Containers[0].Image). | ||||||
| To(Equal("myregistry.io/docker.io/altinity/clickhouse-keeper:25.8")) | ||||||
| }) | ||||||
|
|
||||||
| It("errors when keeper storage size is unset (no operator defaults)", func() { | ||||||
| wandb := keeperWandb() | ||||||
| wandb.Spec.ClickHouse[apiv2.DefaultInstanceName].ManagedClickHouse.Keeper = apiv2.ClickHouseKeeperSpec{} | ||||||
| _, err := ToKeeperVendorSpec(context.Background(), wandb, wandb.Spec.ClickHouse[apiv2.DefaultInstanceName].ManagedClickHouse, keeperScheme(), keeperNsName()) | ||||||
| _, err := ToKeeperVendorSpec(context.Background(), wandb, wandb.Spec.ClickHouse[apiv2.DefaultInstanceName].ManagedClickHouse, keeperScheme(), keeperNsName(), manifest.Manifest{}) | ||||||
| Expect(err).To(HaveOccurred()) | ||||||
| }) | ||||||
|
|
||||||
| It("omits fixed IDs in OpenShift mode", func() { | ||||||
| utils.SetOpenShiftMode(true) | ||||||
| wandb := keeperWandb() | ||||||
| chk, err := ToKeeperVendorSpec(context.Background(), wandb, wandb.Spec.ClickHouse[apiv2.DefaultInstanceName].ManagedClickHouse, keeperScheme(), keeperNsName()) | ||||||
| chk, err := ToKeeperVendorSpec(context.Background(), wandb, wandb.Spec.ClickHouse[apiv2.DefaultInstanceName].ManagedClickHouse, keeperScheme(), keeperNsName(), manifest.Manifest{}) | ||||||
| Expect(err).NotTo(HaveOccurred()) | ||||||
| sc := chk.Spec.Templates.PodTemplates[0].Spec.SecurityContext | ||||||
| Expect(sc.RunAsUser).To(BeNil()) | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Preserve the fallback when a global registry is configured.
For an older manifest,
manifest.ImageRef{}passed toGetImage("myregistry.io")returns"myregistry.io/", soout != ""skips the fallback and produces an invalid image. Even after fixing detection, returningdefaultKeeperImagedirectly would bypass the global registry.Detect an empty repository before calling
GetImage, then apply the same global-registry prefix to the fallback and add a regression test for an empty image with a non-empty global registry.Proposed fix
func KeeperImage(img manifest.ImageRef, globalImageRegistry string) string { + if img.Repository == "" { + return (manifest.ImageRef{Repository: defaultKeeperImage}).GetImage(globalImageRegistry) + } if out := img.GetImage(globalImageRegistry); out != "" { return out }📝 Committable suggestion
🤖 Prompt for AI Agents