Skip to content

Commit 8f9488b

Browse files
committed
always set conumerRef, so that APIVersion gets updated.
1 parent 0464a68 commit 8f9488b

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

pkg/services/baremetal/baremetal/baremetal.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -702,14 +702,11 @@ func (s *Service) setHostSpec(host *infrav1.HetznerBareMetalHost) {
702702

703703
// setReferencesOnHost will ensure the host is set to link to this HetznerBareMetalMachine.
704704
func (s *Service) setReferencesOnHost(host *infrav1.HetznerBareMetalHost) {
705-
// set consumer ref if it is nil or pointing to another HetznerBareMetalMachine
706-
if host.Spec.ConsumerRef == nil || host.Spec.ConsumerRef.Name != s.scope.BareMetalMachine.Name {
707-
host.Spec.ConsumerRef = &corev1.ObjectReference{
708-
Kind: "HetznerBareMetalMachine",
709-
Name: s.scope.BareMetalMachine.Name,
710-
Namespace: s.scope.BareMetalMachine.Namespace,
711-
APIVersion: s.scope.BareMetalMachine.APIVersion,
712-
}
705+
host.Spec.ConsumerRef = &corev1.ObjectReference{
706+
Kind: "HetznerBareMetalMachine",
707+
Name: s.scope.BareMetalMachine.Name,
708+
Namespace: s.scope.BareMetalMachine.Namespace,
709+
APIVersion: s.scope.BareMetalMachine.APIVersion,
713710
}
714711
// set owner ref
715712
host.OwnerReferences = s.setOwnerRef(host.OwnerReferences)

0 commit comments

Comments
 (0)