Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/v1alpha1/httpbootconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ type HTTPBootConfigSpec struct {
// IgnitionSecretRef is a reference to the secret containing Ignition configuration.
IgnitionSecretRef *corev1.LocalObjectReference `json:"ignitionSecretRef,omitempty"`

// SystemIPs is a list of IP addresses assigned to the server.
SystemIPs []string `json:"systemIPs,omitempty"`
// NetworkIdentifiers is a list of IP addresses and MAC Addresses assigned to the server.
NetworkIdentifiers []string `json:"networkIdentifiers,omitempty"`

// UKIURL is the URL where the UKI (Unified Kernel Image) is hosted.
UKIURL string `json:"ukiURL,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ func main() {
os.Exit(1)
}

if err := IndexHTTPBootConfigBySystemIPs(ctx, mgr); err != nil {
setupLog.Error(err, "unable to set up indexer for HTTPBootConfig SystemIP")
if err := IndexHTTPBootConfigByNetworkIDs(ctx, mgr); err != nil {
setupLog.Error(err, "unable to set up indexer for HTTPBootConfig NetworkIdentifiers")
os.Exit(1)
}

Expand Down Expand Up @@ -350,14 +350,14 @@ func IndexHTTPBootConfigBySystemUUID(ctx context.Context, mgr ctrl.Manager) erro
)
}

func IndexHTTPBootConfigBySystemIPs(ctx context.Context, mgr ctrl.Manager) error {
func IndexHTTPBootConfigByNetworkIDs(ctx context.Context, mgr ctrl.Manager) error {
return mgr.GetFieldIndexer().IndexField(
ctx,
&bootv1alpha1.HTTPBootConfig{},
bootv1alpha1.SystemIPIndexKey,
func(Obj client.Object) []string {
HTTPBootConfig := Obj.(*bootv1alpha1.HTTPBootConfig)
return HTTPBootConfig.Spec.SystemIPs
return HTTPBootConfig.Spec.NetworkIdentifiers
},
)
}
Expand Down
5 changes: 3 additions & 2 deletions config/crd/bases/boot.ironcore.dev_httpbootconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ spec:
type: string
type: object
x-kubernetes-map-type: atomic
systemIPs:
description: SystemIPs is a list of IP addresses assigned to the server.
networkIdentifiers:
description: NetworkIdentifiers is a list of IP addresses and MAC
Addresses assigned to the server.
items:
type: string
type: array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ spec:
type: string
type: object
x-kubernetes-map-type: atomic
systemIPs:
description: SystemIPs is a list of IP addresses assigned to the server.
networkIdentifiers:
description: NetworkIdentifiers is a list of IP addresses and MAC
Addresses assigned to the server.
items:
type: string
type: array
Expand Down
8 changes: 4 additions & 4 deletions docs/api-reference/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ Kubernetes core/v1.LocalObjectReference
</tr>
<tr>
<td>
<code>systemIPs</code><br/>
<code>networkIdentifiers</code><br/>
<em>
[]string
</em>
</td>
<td>
<p>SystemIPs is a list of IP addresses assigned to the server.</p>
<p>NetworkIdentifiers is a list of IP addresses and MAC Addresses assigned to the server.</p>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -353,13 +353,13 @@ Kubernetes core/v1.LocalObjectReference
</tr>
<tr>
<td>
<code>systemIPs</code><br/>
<code>networkIdentifiers</code><br/>
<em>
[]string
</em>
</td>
<td>
<p>SystemIPs is a list of IP addresses assigned to the server.</p>
<p>NetworkIdentifiers is a list of IP addresses and MAC Addresses assigned to the server.</p>
</td>
</tr>
<tr>
Expand Down
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ require (
github.com/go-logr/logr v1.4.3
github.com/ironcore-dev/controller-utils v0.11.0
github.com/ironcore-dev/metal v0.0.0-20240624131301-18385f342755
github.com/ironcore-dev/metal-operator v0.1.1-0.20251106073609-33d5f16e0db1
github.com/onsi/ginkgo/v2 v2.27.2
github.com/ironcore-dev/metal-operator v0.1.1-0.20251209074841-4aeace82d287
github.com/onsi/ginkgo/v2 v2.27.3
github.com/onsi/gomega v1.38.3
github.com/opencontainers/image-spec v1.1.1
github.com/spf13/cobra v1.10.1
github.com/spf13/cobra v1.10.2
k8s.io/api v0.34.1
k8s.io/apimachinery v0.34.1
k8s.io/client-go v0.34.1
Expand Down Expand Up @@ -106,12 +106,12 @@ require (
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // indirect
golang.org/x/mod v0.29.0 // indirect
golang.org/x/net v0.46.0 // indirect
golang.org/x/net v0.47.0 // indirect
golang.org/x/oauth2 v0.32.0 // indirect
golang.org/x/sync v0.17.0 // indirect
golang.org/x/sys v0.37.0 // indirect
golang.org/x/term v0.36.0 // indirect
golang.org/x/text v0.30.0 // indirect
golang.org/x/sync v0.18.0 // indirect
golang.org/x/sys v0.38.0 // indirect
golang.org/x/term v0.37.0 // indirect
golang.org/x/text v0.31.0 // indirect
golang.org/x/time v0.14.0 // indirect
golang.org/x/tools v0.38.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect
Expand Down
32 changes: 16 additions & 16 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ github.com/ironcore-dev/controller-utils v0.11.0 h1:vQhZgPxxFwmSi+fSlPEuwCmI5sOP
github.com/ironcore-dev/controller-utils v0.11.0/go.mod h1:kPIgIjGNMA5zUlwH04rCdDbYnvvDtd79z3Rgav1Yrpg=
github.com/ironcore-dev/metal v0.0.0-20240624131301-18385f342755 h1:EmR3Ngg2wmOXJkxgsdYVuPXLRfwWmO2Fi+htjih6QGY=
github.com/ironcore-dev/metal v0.0.0-20240624131301-18385f342755/go.mod h1:+/bmkghOE7acqXDT/LDH57RemaUzlVwnQjttsOjdoyg=
github.com/ironcore-dev/metal-operator v0.1.1-0.20251106073609-33d5f16e0db1 h1:29bxRPvWNYGfMvAD06uS+bmfFndsAiCNtYbErEdOACc=
github.com/ironcore-dev/metal-operator v0.1.1-0.20251106073609-33d5f16e0db1/go.mod h1:v6j2+CC/3iyRmXUp7JzyGpp/2EGDTEIQGYhlcegD+as=
github.com/ironcore-dev/metal-operator v0.1.1-0.20251209074841-4aeace82d287 h1:HXGNimw582v90kYimlnsvwJvB2P7oL7fEQZHj6ckJBo=
github.com/ironcore-dev/metal-operator v0.1.1-0.20251209074841-4aeace82d287/go.mod h1:JE9ORj5pQbMIcFWJPeeRbWCMk8eZBj63QOjwbalI4qE=
github.com/joshdk/go-junit v1.0.0 h1:S86cUKIdwBHWwA6xCmFlf3RTLfVXYQfvanM5Uh+K6GE=
github.com/joshdk/go-junit v1.0.0/go.mod h1:TiiV0PqkaNfFXjEiyjWM3XXrhVyCa1K4Zfga6W52ung=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
Expand Down Expand Up @@ -174,8 +174,8 @@ github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFd
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/onsi/ginkgo/v2 v2.27.2 h1:LzwLj0b89qtIy6SSASkzlNvX6WktqurSHwkk2ipF/Ns=
github.com/onsi/ginkgo/v2 v2.27.2/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo=
github.com/onsi/ginkgo/v2 v2.27.3 h1:ICsZJ8JoYafeXFFlFAG75a7CxMsJHwgKwtO+82SE9L8=
github.com/onsi/ginkgo/v2 v2.27.3/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo=
github.com/onsi/gomega v1.38.3 h1:eTX+W6dobAYfFeGC2PV6RwXRu/MyT+cQguijutvkpSM=
github.com/onsi/gomega v1.38.3/go.mod h1:ZCU1pkQcXDO5Sl9/VVEGlDyp+zm0m1cmeG5TOzLgdh4=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
Expand All @@ -200,8 +200,8 @@ github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s=
github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0=
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
Expand Down Expand Up @@ -280,27 +280,27 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4=
golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210=
golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY=
golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I=
golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.36.0 h1:zMPR+aF8gfksFprF/Nc/rd1wRS1EI6nDBGyWAvDzx2Q=
golang.org/x/term v0.36.0/go.mod h1:Qu394IJq6V6dCBRgwqshf3mPF85AqzYEzofzRdZkWss=
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.37.0 h1:8EGAD0qCmHYZg6J17DvsMy9/wJ7/D/4pV/wfnld5lTU=
golang.org/x/term v0.37.0/go.mod h1:5pB4lxRNYYVZuTLmy8oR2BH8dflOR+IbTYFD8fi3254=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k=
golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM=
golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM=
golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM=
golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Expand Down
24 changes: 12 additions & 12 deletions internal/controller/serverbootconfiguration_http_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ func (r *ServerBootConfigurationHTTPReconciler) reconcile(ctx context.Context, l
}
log.V(1).Info("Got system UUID from Server", "systemUUID", systemUUID)

systemIPs, err := r.getSystemIPFromServer(ctx, config)
networkIdentifiers, err := r.getSystemNetworkIDsFromServer(ctx, config)
if err != nil {
return ctrl.Result{}, fmt.Errorf("failed to get system IPs from Server: %w", err)
return ctrl.Result{}, fmt.Errorf("failed to get Network Identifiers from Server: %w", err)
}
log.V(1).Info("Got system IPs from Server", "systemIPs", systemIPs)
log.V(1).Info("Got Network Identifiers from Server", "networkIdentifiers", networkIdentifiers)

ukiURL, err := r.constructUKIURL(ctx, config.Spec.Image)
if err != nil {
Expand All @@ -102,9 +102,9 @@ func (r *ServerBootConfigurationHTTPReconciler) reconcile(ctx context.Context, l
Name: config.Name,
},
Spec: bootv1alpha1.HTTPBootConfigSpec{
SystemUUID: systemUUID,
SystemIPs: systemIPs,
UKIURL: ukiURL,
SystemUUID: systemUUID,
NetworkIdentifiers: networkIdentifiers,
UKIURL: ukiURL,
},
}
if config.Spec.IgnitionSecretRef != nil {
Expand Down Expand Up @@ -166,20 +166,20 @@ func (r *ServerBootConfigurationHTTPReconciler) getSystemUUIDFromServer(ctx cont
return server.Spec.UUID, nil
}

// getSystemIPFromServer fetches the IPs from the network interfaces of the referenced Server object.
func (r *ServerBootConfigurationHTTPReconciler) getSystemIPFromServer(ctx context.Context, config *metalv1alpha1.ServerBootConfiguration) ([]string, error) {
// getSystemNetworkIDsFromServer fetches the IPs from the network interfaces of the referenced Server object.
func (r *ServerBootConfigurationHTTPReconciler) getSystemNetworkIDsFromServer(ctx context.Context, config *metalv1alpha1.ServerBootConfiguration) ([]string, error) {
server := &metalv1alpha1.Server{}
if err := r.Get(ctx, client.ObjectKey{Name: config.Spec.ServerRef.Name}, server); err != nil {
return nil, fmt.Errorf("failed to get Server: %w", err)
}

systemIPs := make([]string, 0, 2*len(server.Status.NetworkInterfaces))
nIDs := make([]string, 0, 2*len(server.Status.NetworkInterfaces))

for _, nic := range server.Status.NetworkInterfaces {
systemIPs = append(systemIPs, nic.IP.String())
systemIPs = append(systemIPs, nic.MACAddress)
nIDs = append(nIDs, nic.IP.String())
nIDs = append(nIDs, nic.MACAddress)
}
return systemIPs, nil
return nIDs, nil
}

func (r *ServerBootConfigurationHTTPReconciler) constructUKIURL(ctx context.Context, image string) (string, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var _ = Describe("ServerBootConfiguration Controller", func() {
server.Status.NetworkInterfaces = []metalv1alpha1.NetworkInterface{
{
Name: "foo",
IP: metalv1alpha1.MustParseIP("1.1.1.1"),
IP: ptr.To(metalv1alpha1.MustParseIP("1.1.1.1")),
MACAddress: "abcd",
},
}
Expand Down Expand Up @@ -88,7 +88,7 @@ var _ = Describe("ServerBootConfiguration Controller", func() {
BlockOwnerDeletion: ptr.To(true),
})),
HaveField("Spec.SystemUUID", server.Spec.UUID),
HaveField("Spec.SystemIPs", ContainElement("1.1.1.1")),
HaveField("Spec.NetworkIdentifiers", ContainElement("1.1.1.1")),
HaveField("Spec.IgnitionSecretRef.Name", "foo"),
))
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var _ = Describe("ServerBootConfiguration Controller", func() {
server.Status.NetworkInterfaces = []metalv1alpha1.NetworkInterface{
{
Name: "foo",
IP: metalv1alpha1.MustParseIP("1.1.1.1"),
IP: ptr.To(metalv1alpha1.MustParseIP("1.1.1.1")),
MACAddress: "abcd",
},
}
Expand Down Expand Up @@ -109,7 +109,7 @@ var _ = Describe("ServerBootConfiguration Controller", func() {
server.Status.NetworkInterfaces = []metalv1alpha1.NetworkInterface{
{
Name: "foo",
IP: metalv1alpha1.MustParseIP("1.1.1.1"),
IP: ptr.To(metalv1alpha1.MustParseIP("1.1.1.1")),
MACAddress: "abcd",
},
}
Expand Down
Loading