Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit 135106b

Browse files
jhead-slgGianluca Arbezzano
authored andcommitted
add hardware reservation id support
1 parent 9e8dafc commit 135106b

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

api/v1alpha3/packetmachine_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ type PacketMachineSpec struct {
4141
BillingCycle string `json:"billingCycle"`
4242
MachineType string `json:"machineType"`
4343
SshKeys []string `json:"sshKeys,omitempty"`
44+
45+
// HardwareReservationID is the unique device hardware reservation ID or `next-available` to
46+
// automatically let the Packet api determine one.
47+
// +optional
48+
HardwareReservationID string `json:"hardwareReservationID,omitempty"`
49+
4450
// ProviderID is the unique identifier as specified by the cloud provider.
4551
// +optional
4652
ProviderID *string `json:"providerID,omitempty"`

pkg/cloud/packet/client.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,15 @@ func (p *PacketClient) NewDevice(hostname, project string, machineScope *scope.M
8888
tags = append(tags, infrastructurev1alpha3.WorkerTag)
8989
}
9090
serverCreateOpts := &packngo.DeviceCreateRequest{
91-
Hostname: hostname,
92-
ProjectID: project,
93-
Facility: machineScope.PacketMachine.Spec.Facility,
94-
BillingCycle: machineScope.PacketMachine.Spec.BillingCycle,
95-
Plan: machineScope.PacketMachine.Spec.MachineType,
96-
OS: machineScope.PacketMachine.Spec.OS,
97-
Tags: tags,
98-
UserData: userData,
91+
Hostname: hostname,
92+
ProjectID: project,
93+
Facility: machineScope.PacketMachine.Spec.Facility,
94+
BillingCycle: machineScope.PacketMachine.Spec.BillingCycle,
95+
HardwareReservationID: machineScope.PacketMachine.Spec.HardwareReservationID,
96+
Plan: machineScope.PacketMachine.Spec.MachineType,
97+
OS: machineScope.PacketMachine.Spec.OS,
98+
Tags: tags,
99+
UserData: userData,
99100
}
100101

101102
dev, _, err := p.Client.Devices.Create(serverCreateOpts)

0 commit comments

Comments
 (0)