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

Commit e567596

Browse files
author
Gianluca Arbezzano
committed
Add support for single reservation ID
Fixed #133 Fixed #134 This PR adds a field to the PacketMachine in order to use a reservation ID for device creation.
1 parent 135106b commit e567596

File tree

3 files changed

+86
-0
lines changed

3 files changed

+86
-0
lines changed

config/resources/crd/bases/infrastructure.cluster.x-k8s.io_packetmachines.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ spec:
6767
items:
6868
type: string
6969
type: array
70+
hardwareReservationID:
71+
description: HardwareReservationID is the unique device hardware reservation
72+
ID or `next-available` to automatically let the Packet api determine
73+
one.
74+
type: string
7075
machineType:
7176
type: string
7277
providerID:

config/resources/crd/bases/infrastructure.cluster.x-k8s.io_packetmachinetemplates.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ spec:
5353
items:
5454
type: string
5555
type: array
56+
hardwareReservationID:
57+
description: HardwareReservationID is the unique device hardware
58+
reservation ID or `next-available` to automatically let the
59+
Packet api determine one.
60+
type: string
5661
machineType:
5762
type: string
5863
providerID:

docs/concepts/machine.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
PacketMachine is the name of the resource that identifies a
2+
[Device](packetDeviceAPI) on Packet.
3+
4+
This is an example of it:
5+
6+
```yaml
7+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3
8+
kind: PacketMachine
9+
metadata:
10+
name: "qa-master-0"
11+
spec:
12+
OS: "ubuntu_18_04"
13+
facility:
14+
- "dfw2"
15+
billingCycle: hourly
16+
machineType: "t2.small"
17+
sshKeys:
18+
- "your-sshkey-name"
19+
tags: []
20+
```
21+
22+
It is a [Kubernetes Custom Resource Definition (CRD)](crd-docs) as everything
23+
else in the cluster-api land.
24+
25+
The reported fields in the example are the most common one but you can see the
26+
full list of supported parameters as part of the OpenAPI definition available
27+
[here](config/resources/crd/bases/infrastructure.cluster.x-k8s.io_packetmachines.yaml)
28+
searching for `kind: PacketMachine`.
29+
30+
## Reserved instances
31+
32+
Packet provides the possibility to [reserve
33+
hardware](packet-docs-reserved-hardware) in order to have to power you need
34+
always available.
35+
36+
> Reserved hardware gives you the ability to reserve specific servers for a
37+
> committed period of time. Unlike hourly on-demand, once you reserve hardware,
38+
> you will have access to that specific hardware for the duration of the
39+
> reservation.
40+
41+
You can specify the reservation ID using the field `hardwareReservationID`:
42+
43+
```
44+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3
45+
kind: PacketMachine
46+
metadata:
47+
name: "qa-master-0"
48+
spec:
49+
OS: "ubuntu_18_04"
50+
facility:
51+
- "dfw2"
52+
billingCycle: hourly
53+
machineType: "t2.small"
54+
sshKeys:
55+
- "your-sshkey-name"
56+
hardwareReservationID: "d3cb029a-c5e4-4e2b-bafc-56266639685f"
57+
tags: []
58+
```
59+
60+
### pros and cons
61+
62+
Hardware reservation is a great feature, this chapter is about the feature
63+
described above and nothing more.
64+
It covers a very simple use case, you have a set of machines that you created
65+
statically in the YAML and you like to have them using a reservation ID.
66+
67+
It does not work in combination of PacketMachineTemplate and MachineDeployment
68+
where the pool of PacketMachine is dynamically managed by the cluster-api
69+
controllers. You can track progress on this scenario subscribing to the issue
70+
["Add support for reservation IDs with MachineDeployment #136"](github-issue-resid-dynamic) on GitHub.
71+
72+
[packetDeviceAPI]: https://www.packet.com/developers/api/devices/#devices-createDevice
73+
[crd-docs]: https://github.com/packethost/cluster-api-provider-packet/blob/master/config/resources/crd/bases/infrastructure.cluster.x-k8s.io_packetmachines.yaml
74+
[openapi-types]: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/
75+
[packet-docs-reserved-hardware]: https://www.packet.com/developers/docs/getting-started/deployment-options/reserved-hardware/
76+
[github-issue-resid-dynamic]: https://github.com/packethost/cluster-api-provider-packet/issues/136

0 commit comments

Comments
 (0)