Skip to content

Commit

Permalink
Integrate review
Browse files Browse the repository at this point in the history
  • Loading branch information
simcod committed Oct 29, 2024
1 parent 2df7e17 commit 451813f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions cmd/metal-api/internal/metal/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,13 @@ type IngressRule struct {
type DNSServers []DNSServer

type DNSServer struct {
IP string `rethinkdb:"ip" json:"ip"`
IP string `rethinkdb:"ip" json:"ip" description:"ip address of this dns server"`
}

type NTPServers []NTPServer

type NTPServer struct {
Address string `address:"address" json:"address"`
Address string `address:"address" json:"address" description:"ip address or dns hostname of this ntp server"`
}

type Protocol string
Expand Down
10 changes: 5 additions & 5 deletions cmd/metal-api/internal/service/machine-service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1163,10 +1163,10 @@ func createMachineAllocationSpec(ds *datastore.RethinkStore, machineRequest v1.M
} else {
dnsServers = partition.DNSServers
}
for _, dnsip := range dnsServers {
_, err := netip.ParseAddr(dnsip.IP)
for _, dnsServer := range dnsServers {
_, err := netip.ParseAddr(dnsServer.IP)
if err != nil {
return nil, fmt.Errorf("IP: %s for DNS server not correct err: %w", dnsip, err)
return nil, fmt.Errorf("ip: %s for dns server not correct err: %w", dnsServer, err)
}
}

Expand All @@ -1183,11 +1183,11 @@ func createMachineAllocationSpec(ds *datastore.RethinkStore, machineRequest v1.M
if net.ParseIP(ntpserver.Address) != nil {
_, err := netip.ParseAddr(ntpserver.Address)
if err != nil {
return nil, fmt.Errorf("IP: %s for NTP server not correct err: %w", ntpserver, err)
return nil, fmt.Errorf("ip: %s for ntp server not correct err: %w", ntpserver, err)
}
} else {
if !govalidator.IsDNSName(ntpserver.Address) {
return nil, fmt.Errorf("DNS name: %s for NTP server not correct err: %w", ntpserver, err)
return nil, fmt.Errorf("dns name: %s for ntp server not correct err: %w", ntpserver, err)
}
}
}
Expand Down

0 comments on commit 451813f

Please sign in to comment.