Skip to content
Merged
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
30 changes: 28 additions & 2 deletions server/bootserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ func RunBootServer(ipxeServerAddr string, ipxeServiceURL string, k8sClient clien
return
}

if len(ipxeBootConfigList.Items) == 0 {
err := k8sClient.List(r.Context(), ipxeBootConfigList, client.MatchingFields{bootv1alpha1.SystemUUIDIndexKey: strings.ToUpper(uuid)})
if client.IgnoreNotFound(err) != nil {
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
return
}
}

if len(ipxeBootConfigList.Items) == 0 {
log.Info("No IPXEBootConfig found with given UUID. Trying HTTPBootConfig")
handleIgnitionHTTPBoot(w, r, k8sClient, log, uuid)
Expand Down Expand Up @@ -156,7 +164,16 @@ func handleIgnitionIPXEBoot(w http.ResponseWriter, r *http.Request, k8sClient cl
if len(ipxeBootConfigList.Items) == 0 {
//Some OSes standardizes SystemUUIDs to uppercase, which may cause mismatches.
if err := k8sClient.List(ctx, ipxeBootConfigList, client.MatchingFields{bootv1alpha1.SystemUUIDIndexKey: strings.ToUpper(uuid)}); err != nil {
http.Error(w, "Resource Not Found", http.StatusNotFound)
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
log.Info("Failed to find IPXEBootConfig", "error", err.Error())
return
}
}

if len(ipxeBootConfigList.Items) == 0 {
//Some OSes standardizes SystemUUIDs to lowercase, which may cause mismatches.
if err := k8sClient.List(ctx, ipxeBootConfigList, client.MatchingFields{bootv1alpha1.SystemUUIDIndexKey: strings.ToLower(uuid)}); err != nil {
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
log.Info("Failed to find IPXEBootConfig", "error", err.Error())
return
}
Expand Down Expand Up @@ -234,7 +251,16 @@ func handleIgnitionHTTPBoot(w http.ResponseWriter, r *http.Request, k8sClient cl
if len(HTTPBootConfigList.Items) == 0 {
//Some OSes standardizes SystemUUIDs to uppercase, which may cause mismatches.
if err := k8sClient.List(ctx, HTTPBootConfigList, client.MatchingFields{bootv1alpha1.SystemUUIDIndexKey: strings.ToUpper(uuid)}); err != nil {
http.Error(w, "Resource Not Found", http.StatusNotFound)
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
log.Info("Failed to find HTTPBootConfigList", "error", err.Error())
return
}
}

if len(HTTPBootConfigList.Items) == 0 {
//Some OSes standardizes SystemUUIDs to lowecase, which may cause mismatches.
if err := k8sClient.List(ctx, HTTPBootConfigList, client.MatchingFields{bootv1alpha1.SystemUUIDIndexKey: strings.ToLower(uuid)}); err != nil {
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
log.Info("Failed to find HTTPBootConfigList", "error", err.Error())
return
}
Expand Down