Skip to content

Commit 33f83b2

Browse files
hxuHan Xujohscheuer
authored
Update backup agent default image type to unified (#2351)
* Update default backup image to the unified image. --------- Co-authored-by: Han Xu <hxu@palantir.com> Co-authored-by: Johannes Scheuermann <johscheuer@users.noreply.github.com>
1 parent 13a0b20 commit 33f83b2

File tree

3 files changed

+36
-32
lines changed

3 files changed

+36
-32
lines changed

api/v1beta2/foundationdbbackup_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ func (backup *FoundationDBBackup) GetEncryptionKey() (string, error) {
395395

396396
// UseUnifiedImage returns true if the unified image should be used.
397397
func (backup *FoundationDBBackup) UseUnifiedImage() bool {
398-
imageType := ImageTypeSplit
398+
imageType := ImageTypeUnified
399399
if backup.Spec.ImageType != nil {
400400
imageType = *backup.Spec.ImageType
401401
}

controllers/backup_controller_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ var _ = Describe("backup_controller", func() {
151151
Expect(*deployment.Spec.Replicas).To(Equal(int32(3)))
152152
Expect(
153153
deployment.Spec.Template.Spec.Containers[0].Image,
154-
).To(Equal(fmt.Sprintf("foundationdb/foundationdb:%s", cluster.Spec.Version)))
154+
).To(Equal(fmt.Sprintf("foundationdb/fdb-kubernetes-monitor:%s", cluster.Spec.Version)))
155155
})
156156

157157
It("should update the status on the resource", func() {
@@ -319,7 +319,7 @@ var _ = Describe("backup_controller", func() {
319319
Expect(deployments.Items[0].ObjectMeta.Annotations).To(Equal(map[string]string{
320320
"fdb-test-1": "test-value-1",
321321
"fdb-test-2": "test-value-2",
322-
"foundationdb.org/last-applied-spec": "8d2e3abf517313fabdf4e19e50b46f9d5b63e5c5d587a01565008945a2dec87f",
322+
"foundationdb.org/last-applied-spec": "946b41ecc6985d5f56d9749e9366132ba4e8cb250eb3bcfe73b037ad1f47c7f4",
323323
}))
324324
})
325325
})

internal/pod_models_test.go

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3576,7 +3576,7 @@ var _ = Describe("pod_models", func() {
35763576
fdbv1beta2.BackupDeploymentLabel: string(cluster.ObjectMeta.UID),
35773577
}))
35783578
Expect(deployment.ObjectMeta.Annotations).To(Equal(map[string]string{
3579-
"foundationdb.org/last-applied-spec": "8d2e3abf517313fabdf4e19e50b46f9d5b63e5c5d587a01565008945a2dec87f",
3579+
"foundationdb.org/last-applied-spec": "946b41ecc6985d5f56d9749e9366132ba4e8cb250eb3bcfe73b037ad1f47c7f4",
35803580
}))
35813581
})
35823582

@@ -3639,7 +3639,7 @@ var _ = Describe("pod_models", func() {
36393639
It("should set the image and command for the backup agent", func() {
36403640
Expect(
36413641
container.Image,
3642-
).To(Equal(fmt.Sprintf("foundationdb/foundationdb:%s", cluster.Spec.Version)))
3642+
).To(Equal(fmt.Sprintf("foundationdb/fdb-kubernetes-monitor:%s", cluster.Spec.Version)))
36433643
Expect(container.Command).To(Equal([]string{"backup_agent"}))
36443644
Expect(container.Args).To(Equal([]string{
36453645
"--log",
@@ -3690,13 +3690,18 @@ var _ = Describe("pod_models", func() {
36903690
It("should set the image and command for the container", func() {
36913691
Expect(
36923692
container.Image,
3693-
).To(Equal(fmt.Sprintf("foundationdb/foundationdb-kubernetes-sidecar:%s-1", cluster.Spec.Version)))
3693+
).To(Equal(fmt.Sprintf("foundationdb/fdb-kubernetes-monitor:%s", cluster.Spec.Version)))
36943694
Expect(container.Args).To(Equal([]string{
36953695
"--copy-file",
36963696
"fdb.cluster",
36973697
"--require-not-empty",
36983698
"fdb.cluster",
3699-
"--init-mode",
3699+
"--mode",
3700+
"init",
3701+
"--output-dir",
3702+
"/var/output-files",
3703+
"--input-dir",
3704+
"/var/input-files",
37003705
}))
37013706
})
37023707

@@ -3897,7 +3902,7 @@ var _ = Describe("pod_models", func() {
38973902
"foundationdb.org/backup-for": string(cluster.ObjectMeta.UID),
38983903
}))
38993904
Expect(deployment.ObjectMeta.Annotations).To(Equal(map[string]string{
3900-
"foundationdb.org/last-applied-spec": "879780b88956de7a05e245cdbf16c565b95fe5c956e3a89e7ea259cd9b209d97",
3905+
"foundationdb.org/last-applied-spec": "23b6a2501f83a4cfcf760f639b1d841203ef4f44d496da072ebd1542870ad53f",
39013906
}))
39023907

39033908
Expect(
@@ -3925,7 +3930,7 @@ var _ = Describe("pod_models", func() {
39253930
).To(Equal("foundationdb/foundationdb:dev"))
39263931
Expect(
39273932
deployment.Spec.Template.Spec.InitContainers[0].Image,
3928-
).To(Equal("foundationdb/foundationdb-kubernetes-sidecar:dev-1"))
3933+
).To(Equal("foundationdb/foundationdb:dev"))
39293934
})
39303935
})
39313936

@@ -3963,37 +3968,36 @@ var _ = Describe("pod_models", func() {
39633968
})
39643969
})
39653970

3966-
When("using the unified image", func() {
3971+
When("using the split image", func() {
39673972
BeforeEach(func() {
3968-
imageType := fdbv1beta2.ImageTypeUnified
3973+
imageType := fdbv1beta2.ImageTypeSplit
39693974
backup.Spec.ImageType = &imageType
39703975
deployment, err = GetBackupDeployment(backup)
39713976
Expect(err).NotTo(HaveOccurred())
39723977
Expect(deployment).NotTo(BeNil())
39733978
})
39743979

3975-
It("should use the unified image as main and init container", func() {
3976-
Expect(deployment.Spec.Template.Spec.InitContainers).To(HaveLen(1))
3977-
Expect(deployment.Spec.Template.Spec.Containers).To(HaveLen(1))
3980+
It(
3981+
"should use the split image as main container and the sidecar image as the init container",
3982+
func() {
3983+
Expect(deployment.Spec.Template.Spec.InitContainers).To(HaveLen(1))
3984+
Expect(deployment.Spec.Template.Spec.Containers).To(HaveLen(1))
39783985

3979-
Expect(
3980-
deployment.Spec.Template.Spec.InitContainers[0].Image,
3981-
).To(HavePrefix(fdbv1beta2.FoundationDBKubernetesBaseImage))
3982-
Expect(deployment.Spec.Template.Spec.InitContainers[0].Args).To(ConsistOf(
3983-
"--copy-file",
3984-
"fdb.cluster",
3985-
"--require-not-empty",
3986-
"fdb.cluster",
3987-
"--mode",
3988-
"init",
3989-
"--output-dir",
3990-
"/var/output-files",
3991-
"--input-dir",
3992-
"/var/input-files"))
3993-
Expect(
3994-
deployment.Spec.Template.Spec.Containers[0].Image,
3995-
).To(HavePrefix(fdbv1beta2.FoundationDBKubernetesBaseImage))
3996-
})
3986+
Expect(
3987+
deployment.Spec.Template.Spec.InitContainers[0].Image,
3988+
).To(HavePrefix(fdbv1beta2.FoundationDBSidecarBaseImage))
3989+
Expect(deployment.Spec.Template.Spec.InitContainers[0].Args).To(ConsistOf(
3990+
"--copy-file",
3991+
"fdb.cluster",
3992+
"--require-not-empty",
3993+
"fdb.cluster",
3994+
"--init-mode",
3995+
))
3996+
Expect(
3997+
deployment.Spec.Template.Spec.Containers[0].Image,
3998+
).To(HavePrefix(fdbv1beta2.FoundationDBBaseImage))
3999+
},
4000+
)
39974001
})
39984002
})
39994003

0 commit comments

Comments
 (0)