Skip to content

Commit

Permalink
Propagate DB purge parameters to conductor
Browse files Browse the repository at this point in the history
Implements: OSPRH-104
  • Loading branch information
gibizer committed Feb 25, 2024
1 parent 159d3e3 commit 582713e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions api/v1beta1/novaconductor_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ func NewNovaConductorSpec(
ServiceAccount: novaCell.ServiceAccount,
TLS: novaCell.TLS,
PreserveJobs: novaCell.PreserveJobs,
DBPurge: novaCell.DBPurge,
}
return conductorSpec
}
Expand Down
1 change: 1 addition & 0 deletions controllers/nova_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,7 @@ func (r *NovaReconciler) ensureCell(
// and the conductor in the cell always the same as the NovaAPI
TLS: instance.Spec.APIServiceTemplate.TLS.Ca,
PreserveJobs: instance.Spec.PreserveJobs,
DBPurge: cellTemplate.DBPurge,
}
if cellTemplate.HasAPIAccess {
cellSpec.APIDatabaseHostname = apiDB.GetDatabaseHostname()
Expand Down
3 changes: 3 additions & 0 deletions test/functional/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ func CreateNovaWithCell0(name types.NamespacedName) client.Object {
"cell0": map[string]interface{}{
"cellDatabaseUser": "nova_cell0",
"hasAPIAccess": true,
"dbPurge": map[string]interface{}{
"schedule": "1 0 * * *",
},
},
},
"apiMessageBusInstance": cell0.TransportURLName.Name,
Expand Down
6 changes: 3 additions & 3 deletions test/functional/nova_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ var _ = Describe("Nova controller", func() {
It("defaults Spec fields", func() {
nova := GetNova(novaNames.NovaName)
cell0Template := nova.Spec.CellTemplates["cell0"]
Expect(cell0Template.DBPurge.Schedule).To(Equal(ptr.To("0 0 * * *")))
Expect(cell0Template.DBPurge.Schedule).To(Equal(ptr.To("1 0 * * *")))
Expect(cell0Template.DBPurge.ArchiveAge).To(Equal(ptr.To(30)))
Expect(cell0Template.DBPurge.PurgeAge).To(Equal(ptr.To(90)))
})
Expand Down Expand Up @@ -232,14 +232,14 @@ var _ = Describe("Nova controller", func() {
cell := GetNovaCell(cell0.CellCRName)
Expect(cell.Spec.ServiceUser).To(Equal("nova"))
Expect(cell.Spec.ServiceAccount).To(Equal(novaNames.ServiceAccountName.Name))
Expect(cell.Spec.DBPurge.Schedule).To(Equal(ptr.To("0 0 * * *")))
Expect(cell.Spec.DBPurge.Schedule).To(Equal(ptr.To("1 0 * * *")))
Expect(cell.Spec.DBPurge.ArchiveAge).To(Equal(ptr.To(30)))
Expect(cell.Spec.DBPurge.PurgeAge).To(Equal(ptr.To(90)))

conductor := GetNovaConductor(cell0.ConductorName)
Expect(conductor.Spec.ServiceUser).To(Equal("nova"))
Expect(conductor.Spec.ServiceAccount).To(Equal(novaNames.ServiceAccountName.Name))
Expect(conductor.Spec.DBPurge.Schedule).To(Equal(ptr.To("0 0 * * *")))
Expect(conductor.Spec.DBPurge.Schedule).To(Equal(ptr.To("1 0 * * *")))
Expect(conductor.Spec.DBPurge.ArchiveAge).To(Equal(ptr.To(30)))
Expect(conductor.Spec.DBPurge.PurgeAge).To(Equal(ptr.To(90)))

Expand Down

0 comments on commit 582713e

Please sign in to comment.