Skip to content

Commit a3e31a0

Browse files
dependabot[bot]cprivitere
authored andcommitted
feat: Add Equinix Metal Load Balancer support
- Add internal package for interacting with Equinix Metal Load Balancer API - packetcluster_controller creates load balancer and listener port and stores their ids in packetCluster annotations. - packetmachine_controller creates an origin pool and origin port for each machine and stores their IDs in the packetMachine annotations. - CPEMLBConfig and EMLBID added to the packet cloud client package to be able to provide a config for the CPEM loadBalancer setting in the emlb templates. - Memory request for the Cluster API Provider Packet controller increased to 300Mi to avoid OOMing while debugging. - EMLB added as a valid VIPManager enum type. Signed-off-by: Chris Privitere <23177737+cprivitere@users.noreply.github.com>
1 parent be9da2d commit a3e31a0

File tree

52 files changed

+10525
-183
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+10525
-183
lines changed

.golangci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ linters-settings:
164164
alias: infraexpv1
165165
nolintlint:
166166
allow-unused: false
167-
allow-leading-space: false
168167
require-specific: true
169168
revive:
170169
rules:
@@ -314,3 +313,7 @@ issues:
314313
- gocritic
315314
text: "deferInLoop: Possible resource leak, 'defer' is called in the 'for' loop"
316315
path: _test\.go
316+
- linters:
317+
- bodyclose
318+
path: .*(internal)/emlb/emlb.go
319+
text: "response body must be closed"

api/v1beta1/packetcluster_types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const (
2626
NetworkInfrastructureReadyCondition clusterv1.ConditionType = "NetworkInfrastructureReady"
2727
)
2828

29-
// VIPManagerType describes if the VIP will be managed by CPEM or kube-vip.
29+
// VIPManagerType describes if the VIP will be managed by CPEM or kube-vip or Equinix Metal Load Balancer.
3030
type VIPManagerType string
3131

3232
// PacketClusterSpec defines the desired state of PacketCluster.
@@ -46,9 +46,9 @@ type PacketClusterSpec struct {
4646
// +optional
4747
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
4848

49-
// VIPManager represents whether this cluster uses CPEM or kube-vip to
49+
// VIPManager represents whether this cluster uses CPEM or kube-vip or Equinix Metal Load Balancer to
5050
// manage its vip for the api server IP
51-
// +kubebuilder:validation:Enum=CPEM;KUBE_VIP
51+
// +kubebuilder:validation:Enum=CPEM;KUBE_VIP;EMLB
5252
// +kubebuilder:default:=CPEM
5353
VIPManager VIPManagerType `json:"vipManager"`
5454
}

clusterctl-settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "infrastructure-packet",
33
"config": {
44
"componentsFile": "infrastructure-components.yaml",
5-
"nextVersion": "v0.6.99"
5+
"nextVersion": "v0.8.99"
66
}
77
}
88

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

Lines changed: 132 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -9,141 +9,146 @@ spec:
99
group: infrastructure.cluster.x-k8s.io
1010
names:
1111
categories:
12-
- cluster-api
12+
- cluster-api
1313
kind: PacketCluster
1414
listKind: PacketClusterList
1515
plural: packetclusters
1616
shortNames:
17-
- pcl
17+
- pcl
1818
singular: packetcluster
1919
scope: Namespaced
2020
versions:
21-
- additionalPrinterColumns:
22-
- description: Cluster to which this PacketCluster belongs
23-
jsonPath: .metadata.labels.cluster\.x-k8s\.io/cluster-name
24-
name: Cluster
25-
type: string
26-
- description: PacketCluster ready status
27-
jsonPath: .status.ready
28-
name: Ready
29-
type: string
30-
name: v1beta1
31-
schema:
32-
openAPIV3Schema:
33-
description: PacketCluster is the Schema for the packetclusters API.
34-
properties:
35-
apiVersion:
36-
description: |-
37-
APIVersion defines the versioned schema of this representation of an object.
38-
Servers should convert recognized schemas to the latest internal value, and
39-
may reject unrecognized values.
40-
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
41-
type: string
42-
kind:
43-
description: |-
44-
Kind is a string value representing the REST resource this object represents.
45-
Servers may infer this from the endpoint the client submits requests to.
46-
Cannot be updated.
47-
In CamelCase.
48-
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
49-
type: string
50-
metadata:
51-
type: object
52-
spec:
53-
description: PacketClusterSpec defines the desired state of PacketCluster.
54-
properties:
55-
controlPlaneEndpoint:
56-
description: ControlPlaneEndpoint represents the endpoint used to
57-
communicate with the control plane.
58-
properties:
59-
host:
60-
description: The hostname on which the API server is serving.
61-
type: string
62-
port:
63-
description: The port on which the API server is serving.
64-
format: int32
65-
type: integer
66-
required:
67-
- host
68-
- port
69-
type: object
70-
facility:
71-
description: Facility represents the Packet facility for this cluster
72-
type: string
73-
metro:
74-
description: Metro represents the Packet metro for this cluster
75-
type: string
76-
projectID:
77-
description: ProjectID represents the Packet Project where this cluster
78-
will be placed into
79-
type: string
80-
vipManager:
81-
default: CPEM
82-
description: |-
83-
VIPManager represents whether this cluster uses CPEM or kube-vip to
84-
manage its vip for the api server IP
85-
enum:
86-
- CPEM
87-
- KUBE_VIP
88-
type: string
89-
required:
90-
- projectID
91-
- vipManager
92-
type: object
93-
status:
94-
description: PacketClusterStatus defines the observed state of PacketCluster.
95-
properties:
96-
conditions:
97-
description: Conditions defines current service state of the PacketCluster.
98-
items:
99-
description: Condition defines an observation of a Cluster API resource
100-
operational state.
21+
- additionalPrinterColumns:
22+
- description: Cluster to which this PacketCluster belongs
23+
jsonPath: .metadata.labels.cluster\.x-k8s\.io/cluster-name
24+
name: Cluster
25+
type: string
26+
- description: PacketCluster ready status
27+
jsonPath: .status.ready
28+
name: Ready
29+
type: string
30+
name: v1beta1
31+
schema:
32+
openAPIV3Schema:
33+
description: PacketCluster is the Schema for the packetclusters API.
34+
properties:
35+
apiVersion:
36+
description: |-
37+
APIVersion defines the versioned schema of this representation of an object.
38+
Servers should convert recognized schemas to the latest internal value, and
39+
may reject unrecognized values.
40+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
41+
type: string
42+
kind:
43+
description: |-
44+
Kind is a string value representing the REST resource this object represents.
45+
Servers may infer this from the endpoint the client submits requests to.
46+
Cannot be updated.
47+
In CamelCase.
48+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
49+
type: string
50+
metadata:
51+
type: object
52+
spec:
53+
description: PacketClusterSpec defines the desired state of PacketCluster.
54+
properties:
55+
controlPlaneEndpoint:
56+
description:
57+
ControlPlaneEndpoint represents the endpoint used to
58+
communicate with the control plane.
10159
properties:
102-
lastTransitionTime:
103-
description: |-
104-
Last time the condition transitioned from one status to another.
105-
This should be when the underlying condition changed. If that is not known, then using the time when
106-
the API field changed is acceptable.
107-
format: date-time
108-
type: string
109-
message:
110-
description: |-
111-
A human readable message indicating details about the transition.
112-
This field may be empty.
113-
type: string
114-
reason:
115-
description: |-
116-
The reason for the condition's last transition in CamelCase.
117-
The specific API may choose whether or not this field is considered a guaranteed API.
118-
This field may not be empty.
119-
type: string
120-
severity:
121-
description: |-
122-
Severity provides an explicit classification of Reason code, so the users or machines can immediately
123-
understand the current situation and act accordingly.
124-
The Severity field MUST be set only when Status=False.
125-
type: string
126-
status:
127-
description: Status of the condition, one of True, False, Unknown.
128-
type: string
129-
type:
130-
description: |-
131-
Type of condition in CamelCase or in foo.example.com/CamelCase.
132-
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions
133-
can be useful (see .node.status.conditions), the ability to deconflict is important.
60+
host:
61+
description: The hostname on which the API server is serving.
13462
type: string
63+
port:
64+
description: The port on which the API server is serving.
65+
format: int32
66+
type: integer
13567
required:
136-
- lastTransitionTime
137-
- status
138-
- type
68+
- host
69+
- port
13970
type: object
140-
type: array
141-
ready:
142-
description: Ready denotes that the cluster (infrastructure) is ready.
143-
type: boolean
144-
type: object
145-
type: object
146-
served: true
147-
storage: true
148-
subresources:
149-
status: {}
71+
facility:
72+
description: Facility represents the Packet facility for this cluster
73+
type: string
74+
metro:
75+
description: Metro represents the Packet metro for this cluster
76+
type: string
77+
projectID:
78+
description:
79+
ProjectID represents the Packet Project where this cluster
80+
will be placed into
81+
type: string
82+
vipManager:
83+
default: CPEM
84+
description:
85+
VIPManager represents whether this cluster uses CPEM
86+
or kube-vip or Equinix Metal Load Balancer to manage its vip for
87+
the api server IP
88+
enum:
89+
- CPEM
90+
- KUBE_VIP
91+
- EMLB
92+
type: string
93+
required:
94+
- projectID
95+
- vipManager
96+
type: object
97+
status:
98+
description: PacketClusterStatus defines the observed state of PacketCluster.
99+
properties:
100+
conditions:
101+
description: Conditions defines current service state of the PacketCluster.
102+
items:
103+
description:
104+
Condition defines an observation of a Cluster API resource
105+
operational state.
106+
properties:
107+
lastTransitionTime:
108+
description: |-
109+
Last time the condition transitioned from one status to another.
110+
This should be when the underlying condition changed. If that is not known, then using the time when
111+
the API field changed is acceptable.
112+
format: date-time
113+
type: string
114+
message:
115+
description: |-
116+
A human readable message indicating details about the transition.
117+
This field may be empty.
118+
type: string
119+
reason:
120+
description: |-
121+
The reason for the condition's last transition in CamelCase.
122+
The specific API may choose whether or not this field is considered a guaranteed API.
123+
This field may not be empty.
124+
type: string
125+
severity:
126+
description: |-
127+
Severity provides an explicit classification of Reason code, so the users or machines can immediately
128+
understand the current situation and act accordingly.
129+
The Severity field MUST be set only when Status=False.
130+
type: string
131+
status:
132+
description: Status of the condition, one of True, False, Unknown.
133+
type: string
134+
type:
135+
description: |-
136+
Type of condition in CamelCase or in foo.example.com/CamelCase.
137+
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions
138+
can be useful (see .node.status.conditions), the ability to deconflict is important.
139+
type: string
140+
required:
141+
- lastTransitionTime
142+
- status
143+
- type
144+
type: object
145+
type: array
146+
ready:
147+
description: Ready denotes that the cluster (infrastructure) is ready.
148+
type: boolean
149+
type: object
150+
type: object
151+
served: true
152+
storage: true
153+
subresources:
154+
status: {}

config/manager/manager.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ spec:
4242
port: healthz
4343
resources:
4444
limits:
45-
memory: 200Mi
45+
memory: 300Mi
4646
requests:
4747
cpu: 100m
48-
memory: 200Mi
48+
memory: 300Mi
4949
securityContext:
5050
allowPrivilegeEscalation: false
5151
capabilities:

0 commit comments

Comments
 (0)