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

Commit cd4f7d7

Browse files
authored
Merge pull request #140 from gianarb/feature/move-facility-to-cluster
Move facility from packetmachine to packetcluster
2 parents e679fcb + 061a675 commit cd4f7d7

9 files changed

+85
-25
lines changed

api/v1alpha3/packetcluster_types.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ type PacketClusterSpec struct {
2929
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
3030
// Important: Run "make" to regenerate code after modifying this file
3131

32-
// Foo is an example field of PacketCluster. Edit PacketCluster_types.go to remove/update
32+
// ProjectID represents the Packet Project where this cluster will be placed into
3333
ProjectID string `json:"projectID"`
3434

35+
// Facility represents the Packet facility for this cluster
36+
Facility string `json:"facility,omitempty"`
37+
3538
// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
3639
// +optional
3740
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`

api/v1alpha3/packetmachine_types.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ const (
3333

3434
// PacketMachineSpec defines the desired state of PacketMachine
3535
type PacketMachineSpec struct {
36-
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
37-
// Important: Run "make" to regenerate code after modifying this file
38-
39-
Facility []string `json:"facility,omitempty"`
4036
OS string `json:"OS"`
4137
BillingCycle string `json:"billingCycle"`
4238
MachineType string `json:"machineType"`

api/v1alpha3/zz_generated.deepcopy.go

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/rbac/role.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
2+
---
3+
apiVersion: rbac.authorization.k8s.io/v1
4+
kind: ClusterRole
5+
metadata:
6+
creationTimestamp: null
7+
name: manager-role
8+
rules:
9+
- apiGroups:
10+
- ""
11+
resources:
12+
- secrets
13+
verbs:
14+
- get
15+
- list
16+
- watch
17+
- apiGroups:
18+
- cluster.x-k8s.io
19+
resources:
20+
- clusters
21+
- clusters/status
22+
verbs:
23+
- get
24+
- list
25+
- watch
26+
- apiGroups:
27+
- cluster.x-k8s.io
28+
resources:
29+
- machines
30+
- machines/status
31+
verbs:
32+
- get
33+
- list
34+
- watch
35+
- apiGroups:
36+
- infrastructure.cluster.x-k8s.io
37+
resources:
38+
- packetclusters
39+
verbs:
40+
- create
41+
- delete
42+
- get
43+
- list
44+
- patch
45+
- update
46+
- watch
47+
- apiGroups:
48+
- infrastructure.cluster.x-k8s.io
49+
resources:
50+
- packetclusters/status
51+
verbs:
52+
- get
53+
- patch
54+
- update
55+
- apiGroups:
56+
- infrastructure.cluster.x-k8s.io
57+
resources:
58+
- packetmachines
59+
verbs:
60+
- create
61+
- delete
62+
- get
63+
- list
64+
- patch
65+
- update
66+
- watch
67+
- apiGroups:
68+
- infrastructure.cluster.x-k8s.io
69+
resources:
70+
- packetmachines/status
71+
verbs:
72+
- get
73+
- patch
74+
- update

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,12 @@ spec:
5151
- host
5252
- port
5353
type: object
54+
facility:
55+
description: Facility represents the Packet facility for this cluster
56+
type: string
5457
projectID:
55-
description: Foo is an example field of PacketCluster. Edit PacketCluster_types.go
56-
to remove/update
58+
description: ProjectID represents the Packet Project where this cluster
59+
will be placed into
5760
type: string
5861
required:
5962
- projectID

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ spec:
6363
type: string
6464
billingCycle:
6565
type: string
66-
facility:
67-
items:
68-
type: string
69-
type: array
7066
hardwareReservationID:
7167
description: HardwareReservationID is the unique device hardware reservation
7268
ID or `next-available` to automatically let the Packet api determine

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ spec:
4949
type: string
5050
billingCycle:
5151
type: string
52-
facility:
53-
items:
54-
type: string
55-
type: array
5652
hardwareReservationID:
5753
description: HardwareReservationID is the unique device hardware
5854
reservation ID or `next-available` to automatically let the

pkg/cloud/packet/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func (p *PacketClient) NewDevice(hostname, project string, machineScope *scope.M
9090
serverCreateOpts := &packngo.DeviceCreateRequest{
9191
Hostname: hostname,
9292
ProjectID: project,
93-
Facility: machineScope.PacketMachine.Spec.Facility,
93+
Facility: []string{machineScope.PacketCluster.Spec.Facility},
9494
BillingCycle: machineScope.PacketMachine.Spec.BillingCycle,
9595
HardwareReservationID: machineScope.PacketMachine.Spec.HardwareReservationID,
9696
Plan: machineScope.PacketMachine.Spec.MachineType,

templates/cluster-template.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ metadata:
4949
name: "${CLUSTER_NAME}"
5050
spec:
5151
projectID: "${PROJECT_ID}"
52+
facility: "${FACILITY}"
5253
---
5354
apiVersion: cluster.x-k8s.io/v1alpha3
5455
kind: Machine
@@ -75,8 +76,6 @@ metadata:
7576
name: "${CLUSTER_NAME}-master-0"
7677
spec:
7778
OS: "${NODE_OS}"
78-
facility:
79-
- "${FACILITY}"
8079
billingCycle: hourly
8180
machineType: "${MASTER_NODE_TYPE}"
8281
sshKeys:
@@ -123,8 +122,6 @@ spec:
123122
template:
124123
spec:
125124
OS: "${NODE_OS}"
126-
facility:
127-
- "${FACILITY}"
128125
billingCycle: hourly
129126
machineType: "${WORKER_NODE_TYPE}"
130127
sshKeys:

0 commit comments

Comments
 (0)