Skip to content

Commit 17e2509

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 811167b commit 17e2509

File tree

9 files changed

+83
-10
lines changed

9 files changed

+83
-10
lines changed

api/v1alpha7/zz_generated.conversion.go

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

api/v1beta1/openstackmachine_types.go

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

235235
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
236+
237+
// OpenStackServerRef is a reference to the OpenStackServer object that
238+
// is associated with this OpenStackMachine.
239+
// +optional
240+
OpenStackServerRef *corev1.TypedLocalObjectReference `json:"openStackServerRef,omitempty"`
236241
}
237242

238243
// +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

+9
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,15 @@ 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+
}
376+
368377
computeService, err := compute.NewService(scope)
369378
if err != nil {
370379
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)