Skip to content
Merged
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
2 changes: 1 addition & 1 deletion api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.21
require (
github.com/onsi/ginkgo/v2 v2.20.1
github.com/onsi/gomega v1.34.1
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250403063905-eb287d52f38d
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250414173555-d17cbc245462
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20250408123225-0d9e9b82c41b
k8s.io/api v0.29.15
k8s.io/apimachinery v0.29.15
Expand Down
4 changes: 2 additions & 2 deletions api/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
github.com/openshift/api v0.0.0-20240830023148-b7d0481c9094 h1:J1wuGhVxpsHykZBa6Beb1gQ96Ptej9AE/BvwCBiRj1E=
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.20250403063905-eb287d52f38d h1:/C+ysubV00VYrqGFhQlDeQ5tUtnhIWPwQUc8MOfCEBA=
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250403063905-eb287d52f38d/go.mod h1:IY5zp1GRhacGMvjZMUZQ0LlxWDaogIRb/4H3by1Pivk=
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250414173555-d17cbc245462 h1:hWdJM9hB/GSFjXc7E7b9L+2H4ZfCOxygceMiYXR4kKc=
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250414173555-d17cbc245462/go.mod h1:+l+sclC6YCRcLcvS3UEGKBf8xya8aExMrmHeA9tMg+k=
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20250408123225-0d9e9b82c41b h1:T+N6xOT2NP+hVp2K1xl/NV3uheVHu38CcBuW+8uOBYw=
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20250408123225-0d9e9b82c41b/go.mod h1:A9Ohw5Q90YOGhcDF4ZHkMr5RArz3phoBu9+ibbYDKG4=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
Expand Down
15 changes: 1 addition & 14 deletions controllers/funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,6 @@ type topologyHandler interface {
SetLastAppliedTopology(t *topologyv1.TopoRef)
}

// GetLastAppliedTopologyRef - Returns a TopoRef object that can be passed to the
// Handle topology logic
func GetLastAppliedTopologyRef(t topologyHandler, ns string) *topologyv1.TopoRef {
lastAppliedTopologyName := ""
if l := t.GetLastAppliedTopology(); l != nil {
lastAppliedTopologyName = l.Name
}
return &topologyv1.TopoRef{
Name: lastAppliedTopologyName,
Namespace: ns,
}
}

func ensureTopology(
ctx context.Context,
helper *helper.Helper,
Expand All @@ -114,7 +101,7 @@ func ensureTopology(
ctx,
helper,
instance.GetSpecTopologyRef(),
GetLastAppliedTopologyRef(instance, helper.GetBefore().GetNamespace()),
instance.GetLastAppliedTopology(),
finalizer,
defaultLabelSelector,
)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/onsi/ginkgo/v2 v2.20.1
github.com/onsi/gomega v1.34.1
github.com/openshift/api v3.9.0+incompatible
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250403063905-eb287d52f38d
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250414173555-d17cbc245462
github.com/openstack-k8s-operators/ironic-operator/api v0.0.0-00010101000000-000000000000
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20250406092234-10f5f7e5b5a9
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20250408123225-0d9e9b82c41b
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
github.com/openshift/api v0.0.0-20240830023148-b7d0481c9094 h1:J1wuGhVxpsHykZBa6Beb1gQ96Ptej9AE/BvwCBiRj1E=
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.20250403063905-eb287d52f38d h1:/C+ysubV00VYrqGFhQlDeQ5tUtnhIWPwQUc8MOfCEBA=
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250403063905-eb287d52f38d/go.mod h1:IY5zp1GRhacGMvjZMUZQ0LlxWDaogIRb/4H3by1Pivk=
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250414173555-d17cbc245462 h1:hWdJM9hB/GSFjXc7E7b9L+2H4ZfCOxygceMiYXR4kKc=
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250414173555-d17cbc245462/go.mod h1:+l+sclC6YCRcLcvS3UEGKBf8xya8aExMrmHeA9tMg+k=
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20250406092234-10f5f7e5b5a9 h1:Q1yMkuwIOCtGQJDsKYAbspJU5b6emRvoKw5VyPXfiak=
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20250406092234-10f5f7e5b5a9/go.mod h1:klMsoleakNm0dfNR9ePkL5pNZQsIyx4WMLaHDKIkTt4=
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20250408123225-0d9e9b82c41b h1:T+N6xOT2NP+hVp2K1xl/NV3uheVHu38CcBuW+8uOBYw=
Expand Down
24 changes: 0 additions & 24 deletions tests/functional/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (

. "github.com/onsi/gomega" //revive:disable:dot-imports

topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1"
ironicv1 "github.com/openstack-k8s-operators/ironic-operator/api/v1beta1"
ironic_pkg "github.com/openstack-k8s-operators/ironic-operator/pkg/ironic"
ironic_inspector_pkg "github.com/openstack-k8s-operators/ironic-operator/pkg/ironicinspector"
Expand Down Expand Up @@ -691,26 +690,3 @@ func GetSampleTopologySpec(label string) (map[string]interface{}, []corev1.Topol
}
return topologySpec, topologySpecObj
}

// CreateTopology - Creates a Topology CR based on the spec passed as input
func CreateTopology(topology types.NamespacedName, spec map[string]interface{}) client.Object {
raw := map[string]interface{}{
"apiVersion": "topology.openstack.org/v1beta1",
"kind": "Topology",
"metadata": map[string]interface{}{
"name": topology.Name,
"namespace": topology.Namespace,
},
"spec": spec,
}
return th.CreateUnstructured(raw)
}

// GetTopology - Returns the referenced Topology
func GetTopology(name types.NamespacedName) *topologyv1.Topology {
instance := &topologyv1.Topology{}
Eventually(func(g Gomega) {
g.Expect(k8sClient.Get(ctx, name, instance)).Should(Succeed())
}, timeout, interval).Should(Succeed())
return instance
}
16 changes: 8 additions & 8 deletions tests/functional/ironic_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ var _ = Describe("Ironic controller", func() {
for _, t := range ironicNames.IronicTopologies {
// Build the topology Spec
topologySpec, _ := GetSampleTopologySpec(t.Name)
CreateTopology(t, topologySpec)
infra.CreateTopology(t, topologySpec)
}
DeferCleanup(
k8sClient.Delete,
Expand Down Expand Up @@ -756,7 +756,7 @@ var _ = Describe("Ironic controller", func() {

It("sets topology in CR status", func() {
Eventually(func(g Gomega) {
tp := GetTopology(types.NamespacedName{
tp := infra.GetTopology(types.NamespacedName{
Name: topologyRef.Name,
Namespace: topologyRef.Namespace,
})
Expand Down Expand Up @@ -814,7 +814,7 @@ var _ = Describe("Ironic controller", func() {
}, timeout, interval).Should(Succeed())

Eventually(func(g Gomega) {
tp := GetTopology(types.NamespacedName{
tp := infra.GetTopology(types.NamespacedName{
Name: expectedTopology.Name,
Namespace: expectedTopology.Namespace,
})
Expand All @@ -841,7 +841,7 @@ var _ = Describe("Ironic controller", func() {

// Get the previous topology and verify there are no finalizers
// anymore
tp = GetTopology(types.NamespacedName{
tp = infra.GetTopology(types.NamespacedName{
Name: topologyRef.Name,
Namespace: topologyRef.Namespace,
})
Expand Down Expand Up @@ -871,7 +871,7 @@ var _ = Describe("Ironic controller", func() {
Name: ironicNames.IronicTopologies[1].Name,
Namespace: ironicNames.IronicTopologies[1].Namespace,
}
tp := GetTopology(types.NamespacedName{
tp := infra.GetTopology(types.NamespacedName{
Name: expectedTopology.Name,
Namespace: expectedTopology.Namespace,
})
Expand All @@ -889,7 +889,7 @@ var _ = Describe("Ironic controller", func() {
Name: ironicNames.IronicTopologies[2].Name,
Namespace: ironicNames.IronicTopologies[2].Namespace,
}
tp := GetTopology(types.NamespacedName{
tp := infra.GetTopology(types.NamespacedName{
Name: expectedTopology.Name,
Namespace: expectedTopology.Namespace,
})
Expand All @@ -907,7 +907,7 @@ var _ = Describe("Ironic controller", func() {
Name: ironicNames.IronicTopologies[3].Name,
Namespace: ironicNames.IronicTopologies[3].Namespace,
}
tp := GetTopology(types.NamespacedName{
tp := infra.GetTopology(types.NamespacedName{
Name: expectedTopology.Name,
Namespace: expectedTopology.Namespace,
})
Expand Down Expand Up @@ -951,7 +951,7 @@ var _ = Describe("Ironic controller", func() {
Eventually(func(g Gomega) {
for _, topology := range ironicNames.IronicTopologies {
// Get the current topology and verify there are no finalizers
tp := GetTopology(types.NamespacedName{
tp := infra.GetTopology(types.NamespacedName{
Name: topology.Name,
Namespace: topology.Namespace,
})
Expand Down