Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use hardware namespace and name as provider ID #177

Merged
merged 2 commits into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion controllers/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ func (mrc *machineReconcileContext) ensureHardware() (*tinkv1.Hardware, error) {
}

mrc.tinkerbellMachine.Spec.HardwareName = hardware.Name
mrc.tinkerbellMachine.Spec.ProviderID = fmt.Sprintf("tinkerbell://%s", hardware.UID)
mrc.tinkerbellMachine.Spec.ProviderID = fmt.Sprintf("tinkerbell://%s/%s", hardware.Namespace, hardware.Name)

if err := mrc.ensureHardwareUserData(hardware, mrc.tinkerbellMachine.Spec.ProviderID); err != nil {
return nil, fmt.Errorf("ensuring Hardware user data: %w", err)
Expand Down
3 changes: 2 additions & 1 deletion controllers/tinkerbellmachine_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package controllers_test

import (
"context"
"fmt"
"testing"

"github.com/google/uuid"
Expand Down Expand Up @@ -288,7 +289,7 @@ func Test_Machine_reconciliation_with_available_hardware(t *testing.T) {
t.Parallel()
g := NewWithT(t)

g.Expect(updatedMachine.Spec.ProviderID).To(HaveSuffix(hardwareUUID),
g.Expect(updatedMachine.Spec.ProviderID).To(Equal(fmt.Sprintf("tinkerbell://%s/%s", clusterNamespace, hardwareName)),
"Expected ProviderID field to include hardwareUUID")
})

Expand Down