Skip to content

Commit

Permalink
Use string type for VLANID:
Browse files Browse the repository at this point in the history
This allows a default value of "" to be used
instead of 0 when the VLANID type is int. As 0
is a valid vlan id, we dont want that to be the default
as it would make it impossible for the VLANID to be "unset"
and therefore not added to DHCP requests, etc.

Signed-off-by: Jacob Weinstock <[email protected]>
  • Loading branch information
jacobweinstock committed Sep 16, 2022
1 parent f83c727 commit 8effbb8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion config/crd/bases/tinkerbell.org_hardware.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ spec:
uefi:
type: boolean
vlan_id:
type: integer
description:
validation pattern for VLANDID is a string
number between 0-4096
pattern: ^(([0-9][0-9]{0,2}|[1-3][0-9][0-9][0-9]|40([0-8][0-9]|9[0-6]))(,[1-9][0-9]{0,2}|[1-3][0-9][0-9][0-9]|40([0-8][0-9]|9[0-6]))*)$
type: string
type: object
netboot:
description: Netboot configuration.
Expand Down
4 changes: 3 additions & 1 deletion pkg/apis/core/v1alpha1/hardware_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ type DHCP struct {
UEFI bool `json:"uefi,omitempty"`
IfaceName string `json:"iface_name,omitempty"`
IP *IP `json:"ip,omitempty"`
VLANID uint `json:"vlan_id,omitempty"`
// validation pattern for VLANDID is a string number between 0-4096
// +kubebuilder:validation:Pattern="^(([0-9][0-9]{0,2}|[1-3][0-9][0-9][0-9]|40([0-8][0-9]|9[0-6]))(,[1-9][0-9]{0,2}|[1-3][0-9][0-9][0-9]|40([0-8][0-9]|9[0-6]))*)$"
VLANID string `json:"vlan_id,omitempty"`
}

// IP configuration.
Expand Down

0 comments on commit 8effbb8

Please sign in to comment.