diff --git a/api/v1beta2/foundationdbbackup_types.go b/api/v1beta2/foundationdbbackup_types.go index bb17a645e..4c6992739 100644 --- a/api/v1beta2/foundationdbbackup_types.go +++ b/api/v1beta2/foundationdbbackup_types.go @@ -395,7 +395,7 @@ func (backup *FoundationDBBackup) GetEncryptionKey() (string, error) { // UseUnifiedImage returns true if the unified image should be used. func (backup *FoundationDBBackup) UseUnifiedImage() bool { - imageType := ImageTypeSplit + imageType := ImageTypeUnified if backup.Spec.ImageType != nil { imageType = *backup.Spec.ImageType } diff --git a/controllers/backup_controller_test.go b/controllers/backup_controller_test.go index 5b4d98ce7..15dbfbade 100644 --- a/controllers/backup_controller_test.go +++ b/controllers/backup_controller_test.go @@ -151,7 +151,7 @@ var _ = Describe("backup_controller", func() { Expect(*deployment.Spec.Replicas).To(Equal(int32(3))) Expect( deployment.Spec.Template.Spec.Containers[0].Image, - ).To(Equal(fmt.Sprintf("foundationdb/foundationdb:%s", cluster.Spec.Version))) + ).To(Equal(fmt.Sprintf("foundationdb/fdb-kubernetes-monitor:%s", cluster.Spec.Version))) }) It("should update the status on the resource", func() { @@ -319,7 +319,7 @@ var _ = Describe("backup_controller", func() { Expect(deployments.Items[0].ObjectMeta.Annotations).To(Equal(map[string]string{ "fdb-test-1": "test-value-1", "fdb-test-2": "test-value-2", - "foundationdb.org/last-applied-spec": "8d2e3abf517313fabdf4e19e50b46f9d5b63e5c5d587a01565008945a2dec87f", + "foundationdb.org/last-applied-spec": "946b41ecc6985d5f56d9749e9366132ba4e8cb250eb3bcfe73b037ad1f47c7f4", })) }) }) diff --git a/internal/pod_models_test.go b/internal/pod_models_test.go index 4873d2600..e7f3599e6 100644 --- a/internal/pod_models_test.go +++ b/internal/pod_models_test.go @@ -3576,7 +3576,7 @@ var _ = Describe("pod_models", func() { fdbv1beta2.BackupDeploymentLabel: string(cluster.ObjectMeta.UID), })) Expect(deployment.ObjectMeta.Annotations).To(Equal(map[string]string{ - "foundationdb.org/last-applied-spec": "8d2e3abf517313fabdf4e19e50b46f9d5b63e5c5d587a01565008945a2dec87f", + "foundationdb.org/last-applied-spec": "946b41ecc6985d5f56d9749e9366132ba4e8cb250eb3bcfe73b037ad1f47c7f4", })) }) @@ -3639,7 +3639,7 @@ var _ = Describe("pod_models", func() { It("should set the image and command for the backup agent", func() { Expect( container.Image, - ).To(Equal(fmt.Sprintf("foundationdb/foundationdb:%s", cluster.Spec.Version))) + ).To(Equal(fmt.Sprintf("foundationdb/fdb-kubernetes-monitor:%s", cluster.Spec.Version))) Expect(container.Command).To(Equal([]string{"backup_agent"})) Expect(container.Args).To(Equal([]string{ "--log", @@ -3690,13 +3690,18 @@ var _ = Describe("pod_models", func() { It("should set the image and command for the container", func() { Expect( container.Image, - ).To(Equal(fmt.Sprintf("foundationdb/foundationdb-kubernetes-sidecar:%s-1", cluster.Spec.Version))) + ).To(Equal(fmt.Sprintf("foundationdb/fdb-kubernetes-monitor:%s", cluster.Spec.Version))) Expect(container.Args).To(Equal([]string{ "--copy-file", "fdb.cluster", "--require-not-empty", "fdb.cluster", - "--init-mode", + "--mode", + "init", + "--output-dir", + "/var/output-files", + "--input-dir", + "/var/input-files", })) }) @@ -3897,7 +3902,7 @@ var _ = Describe("pod_models", func() { "foundationdb.org/backup-for": string(cluster.ObjectMeta.UID), })) Expect(deployment.ObjectMeta.Annotations).To(Equal(map[string]string{ - "foundationdb.org/last-applied-spec": "879780b88956de7a05e245cdbf16c565b95fe5c956e3a89e7ea259cd9b209d97", + "foundationdb.org/last-applied-spec": "23b6a2501f83a4cfcf760f639b1d841203ef4f44d496da072ebd1542870ad53f", })) Expect( @@ -3925,7 +3930,7 @@ var _ = Describe("pod_models", func() { ).To(Equal("foundationdb/foundationdb:dev")) Expect( deployment.Spec.Template.Spec.InitContainers[0].Image, - ).To(Equal("foundationdb/foundationdb-kubernetes-sidecar:dev-1")) + ).To(Equal("foundationdb/foundationdb:dev")) }) }) @@ -3963,37 +3968,36 @@ var _ = Describe("pod_models", func() { }) }) - When("using the unified image", func() { + When("using the split image", func() { BeforeEach(func() { - imageType := fdbv1beta2.ImageTypeUnified + imageType := fdbv1beta2.ImageTypeSplit backup.Spec.ImageType = &imageType deployment, err = GetBackupDeployment(backup) Expect(err).NotTo(HaveOccurred()) Expect(deployment).NotTo(BeNil()) }) - It("should use the unified image as main and init container", func() { - Expect(deployment.Spec.Template.Spec.InitContainers).To(HaveLen(1)) - Expect(deployment.Spec.Template.Spec.Containers).To(HaveLen(1)) + It( + "should use the split image as main container and the sidecar image as the init container", + func() { + Expect(deployment.Spec.Template.Spec.InitContainers).To(HaveLen(1)) + Expect(deployment.Spec.Template.Spec.Containers).To(HaveLen(1)) - Expect( - deployment.Spec.Template.Spec.InitContainers[0].Image, - ).To(HavePrefix(fdbv1beta2.FoundationDBKubernetesBaseImage)) - Expect(deployment.Spec.Template.Spec.InitContainers[0].Args).To(ConsistOf( - "--copy-file", - "fdb.cluster", - "--require-not-empty", - "fdb.cluster", - "--mode", - "init", - "--output-dir", - "/var/output-files", - "--input-dir", - "/var/input-files")) - Expect( - deployment.Spec.Template.Spec.Containers[0].Image, - ).To(HavePrefix(fdbv1beta2.FoundationDBKubernetesBaseImage)) - }) + Expect( + deployment.Spec.Template.Spec.InitContainers[0].Image, + ).To(HavePrefix(fdbv1beta2.FoundationDBSidecarBaseImage)) + Expect(deployment.Spec.Template.Spec.InitContainers[0].Args).To(ConsistOf( + "--copy-file", + "fdb.cluster", + "--require-not-empty", + "fdb.cluster", + "--init-mode", + )) + Expect( + deployment.Spec.Template.Spec.Containers[0].Image, + ).To(HavePrefix(fdbv1beta2.FoundationDBBaseImage)) + }, + ) }) })