Skip to content

feat(): layer2 support for CAPP #787

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

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
05cbc0c
API and CRD changes for adding layer2 support
rahulii Aug 22, 2024
15aaba7
json tag fix
rahulii Aug 22, 2024
ebfddac
change ipAddressReservation to address
rahulii Aug 29, 2024
1d2b71e
make changes to the api as per design doc changes
rahulii Sep 17, 2024
e1a19b5
minor change
rahulii Sep 17, 2024
cdf7155
api changes and user-data implementation
rahulii Sep 25, 2024
4cfb7b8
add IPAddressManagement Service
rahulii Sep 26, 2024
f762e5b
merge bootstrap and layer2 cloud configs
rahulii Oct 8, 2024
a452289
add unit test cases
rahulii Oct 8, 2024
5f33a86
ipam support
vardhaman-surana Oct 8, 2024
aad4223
added rbac
vardhaman-surana Oct 8, 2024
25510bd
minor fix
rahulii Oct 9, 2024
16fdf8d
reconcile port settings for layer2 and bonded port
rahulii Oct 10, 2024
b7e1120
minor fix
rahulii Oct 11, 2024
fcfcaac
refactor code and add static routes
rahulii Oct 11, 2024
b7e871a
bug fix
rahulii Oct 11, 2024
ddf37d9
Merge pull request #1 from rahulii/ipam
rahulii Oct 11, 2024
d901fe6
delete unused code
rahulii Oct 11, 2024
c55ea3f
minor fix
rahulii Oct 14, 2024
4c64c5d
minor fix
rahulii Oct 14, 2024
d4d4b25
change failure to failed in state
rahulii Oct 14, 2024
4d30dcc
added ipaddress claim deletion
vardhaman-surana Oct 14, 2024
4f9c8fc
Merge pull request #2 from vardhaman-surana/ipaddressclaim-deletion
rahulii Oct 14, 2024
4efbfd8
add logs
rahulii Oct 14, 2024
07516df
add routes at network file and change user-data to make them persistent
rahulii Oct 15, 2024
6207973
fix a bug where multiple vxlans are involved
rahulii Oct 16, 2024
7e68faf
update design docs
rahulii Oct 21, 2024
475365c
update design docs
rahulii Oct 22, 2024
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
26 changes: 26 additions & 0 deletions api/v1beta1/packetcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ const (
KUBEVIPID = "KUBE_VIP"
)

// AssignmentType describes the component responsible for allocating IP addresses to the machines.
type AssignmentType string

const (
AssignmentClusterAPI AssignmentType = "cluster-api"
AssignmentDHCP AssignmentType = "dhcp"
)

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

Expand All @@ -60,6 +68,24 @@ type PacketClusterSpec struct {
// +kubebuilder:validation:Enum=CPEM;KUBE_VIP;EMLB
// +kubebuilder:default:=CPEM
VIPManager VIPManagerType `json:"vipManager"`

// Networks is a list of network configurations for the PacketCluster
Networks []NetworkSpec `json:"networks,omitempty"`
}

// NetworkSpec defines the network configuration for a PacketCluster.
type NetworkSpec struct {
// Name of the network, e.g. "storage VLAN", is optional
// +optional
Name string `json:"name,omitempty"`
// Description of the network, e.g. "Storage network", is optional
// +optional
Description string `json:"description,omitempty"`
// AddressRange for the cluster network for eg: VRF IP Ranges
Addresses []string `json:"addresses,omitempty"`
// Assignment is component responsible for allocating IP addresses to the machines, either cluster-api or dhcp
// +kubebuilder:validation:Enum=cluster-api;dhcp
Assignment AssignmentType `json:"assignment,omitempty"`
}

// PacketClusterStatus defines the observed state of PacketCluster.
Expand Down
45 changes: 45 additions & 0 deletions api/v1beta1/packetmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,51 @@ type PacketMachineSpec struct {
// Tags is an optional set of tags to add to Packet resources managed by the Packet provider.
// +optional
Tags Tags `json:"tags,omitempty"`

// NetworkPorts is an optional set of configurations for configuring layer2 seetings in a machine.
// +optional
NetworkPorts []*Port `json:"ports,omitempty"`
// List of Routes to be configured on the Packet Machine
// +optional
Routes []*RouteSpec `json:"routes,omitempty"`
}
// Port defines the Layer2(VLAN) Configuration that needs to be done on a port (eg: bond0).
type Port struct {
// name of the port e.g bond0,eth0 and eth1 for 2 NIC servers.
Name string `json:"name"`
// port bonded or not.
Bonded bool `json:"bonded,omitempty"`
// convert port to layer 2. is false by default on new devices. changes result in /ports/id/convert/layer-[2|3] API calls
Layer2 bool `json:"layer2,omitempty"`
// Network configurations for the port
Networks []Network `json:"networks"`
}

// Network defines the network configuration for a port.
type Network struct {
// network ip address range to reserve for these ports.
// for eg: can be carved out of a VRF IP Range.
Address string `json:"address"`
// VLANs for EM API to find by vxlan, project, and metro match then attach to device. OS userdata template will also configure this VLAN on the bond device
VXLAN int `json:"vxlan,omitempty"`
// AssignmentRange is the range of IP addresses to assign to the machine from the specified IP address range.
// for eg: if the IP address range is 10.60.10.0/24 , the assignment range can be '10.60.10.2-10.60.10.8'
// If not specified, the first available IP address from the IP address range will be assigned.
// This is useful when you want to reserve some IP addresses for other purposes for eg Gateways, DNS etc.
// +optional
AssignmentRange string `json:"assignmentRange,omitempty"`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you specify the expected format here ? Also add a validation if the format in valid.

Also can a user configure multiple address ranges as below ?
e.g. 10.60.10.2-10.60.10.9, 10.60.10.11-10.60.10.20

// Netmask is the netmask for the network.
// eg: 255.255.255.248
Netmask string `json:"netmask,omitempty"`
// AddressType is the type of address to assign to the machine. It can be either Internal or External.
// kubebuilder:validation:Enum=Internal;External
AddressType string `json:"addressType,omitempty"`
}

// RouteSpec defines the static route configuration for a PacketMachine.
type RouteSpec struct {
Destination string `json:"destination"`
Gateway string `json:"gateway"`
}

// PacketMachineStatus defines the observed state of PacketMachine.
Expand Down
101 changes: 100 additions & 1 deletion api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,35 @@ spec:
metro:
description: Metro represents the Packet metro for this cluster
type: string
networks:
description: Networks is a list of network configurations for the
PacketCluster
items:
description: NetworkSpec defines the network configuration for a
PacketCluster.
properties:
addresses:
description: 'AddressRange for the cluster network for eg: VRF
IP Ranges'
items:
type: string
type: array
assignment:
description: Assignment is component responsible for allocating
IP addresses to the machines, either cluster-api or dhcp
enum:
- cluster-api
- dhcp
type: string
description:
description: Description of the network, e.g. "Storage network",
is optional
type: string
name:
description: Name of the network, e.g. "storage VLAN", is optional
type: string
type: object
type: array
projectID:
description: ProjectID represents the Packet Project where this cluster
will be placed into
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,86 @@ spec:
type: string
os:
type: string
ports:
description: NetworkPorts is an optional set of configurations for
configuring layer2 seetings in a machine.
items:
description: 'Port defines the Layer2(VLAN) Configuration that needs
to be done on a port (eg: bond0).'
properties:
bonded:
description: port bonded or not.
type: boolean
layer2:
description: convert port to layer 2. is false by default on
new devices. changes result in /ports/id/convert/layer-[2|3]
API calls
type: boolean
name:
description: name of the port e.g bond0,eth0 and eth1 for 2
NIC servers.
type: string
networks:
description: Network configurations for the port
items:
description: Network defines the network configuration for
a port.
properties:
address:
description: |-
network ip address range to reserve for these ports.
for eg: can be carved out of a VRF IP Range.
type: string
addressType:
description: |-
AddressType is the type of address to assign to the machine. It can be either Internal or External.
kubebuilder:validation:Enum=Internal;External
type: string
assignmentRange:
description: |-
AssignmentRange is the range of IP addresses to assign to the machine from the specified IP address range.
for eg: if the IP address range is 10.60.10.0/24 , the assignment range can be '10.60.10.2-10.60.10.8'
If not specified, the first available IP address from the IP address range will be assigned.
This is useful when you want to reserve some IP addresses for other purposes for eg Gateways, DNS etc.
type: string
netmask:
description: |-
Netmask is the netmask for the network.
eg: 255.255.255.248
type: string
vxlan:
description: VLANs for EM API to find by vxlan, project,
and metro match then attach to device. OS userdata template
will also configure this VLAN on the bond device
type: integer
required:
- address
type: object
type: array
required:
- name
- networks
type: object
type: array
providerID:
description: ProviderID is the unique identifier as specified by the
cloud provider.
type: string
routes:
description: List of Routes to be configured on the Packet Machine
items:
description: RouteSpec defines the static route configuration for
a PacketMachine.
properties:
destination:
type: string
gateway:
type: string
required:
- destination
- gateway
type: object
type: array
sshKeys:
items:
type: string
Expand Down
Loading