Skip to content

Commit caddded

Browse files
committed
Update LastAppliedTopology to TopologyRef interface
This patch aligns "LastAppliedTopology" to "TopologyRef" interface. While TopologyRef is able to reference Name and namespace, we currently only save TopologyRef.Name to .Status.LastAppliedTopology. This patch aligns both interfaces to use the same type in the same form. In addition, some logic is moved to infra-operator because is common to all operators, and this patch also adopts this new form. Signed-off-by: Francesco Pantano <[email protected]>
1 parent 71f2e3b commit caddded

File tree

43 files changed

+492
-344
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+492
-344
lines changed

api/bases/designate.openstack.org_designateapis.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,19 @@ spec:
479479
type: object
480480
lastAppliedTopology:
481481
description: LastAppliedTopology - the last applied Topology
482-
type: string
482+
properties:
483+
name:
484+
description: Name - The Topology CR name that the Service references
485+
type: string
486+
namespace:
487+
description: |-
488+
Namespace - The Namespace to fetch the Topology CR referenced
489+
NOTE: Namespace currently points by default to the same namespace where
490+
the Service is deployed. Customizing the namespace is not supported and
491+
webhooks prevent editing this field to a value different from the
492+
current project
493+
type: string
494+
type: object
483495
networkAttachments:
484496
additionalProperties:
485497
items:

api/bases/designate.openstack.org_designatebackendbind9s.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,19 @@ spec:
451451
type: object
452452
lastAppliedTopology:
453453
description: LastAppliedTopology - the last applied Topology
454-
type: string
454+
properties:
455+
name:
456+
description: Name - The Topology CR name that the Service references
457+
type: string
458+
namespace:
459+
description: |-
460+
Namespace - The Namespace to fetch the Topology CR referenced
461+
NOTE: Namespace currently points by default to the same namespace where
462+
the Service is deployed. Customizing the namespace is not supported and
463+
webhooks prevent editing this field to a value different from the
464+
current project
465+
type: string
466+
type: object
455467
networkAttachments:
456468
additionalProperties:
457469
items:

api/bases/designate.openstack.org_designatecentrals.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,19 @@ spec:
295295
type: object
296296
lastAppliedTopology:
297297
description: LastAppliedTopology - the last applied Topology
298-
type: string
298+
properties:
299+
name:
300+
description: Name - The Topology CR name that the Service references
301+
type: string
302+
namespace:
303+
description: |-
304+
Namespace - The Namespace to fetch the Topology CR referenced
305+
NOTE: Namespace currently points by default to the same namespace where
306+
the Service is deployed. Customizing the namespace is not supported and
307+
webhooks prevent editing this field to a value different from the
308+
current project
309+
type: string
310+
type: object
299311
networkAttachments:
300312
additionalProperties:
301313
items:

api/bases/designate.openstack.org_designatemdnses.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,19 @@ spec:
457457
type: object
458458
lastAppliedTopology:
459459
description: LastAppliedTopology - the last applied Topology
460-
type: string
460+
properties:
461+
name:
462+
description: Name - The Topology CR name that the Service references
463+
type: string
464+
namespace:
465+
description: |-
466+
Namespace - The Namespace to fetch the Topology CR referenced
467+
NOTE: Namespace currently points by default to the same namespace where
468+
the Service is deployed. Customizing the namespace is not supported and
469+
webhooks prevent editing this field to a value different from the
470+
current project
471+
type: string
472+
type: object
461473
networkAttachments:
462474
additionalProperties:
463475
items:

api/bases/designate.openstack.org_designateproducers.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,19 @@ spec:
294294
type: object
295295
lastAppliedTopology:
296296
description: LastAppliedTopology - the last applied Topology
297-
type: string
297+
properties:
298+
name:
299+
description: Name - The Topology CR name that the Service references
300+
type: string
301+
namespace:
302+
description: |-
303+
Namespace - The Namespace to fetch the Topology CR referenced
304+
NOTE: Namespace currently points by default to the same namespace where
305+
the Service is deployed. Customizing the namespace is not supported and
306+
webhooks prevent editing this field to a value different from the
307+
current project
308+
type: string
309+
type: object
298310
networkAttachments:
299311
additionalProperties:
300312
items:

api/bases/designate.openstack.org_designateunbounds.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,19 @@ spec:
382382
type: object
383383
lastAppliedTopology:
384384
description: LastAppliedTopology - the last applied Topology
385-
type: string
385+
properties:
386+
name:
387+
description: Name - The Topology CR name that the Service references
388+
type: string
389+
namespace:
390+
description: |-
391+
Namespace - The Namespace to fetch the Topology CR referenced
392+
NOTE: Namespace currently points by default to the same namespace where
393+
the Service is deployed. Customizing the namespace is not supported and
394+
webhooks prevent editing this field to a value different from the
395+
current project
396+
type: string
397+
type: object
386398
networkAttachments:
387399
additionalProperties:
388400
items:

api/bases/designate.openstack.org_designateworkers.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,19 @@ spec:
284284
type: object
285285
lastAppliedTopology:
286286
description: LastAppliedTopology - the last applied Topology
287-
type: string
287+
properties:
288+
name:
289+
description: Name - The Topology CR name that the Service references
290+
type: string
291+
namespace:
292+
description: |-
293+
Namespace - The Namespace to fetch the Topology CR referenced
294+
NOTE: Namespace currently points by default to the same namespace where
295+
the Service is deployed. Customizing the namespace is not supported and
296+
webhooks prevent editing this field to a value different from the
297+
current project
298+
type: string
299+
type: object
288300
networkAttachments:
289301
additionalProperties:
290302
items:

api/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require (
1414

1515
require (
1616
github.com/onsi/gomega v1.34.1
17-
github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20250213131341-8e63f078f923
17+
github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20250218115938-ae95bdfefded
1818
)
1919

2020
require (

api/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ github.com/onsi/ginkgo/v2 v2.20.1 h1:YlVIbqct+ZmnEph770q9Q7NVAz4wwIiVNahee6JyUzo
7272
github.com/onsi/ginkgo/v2 v2.20.1/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI=
7373
github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
7474
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
75-
github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20250213131341-8e63f078f923 h1:PpGup24Ri4sgw8UNyaEENy16dUHLIo8i4bpj8hLQWoU=
76-
github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20250213131341-8e63f078f923/go.mod h1:kkjcOSZ7jkHbVzxJd0nDQzjB+vqafuAMgSf7AnEXydw=
75+
github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20250218115938-ae95bdfefded h1:09SyMAXgnohPLQGKuvBeR72nxZWXLXI7309RjmYYBUU=
76+
github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20250218115938-ae95bdfefded/go.mod h1:kkjcOSZ7jkHbVzxJd0nDQzjB+vqafuAMgSf7AnEXydw=
7777
github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20250211124440-b44f6585b825 h1:46pv5xpwfU03Ik/a520eGb+hJ6ITkup7Li9S9lu0iCU=
7878
github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20250211124440-b44f6585b825/go.mod h1:56bsoJFKzVDZz/fLoouFfAZFeCW++H6R6thGhvKos1E=
7979
github.com/openstack-k8s-operators/lib-common/modules/storage v0.5.1-0.20250211124440-b44f6585b825 h1:zp77hu95TEs+V6ivfXMegQUlQJQN7cJfQE/sco6ngZM=

api/v1beta1/designateapi_types.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"github.com/openstack-k8s-operators/lib-common/modules/common/service"
2222
"github.com/openstack-k8s-operators/lib-common/modules/common/tls"
2323
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
24+
topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1"
2425
)
2526

2627
// DesignateAPITemplate defines the input parameters for the Designate API service
@@ -115,7 +116,7 @@ type DesignateAPIStatus struct {
115116
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
116117

117118
// LastAppliedTopology - the last applied Topology
118-
LastAppliedTopology string `json:"lastAppliedTopology,omitempty"`
119+
LastAppliedTopology *topologyv1.TopoRef `json:"lastAppliedTopology,omitempty"`
119120
}
120121

121122
// +kubebuilder:object:root=true
@@ -150,3 +151,18 @@ func init() {
150151
func (instance DesignateAPI) IsReady() bool {
151152
return instance.Status.ReadyCount == *(instance.Spec.Replicas)
152153
}
154+
155+
// GetSpecTopologyRef - Returns the LastAppliedTopology Set in the Status
156+
func (instance *DesignateAPI) GetSpecTopologyRef() *topologyv1.TopoRef {
157+
return instance.Spec.TopologyRef
158+
}
159+
160+
// GetLastAppliedTopology - Returns the LastAppliedTopology Set in the Status
161+
func (instance *DesignateAPI) GetLastAppliedTopology() *topologyv1.TopoRef {
162+
return instance.Status.LastAppliedTopology
163+
}
164+
165+
// SetLastAppliedTopology - Sets the LastAppliedTopology value in the Status
166+
func (instance *DesignateAPI) SetLastAppliedTopology(topologyRef *topologyv1.TopoRef) {
167+
instance.Status.LastAppliedTopology = topologyRef
168+
}

0 commit comments

Comments
 (0)