@@ -85,7 +85,9 @@ func handleIPXE(w http.ResponseWriter, r *http.Request, k8sClient client.Client,
8585
8686 uuid := strings .TrimPrefix (r .URL .Path , "/ipxe/" )
8787 if uuid == "" {
88- http .Error (w , "Bad Request: UUID is required" , http .StatusBadRequest )
88+ serveDefaultIPXEChainTemplate (w , log , IPXETemplateData {
89+ IPXEServerURL : ipxeServiceURL ,
90+ })
8991 return
9092 }
9193
@@ -221,6 +223,21 @@ func serveDefaultIPXETemplate(w http.ResponseWriter, log logr.Logger, data IPXET
221223 }
222224}
223225
226+ func serveDefaultIPXEChainTemplate (w http.ResponseWriter , log logr.Logger , data IPXETemplateData ) {
227+ tmplPath := filepath .Join ("templates" , "ipxe-chainload.tpl" )
228+ tmpl , err := template .ParseFiles (tmplPath )
229+ if err != nil {
230+ log .Info ("Failed to parse iPXE Chainload template" , "error" , err )
231+ http .Error (w , "Internal Server Error" , http .StatusInternalServerError )
232+ return
233+ }
234+
235+ if err := tmpl .Execute (w , data ); err != nil {
236+ log .Info ("Failed to execute iPXE Chainload template" , "error" , err )
237+ http .Error (w , "Internal Server Error" , http .StatusInternalServerError )
238+ }
239+ }
240+
224241func handleIgnitionHTTPBoot (w http.ResponseWriter , r * http.Request , k8sClient client.Client , log logr.Logger , uuid string ) {
225242 log .Info ("Processing Ignition request" , "method" , r .Method , "path" , r .URL .Path , "clientIP" , r .RemoteAddr )
226243 ctx := r .Context ()
0 commit comments