Skip to content

Commit

Permalink
OpenStackMachine: add OpenStackServerRef to Status
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
EmilienM committed Jan 28, 2025
1 parent 811167b commit 17e2509
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 10 deletions.
1 change: 1 addition & 0 deletions api/v1alpha7/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions api/v1beta1/openstackmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@ type OpenStackMachineStatus struct {
FailureMessage *string `json:"failureMessage,omitempty"`

Conditions clusterv1.Conditions `json:"conditions,omitempty"`

// OpenStackServerRef is a reference to the OpenStackServer object that
// is associated with this OpenStackMachine.
// +optional
OpenStackServerRef *corev1.TypedLocalObjectReference `json:"openStackServerRef,omitempty"`
}

// +genclient
Expand Down
5 changes: 5 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion cmd/models-schema/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions controllers/openstackmachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,15 @@ func (r *OpenStackMachineReconciler) reconcileNormal(ctx context.Context, scope
return ctrl.Result{}, err
}

if machineServer != nil {
openStackMachine.Status.OpenStackServerRef = &corev1.TypedLocalObjectReference{
APIGroup: &infrav1alpha1.SchemeGroupVersion.Group,
Kind: machineServer.Kind,
Name: machineServer.Name,
}

}

computeService, err := compute.NewService(scope)
if err != nil {
return ctrl.Result{}, err
Expand Down
13 changes: 13 additions & 0 deletions docs/book/src/api/v1beta1/api.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pkg/generated/applyconfiguration/internal/internal.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 17e2509

Please sign in to comment.