Skip to content

Commit ed56a4a

Browse files
committed
OpenStackMachine: add OpenStackServerRef to Status
An `OpenStackMachine` object has now its `OpenStackServerRef` in Status so we can know to with `OpenStackServer` it's attached to. We will set that ref as soon as we found an existing object, whether the server is running or not yet or in error state.
1 parent d9d28af commit ed56a4a

File tree

8 files changed

+81
-10
lines changed

8 files changed

+81
-10
lines changed

api/v1beta1/openstackmachine_types.go

+5
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,11 @@ type OpenStackMachineStatus struct {
235235
FailureMessage *string `json:"failureMessage,omitempty"`
236236

237237
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
238+
239+
// OpenStackServerRef is a reference to the OpenStackServer object that
240+
// is associated with this OpenStackMachine.
241+
// +optional
242+
OpenStackServerRef *corev1.TypedLocalObjectReference `json:"openStackServerRef,omitempty"`
238243
}
239244

240245
// +genclient

api/v1beta1/zz_generated.deepcopy.go

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/models-schema/zz_generated.openapi.go

+7-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachines.yaml

+22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

controllers/openstackmachine_controller.go

+8
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,14 @@ func (r *OpenStackMachineReconciler) reconcileNormal(ctx context.Context, scope
365365
return ctrl.Result{}, err
366366
}
367367

368+
if machineServer != nil {
369+
openStackMachine.Status.OpenStackServerRef = &corev1.TypedLocalObjectReference{
370+
APIGroup: &infrav1alpha1.SchemeGroupVersion.Group,
371+
Kind: machineServer.Kind,
372+
Name: machineServer.Name,
373+
}
374+
}
375+
368376
computeService, err := compute.NewService(scope)
369377
if err != nil {
370378
return ctrl.Result{}, err

docs/book/src/api/v1beta1/api.md

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/generated/applyconfiguration/api/v1beta1/openstackmachinestatus.go

+18-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/generated/applyconfiguration/internal/internal.go

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)