Skip to content

Commit

Permalink
Validate mac address on Hardware spec: (#628)
Browse files Browse the repository at this point in the history
## Description


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.

## Why is this needed



Fixes: #

## How Has This Been Tested?





## How are existing users impacted? What migration steps/scripts do we need?





## Checklist:

I have:

- [ ] updated the documentation and/or roadmap (if required)
- [ ] added unit or e2e tests
- [ ] provided instructions on how to upgrade
  • Loading branch information
mergify[bot] authored Jun 14, 2022
2 parents 9039877 + 733e536 commit bd1c1c0
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 bd1c1c0

Please sign in to comment.