Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions controllers/nova_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1649,10 +1649,7 @@ func (r *NovaReconciler) getKeystoneAuthURL(
h *helper.Helper,
instance *novav1.Nova,
) (string, string, error) {
// TODO(gibi): change lib-common to take the name of the KeystoneAPI as
// parameter instead of labels. Then use instance.Spec.KeystoneInstance as
// the name.
keystoneAPI, err := keystonev1.GetKeystoneAPI(ctx, h, instance.Namespace, map[string]string{})
keystoneAPI, err := keystonev1.GetKeystoneAPIByName(ctx, h, instance.Spec.KeystoneInstance, instance.Namespace)
if err != nil {
return "", "", err
}
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ require (

replace github.com/openstack-k8s-operators/nova-operator/api => ./api

replace github.com/openstack-k8s-operators/keystone-operator/api => github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20250818061624-cbdfd1f68df8 //allow-merging

// mschuppert: map to latest commit from release-4.16 tag
// must consistent within modules and service operators
replace github.com/openshift/api => github.com/openshift/api v0.0.0-20240830023148-b7d0481c9094 //allow-merging
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ github.com/openshift/api v0.0.0-20240830023148-b7d0481c9094 h1:J1wuGhVxpsHykZBa6
github.com/openshift/api v0.0.0-20240830023148-b7d0481c9094/go.mod h1:CxgbWAlvu2iQB0UmKTtRu1YfepRg1/vJ64n2DlIEVz4=
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250813063935-fdc20530dcf1 h1:77TRnwfSxNI5cn/RxMS9I+kqefMm7XRQsNknIhEE4tg=
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250813063935-fdc20530dcf1/go.mod h1:Dv8qpmBIQy3Jv/EyQnOyc0w61X8vyfxpjcIQONP5CwY=
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20250811083324-e790d63f389f h1:Ivo4YKaH26B1lQlwKcolELCRGtEbmvbfJShBTVrCdQI=
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20250811083324-e790d63f389f/go.mod h1:H5iZOohoVOmZvIZPR5ep6z+jmfrpz25axOM6IXlXzNU=
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20250818061624-cbdfd1f68df8 h1:1r3wSalcW2TY8K3X6j5cL0M9MgJDCI1nZ7tHne/Izlg=
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20250818061624-cbdfd1f68df8/go.mod h1:H5iZOohoVOmZvIZPR5ep6z+jmfrpz25axOM6IXlXzNU=
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20250730071847-837b07f8d72f h1:DW8aNjEtDFrWiZ6vWuOXwdRB4eBD0n+bA9foQkOEx6U=
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20250730071847-837b07f8d72f/go.mod h1:P+7F1wiwZUxOy4myYXFyc/uBtGATDFpk3yAllXe1Vzk=
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20250730071847-837b07f8d72f h1:nGYLHcpM7EjiSzN4bmiLZbxty9u0k0Qzvkqn+1s1TF0=
Expand Down
9 changes: 6 additions & 3 deletions test/functional/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1042,17 +1042,20 @@ func CreateNovaWithNCellsAndEnsureReady(cellNumber int, novaNames *NovaNames) {
cellTemplates[cellName] = template
}

// Create KeystoneAPI first to get the correct name
// DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace))
keystoneAPIName := keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)
DeferCleanup(keystone.DeleteKeystoneAPI, keystoneAPIName)

// Create Nova spec
spec := GetDefaultNovaSpec()
spec["cellTemplates"] = cellTemplates
spec["apiDatabaseInstance"] = novaNames.APIMariaDBDatabaseName.Name
spec["apiMessageBusInstance"] = novaNames.Cells["cell0"].TransportURLName.Name
spec["keystoneInstance"] = keystoneAPIName.Name

// Deploy Nova and simulate its dependencies
DeferCleanup(th.DeleteInstance, CreateNova(novaNames.NovaName, spec))
// DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace))
novaNames.KeystoneAPIName = keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)
DeferCleanup(keystone.DeleteKeystoneAPI, novaNames.KeystoneAPIName)

memcachedSpec := infra.GetDefaultMemcachedSpec()
DeferCleanup(infra.DeleteMemcached, infra.CreateMemcached(novaNames.NovaName.Namespace, MemcachedInstance, memcachedSpec))
Expand Down
38 changes: 30 additions & 8 deletions test/functional/nova_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -759,13 +759,17 @@ var _ = Describe("Nova controller", func() {

DeferCleanup(infra.DeleteMemcached, infra.CreateMemcached(novaNames.NovaName.Namespace, MemcachedInstance, memcachedSpec))
infra.SimulateMemcachedReady(novaNames.MemcachedNamespace)
DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace))

// Create KeystoneAPI first to get correct name
keystoneAPIName := keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)
DeferCleanup(keystone.DeleteKeystoneAPI, keystoneAPIName)

spec := GetDefaultNovaSpec()
cell0template := GetDefaultNovaCellTemplate()
cell0template["cellDatabaseInstance"] = cell0.MariaDBDatabaseName.Name
spec["cellTemplates"] = map[string]interface{}{"cell0": cell0template}
spec["apiDatabaseInstance"] = novaNames.APIMariaDBDatabaseName.Name
spec["keystoneInstance"] = keystoneAPIName.Name

DeferCleanup(th.DeleteInstance, CreateNova(novaNames.NovaName, spec))
})
Expand Down Expand Up @@ -1100,7 +1104,9 @@ var _ = Describe("Nova controller", func() {
DeferCleanup(infra.DeleteMemcached, infra.CreateMemcached(novaNames.NovaName.Namespace, MemcachedInstance, memcachedSpec))
infra.SimulateMemcachedReady(novaNames.MemcachedNamespace)

DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace))
// Create KeystoneAPI first to get the correct name
keystoneAPIName := keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)
DeferCleanup(keystone.DeleteKeystoneAPI, keystoneAPIName)

spec := GetDefaultNovaSpec()
cell0template := GetDefaultNovaCellTemplate()
Expand All @@ -1109,6 +1115,7 @@ var _ = Describe("Nova controller", func() {
spec["apiDatabaseInstance"] = novaNames.APIMariaDBDatabaseName.Name
spec["apiDatabaseAccount"] = novaNames.APIMariaDBDatabaseAccount.Name
spec["topologyRef"] = map[string]interface{}{"name": "foo"}
spec["keystoneInstance"] = keystoneAPIName.Name

DeferCleanup(th.DeleteInstance, CreateNova(novaNames.NovaName, spec))

Expand Down Expand Up @@ -1176,14 +1183,17 @@ var _ = Describe("Nova controller", func() {
// Create a global Test Topology
_, topologyRef = infra.CreateTopology(novaNames.NovaTopologies[0], topologySpec)

DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace))
// Create keystoneAPI first to get correct name
keystoneAPIName := keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)
DeferCleanup(keystone.DeleteKeystoneAPI, keystoneAPIName)

spec := GetDefaultNovaSpec()
cell0template := GetDefaultNovaCellTemplate()
cell0template["cellDatabaseInstance"] = cell0.MariaDBDatabaseName.Name
spec["cellTemplates"] = map[string]interface{}{"cell0": cell0template}
spec["apiDatabaseInstance"] = novaNames.APIMariaDBDatabaseName.Name
spec["apiDatabaseAccount"] = novaNames.APIMariaDBDatabaseAccount.Name
spec["keystoneInstance"] = keystoneAPIName.Name

// We reference the global topology and is inherited by the sub components
spec["topologyRef"] = map[string]interface{}{"name": topologyRef.Name}
Expand Down Expand Up @@ -1284,6 +1294,9 @@ var _ = Describe("Nova controller", func() {
DeferCleanup(mariadb.DeleteDBService, mariadb.CreateDBService(novaNames.APIMariaDBDatabaseName.Namespace, novaNames.APIMariaDBDatabaseName.Name, serviceSpec))
DeferCleanup(mariadb.DeleteDBService, mariadb.CreateDBService(cell0.MariaDBDatabaseName.Namespace, cell0.MariaDBDatabaseName.Name, serviceSpec))
DeferCleanup(mariadb.DeleteDBService, mariadb.CreateDBService(cell1.MariaDBDatabaseName.Namespace, cell1.MariaDBDatabaseName.Name, serviceSpec))
keystoneAPIName := keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)
keystoneAPI := keystone.GetKeystoneAPI(keystoneAPIName)
DeferCleanup(keystone.DeleteKeystoneAPI, keystoneAPIName)
// cell0
spec := GetDefaultNovaSpec()
cell0Template := GetDefaultNovaCellTemplate()
Expand Down Expand Up @@ -1313,13 +1326,11 @@ var _ = Describe("Nova controller", func() {
// We reference the global topology and is inherited by the sub components
// except cell1 that has an override
spec["topologyRef"] = map[string]interface{}{"name": topologyRefTopLevel.Name}
spec["keystoneInstance"] = keystoneAPIName.Name
DeferCleanup(th.DeleteInstance, CreateNova(novaNames.NovaName, spec))
memcachedSpec := infra.GetDefaultMemcachedSpec()
DeferCleanup(infra.DeleteMemcached, infra.CreateMemcached(novaNames.NovaName.Namespace, MemcachedInstance, memcachedSpec))
infra.SimulateMemcachedReady(novaNames.MemcachedNamespace)
keystoneAPIName := keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)
DeferCleanup(keystone.DeleteKeystoneAPI, keystoneAPIName)
keystoneAPI := keystone.GetKeystoneAPI(keystoneAPIName)
Eventually(func(g Gomega) {
g.Expect(k8sClient.Status().Update(ctx, keystoneAPI.DeepCopy())).Should(Succeed())
}, timeout, interval).Should(Succeed())
Expand Down Expand Up @@ -1449,11 +1460,16 @@ var _ = Describe("Nova controller", func() {
DeferCleanup(infra.DeleteMemcached, infra.CreateMemcached(novaNames.NovaName.Namespace, MemcachedInstance, memcachedSpec))
infra.SimulateMemcachedReady(novaNames.MemcachedNamespace)

// Create keystoneAPI first to get the correct name
keystoneAPIName := keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)
DeferCleanup(keystone.DeleteKeystoneAPI, keystoneAPIName)

DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace))

spec := GetDefaultNovaSpec()
cell0 := GetDefaultNovaCellTemplate()
spec["cellTemplates"] = map[string]interface{}{"cell0": cell0}
spec["keystoneInstance"] = keystoneAPIName.Name
// This nova is created without any container image is specified in
// the request
DeferCleanup(th.DeleteInstance, CreateNova(novaNames.NovaName, spec))
Expand Down Expand Up @@ -1533,14 +1549,17 @@ var _ = Describe("Nova controller", func() {
DeferCleanup(infra.DeleteMemcached, infra.CreateMemcached(novaNames.NovaName.Namespace, MemcachedInstance, memcachedSpec))
infra.SimulateMemcachedReady(novaNames.MemcachedNamespace)

DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace))
// Create keystoneAPI first to get the correct name
keystoneAPIName := keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)
DeferCleanup(keystone.DeleteKeystoneAPI, keystoneAPIName)

spec := GetDefaultNovaSpec()
cell0template := GetDefaultNovaCellTemplate()
cell0template["cellDatabaseInstance"] = cell0.MariaDBDatabaseName.Name
spec["cellTemplates"] = map[string]interface{}{"cell0": cell0template}
spec["apiDatabaseInstance"] = novaNames.APIMariaDBDatabaseName.Name
spec["apiDatabaseAccount"] = accountName.Name
spec["keystoneInstance"] = keystoneAPIName.Name

DeferCleanup(th.DeleteInstance, CreateNova(novaNames.NovaName, spec))

Expand Down Expand Up @@ -1637,14 +1656,17 @@ var _ = Describe("Nova controller", func() {
DeferCleanup(infra.DeleteMemcached, infra.CreateMemcached(novaNames.NovaName.Namespace, MemcachedInstance, memcachedSpec))
infra.SimulateMemcachedReady(novaNames.MemcachedNamespace)

DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace))
// Create keystoneAPI first to get the correct name
keystoneAPIName := keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)
DeferCleanup(keystone.DeleteKeystoneAPI, keystoneAPIName)

spec := GetDefaultNovaSpec()
cell0template := GetDefaultNovaCellTemplate()
cell0template["cellDatabaseInstance"] = cell0.MariaDBDatabaseName.Name
cell0template["cellDatabaseAccount"] = accountName.Name
spec["cellTemplates"] = map[string]interface{}{"cell0": cell0template}
spec["apiDatabaseInstance"] = novaNames.APIMariaDBDatabaseName.Name
spec["keystoneInstance"] = keystoneAPIName.Name

DeferCleanup(th.DeleteInstance, CreateNova(novaNames.NovaName, spec))

Expand Down
25 changes: 20 additions & 5 deletions test/functional/nova_multicell_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,20 @@ var _ = Describe("Nova multi cell", func() {
"database": "NovaCell2DatabasePassword",
}

// Create KeystoneAPI first to get the correct name
keystoneAPIName := keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)
DeferCleanup(keystone.DeleteKeystoneAPI, keystoneAPIName)

spec["cellTemplates"] = map[string]interface{}{
"cell0": cell0Template,
"cell1": cell1Template,
"cell2": cell2Template,
}
spec["apiDatabaseInstance"] = novaNames.APIMariaDBDatabaseName.Name
spec["apiMessageBusInstance"] = cell0.TransportURLName.Name
spec["keystoneInstance"] = keystoneAPIName.Name

DeferCleanup(th.DeleteInstance, CreateNova(novaNames.NovaName, spec))
DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace))
memcachedSpecCell1 := infra.GetDefaultMemcachedSpec()
memcachedNamespace := types.NamespacedName{
Name: cell1Memcached,
Expand Down Expand Up @@ -678,19 +682,23 @@ var _ = Describe("Nova multi cell", func() {
cell1Template["cellMessageBusInstance"] = cell0.TransportURLName.Name
cell1Template["hasAPIAccess"] = true

// Create KeystoneAPI first to get the correct name
keystoneAPIName := keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)
DeferCleanup(keystone.DeleteKeystoneAPI, keystoneAPIName)

spec["cellTemplates"] = map[string]interface{}{
"cell0": cell0Template,
"cell1": cell1Template,
}
spec["apiDatabaseInstance"] = novaNames.APIMariaDBDatabaseName.Name
spec["apiMessageBusInstance"] = cell0.TransportURLName.Name
spec["keystoneInstance"] = keystoneAPIName.Name

DeferCleanup(th.DeleteInstance, CreateNova(novaNames.NovaName, spec))
memcachedSpec := infra.GetDefaultMemcachedSpec()

DeferCleanup(infra.DeleteMemcached, infra.CreateMemcached(novaNames.NovaName.Namespace, MemcachedInstance, memcachedSpec))
infra.SimulateMemcachedReady(novaNames.MemcachedNamespace)
DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace))
keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName)

})
Expand Down Expand Up @@ -792,19 +800,23 @@ var _ = Describe("Nova multi cell", func() {
cell1Template["cellDatabaseAccount"] = cell1.MariaDBAccountName.Name
cell1Template["cellMessageBusInstance"] = cell1.TransportURLName.Name

// Create KeystoneAPI first to get the correct name
keystoneAPIName := keystone.CreateKeystoneAPI(novaNames.Namespace)
DeferCleanup(keystone.DeleteKeystoneAPI, keystoneAPIName)

spec["cellTemplates"] = map[string]interface{}{
"cell0": cell0Template,
"cell1": cell1Template,
}
spec["apiDatabaseInstance"] = novaNames.APIMariaDBDatabaseName.Name
spec["apiMessageBusInstance"] = cell0.TransportURLName.Name
spec["keystoneInstance"] = keystoneAPIName.Name

DeferCleanup(th.DeleteInstance, CreateNova(novaNames.NovaName, spec))
memcachedSpec := infra.GetDefaultMemcachedSpec()

DeferCleanup(infra.DeleteMemcached, infra.CreateMemcached(novaNames.NovaName.Namespace, MemcachedInstance, memcachedSpec))
infra.SimulateMemcachedReady(novaNames.MemcachedNamespace)
DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(novaNames.Namespace))
keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName)
})

Expand Down Expand Up @@ -858,19 +870,22 @@ var _ = Describe("Nova multi cell", func() {
"cell0": cell0Template,
"cell1": cell1Template,
}
// Create KeystoneAPI first to get the correct name
keystoneAPIName := keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)
DeferCleanup(keystone.DeleteKeystoneAPI, keystoneAPIName)

spec["metadataServiceTemplate"] = map[string]interface{}{
"enabled": false,
}
spec["apiDatabaseInstance"] = novaNames.APIMariaDBDatabaseName.Name
spec["apiMessageBusInstance"] = cell0.TransportURLName.Name
spec["keystoneInstance"] = keystoneAPIName.Name

DeferCleanup(th.DeleteInstance, CreateNova(novaNames.NovaName, spec))
memcachedSpec := infra.GetDefaultMemcachedSpec()

DeferCleanup(infra.DeleteMemcached, infra.CreateMemcached(novaNames.NovaName.Namespace, MemcachedInstance, memcachedSpec))
infra.SimulateMemcachedReady(novaNames.MemcachedNamespace)
keystoneAPIName := keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)
DeferCleanup(keystone.DeleteKeystoneAPI, keystoneAPIName)
keystoneAPI := keystone.GetKeystoneAPI(keystoneAPIName)
Eventually(func(g Gomega) {
g.Expect(k8sClient.Status().Update(ctx, keystoneAPI.DeepCopy())).Should(Succeed())
Expand Down
6 changes: 5 additions & 1 deletion test/functional/nova_reconfiguration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,11 @@ var _ = Describe("Nova reconfiguration", func() {
It("updates the KeystoneAuthURL of the sub components if keystone internal endpoint changes", func() {
newInternalEndpoint := "https://keystone-internal"

keystone.UpdateKeystoneAPIEndpoint(novaNames.KeystoneAPIName, "internal", newInternalEndpoint)
// Create keystoneAPI first to get the correct name
keystoneAPIName := keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)

keystone.UpdateKeystoneAPIEndpoint(keystoneAPIName, "internal", newInternalEndpoint)
DeferCleanup(keystone.DeleteKeystoneAPI, keystoneAPIName)
logger.Info("Reconfigured")

SimulateReadyOfNovaTopServices()
Expand Down