Skip to content

Commit

Permalink
Validate mac address on Hardware spec:
Browse files Browse the repository at this point in the history
This only allows lower case mac addresses.
This simplifies matching/looking up mac addresses.
Without this values could be upper case or mixed case.
Upper case and mixed cases will cause clients to miss
lookups if using the wrong case. This standardized to lowercase
to remove this error prone interaction.

Signed-off-by: Jacob Weinstock <[email protected]>
  • Loading branch information
jacobweinstock committed Jun 14, 2022
1 parent 9039877 commit 733e536
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/crd/bases/tinkerbell.org_hardware.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ spec:
format: int64
type: integer
mac:
pattern: ([0-9a-f]{2}[:]){5}([0-9a-f]{2})
type: string
name_servers:
items:
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/core/v1alpha1/hardware_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ type OSIE struct {

// DHCP configuration.
type DHCP struct {
// +kubebuilder:validation:Pattern="([0-9a-f]{2}[:]){5}([0-9a-f]{2})"
MAC string `json:"mac,omitempty"`
Hostname string `json:"hostname,omitempty"`
LeaseTime int64 `json:"lease_time,omitempty"`
Expand Down

0 comments on commit 733e536

Please sign in to comment.