diff --git a/api/v1alpha1/machine_types.go b/api/v1alpha1/machine_types.go index a66a3ad0..67f209c9 100644 --- a/api/v1alpha1/machine_types.go +++ b/api/v1alpha1/machine_types.go @@ -124,7 +124,7 @@ const ( // +kubebuilder:printcolumn:name="Power",type=string,JSONPath=`.status.power` // +kubebuilder:printcolumn:name="LocatorLED",type=string,JSONPath=`.status.locatorLED`,priority=100 // +kubebuilder:printcolumn:name="State",type=string,JSONPath=`.status.state` -// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimeStamp` +// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` // +genclient // Machine is the Schema for the machines API diff --git a/api/v1alpha1/machineclaim_types.go b/api/v1alpha1/machineclaim_types.go index 0c007fbd..b58d8f5c 100644 --- a/api/v1alpha1/machineclaim_types.go +++ b/api/v1alpha1/machineclaim_types.go @@ -52,7 +52,7 @@ const ( // +kubebuilder:object:root=true // +kubebuilder:subresource:status // +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase` -// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimeStamp` +// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` // +genclient // MachineClaim is the Schema for the machineclaims API diff --git a/api/v1alpha1/oob_types.go b/api/v1alpha1/oob_types.go index 9fa25755..9b768638 100644 --- a/api/v1alpha1/oob_types.go +++ b/api/v1alpha1/oob_types.go @@ -121,7 +121,7 @@ const ( // +kubebuilder:printcolumn:name="SerialNumber",type=string,JSONPath=`.status.serialNumber`,priority=100 // +kubebuilder:printcolumn:name="FirmwareVersion",type=string,JSONPath=`.status.firmwareVersion`,priority=100 // +kubebuilder:printcolumn:name="State",type=string,JSONPath=`.status.state` -// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimeStamp` +// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` // +genclient // OOB is the Schema for the oobs API diff --git a/api/v1alpha1/oobsecret_types.go b/api/v1alpha1/oobsecret_types.go index 0b13a83b..a11fb80c 100644 --- a/api/v1alpha1/oobsecret_types.go +++ b/api/v1alpha1/oobsecret_types.go @@ -28,7 +28,7 @@ type OOBSecretStatus struct { // +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster // +kubebuilder:printcolumn:name="MACAddress",type=string,JSONPath=`.spec.macAddress` -// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimeStamp` +// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` // +genclient // OOBSecret is the Schema for the oobsecrets API diff --git a/internal/controller/oob_controller.go b/internal/controller/oob_controller.go index 00459c2d..e7588658 100644 --- a/internal/controller/oob_controller.go +++ b/internal/controller/oob_controller.go @@ -741,29 +741,35 @@ func (r *OOBReconciler) processCredentials(ctx context.Context, oob *metalv1alph return ctx, apply, status, nil } - oob.Spec.Protocol = &a.Protocol - oob.Spec.Flags = a.Flags - defaultCreds = a.DefaultCredentials - oob.Status.Type = a.Type - log.Debug(ctx, "Setting protocol, flags, and type") - if apply == nil { - var err error - apply, err = metalv1alpha1apply.ExtractOOB(oob, OOBFieldManager) - if err != nil { - return ctx, nil, nil, fmt.Errorf("cannot extract OOB: %w", err) + if !util.NilOrEqual(oob.Spec.Protocol, &a.Protocol) { + oob.Spec.Protocol = &a.Protocol + oob.Spec.Flags = a.Flags + defaultCreds = a.DefaultCredentials + log.Debug(ctx, "Setting protocol and flags") + if apply == nil { + var err error + apply, err = metalv1alpha1apply.ExtractOOB(oob, OOBFieldManager) + if err != nil { + return ctx, nil, nil, fmt.Errorf("cannot extract OOB: %w", err) + } } + apply = apply.WithSpec(util.Ensure(apply.Spec). + WithProtocol(metalv1alpha1apply.Protocol(). + WithName(oob.Spec.Protocol.Name). + WithPort(oob.Spec.Protocol.Port)). + WithFlags(oob.Spec.Flags)) } - apply = apply.WithSpec(util.Ensure(apply.Spec). - WithProtocol(metalv1alpha1apply.Protocol(). - WithName(oob.Spec.Protocol.Name). - WithPort(oob.Spec.Protocol.Port)). - WithFlags(oob.Spec.Flags)) - applyst, err := metalv1alpha1apply.ExtractOOBStatus(oob, OOBFieldManager) - if err != nil { - return ctx, nil, nil, fmt.Errorf("cannot extract OOB status: %w", err) + + if oob.Status.Type != a.Type { + oob.Status.Type = a.Type + log.Debug(ctx, "Setting type") + applyst, err := metalv1alpha1apply.ExtractOOBStatus(oob, OOBFieldManager) + if err != nil { + return ctx, nil, nil, fmt.Errorf("cannot extract OOB status: %w", err) + } + status = util.Ensure(applyst.Status). + WithType(a.Type) } - status = util.Ensure(applyst.Status). - WithType(a.Type) } b, err := bmc.NewBMC(string(oob.Spec.Protocol.Name), oob.Spec.Flags, host, oob.Spec.Protocol.Port, creds, expiration)