Skip to content

Commit

Permalink
Reorganize where the gating of static IPAM occurs:
Browse files Browse the repository at this point in the history
This moves the gating to the constructing of the
kernel parameters and makes it explicit to whether
ipam is included or not.

Signed-off-by: Jacob Weinstock <[email protected]>
  • Loading branch information
jacobweinstock committed Nov 23, 2024
1 parent c64185b commit b7f6251
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/iso/iso.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,18 @@ func (h *Handler) constructPatch(console, mac string, d *data.DHCP) string {
tinkerbellTLS := fmt.Sprintf("tinkerbell_tls=%v", h.TinkServerTLS)
workerID := fmt.Sprintf("worker_id=%s", mac)
vlanID := func() string {
if d != nil {
if d != nil && d.VLANID != "" {
return fmt.Sprintf("vlan_id=%s", d.VLANID)
}
return ""
}()
hwAddr := fmt.Sprintf("hw_addr=%s", mac)
ipam := parseIPAM(d)
all := []string{strings.Join(h.ExtraKernelParams, " "), console, vlanID, hwAddr, syslogHost, grpcAuthority, tinkerbellTLS, workerID}
if h.StaticIPAMEnabled {
all = append(all, parseIPAM(d))
}

return strings.Join([]string{strings.Join(h.ExtraKernelParams, " "), console, vlanID, hwAddr, syslogHost, grpcAuthority, tinkerbellTLS, workerID, ipam}, " ")
return strings.Join(all, " ")
}

func getMAC(urlPath string) (net.HardwareAddr, error) {
Expand All @@ -288,9 +291,6 @@ func (h *Handler) getFacility(ctx context.Context, mac net.HardwareAddr, br Back
if err != nil {
return "", nil, err
}
if !h.StaticIPAMEnabled {
d = nil
}

return n.Facility, d, nil
}
Expand Down

0 comments on commit b7f6251

Please sign in to comment.