Skip to content

Commit

Permalink
fix: drop into the agent for non-allocated servers
Browse files Browse the repository at this point in the history
Fixes #558

Returning 404 error to iPXE might bring some servers into the state when
it takes a hard reboot to make it go back to network boot.

Also in line with the future changes to boot in the long-running agent
always.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
  • Loading branch information
smira committed Nov 15, 2021
1 parent b0e3611 commit 701d01b
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions app/sidero-controller-manager/internal/ipxe/ipxe_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ import (
"github.com/talos-systems/sidero/app/sidero-controller-manager/pkg/constants"
)

var (
ErrNotInUse = errors.New("server not in use")
ErrBootFromDisk = errors.New("boot from disk")
)
var ErrBootFromDisk = errors.New("boot from disk")

// bootFile is used when iPXE is booted without embedded script via iPXE request http://endpoint:8081/boot.ipxe.
const bootFile = `#!ipxe
Expand Down Expand Up @@ -140,13 +137,6 @@ func ipxeHandler(w http.ResponseWriter, r *http.Request) {
return
}

if errors.Is(err, ErrNotInUse) {
log.Printf("Server %q not in use, skipping", uuid)
w.WriteHeader(http.StatusNotFound)

return
}

log.Printf("%v", err)
w.WriteHeader(http.StatusInternalServerError)

Expand Down Expand Up @@ -296,10 +286,8 @@ func newEnvironment(server *metalv1alpha1.Server, serverBinding *infrav1.ServerB
switch {
case server == nil:
return newAgentEnvironment(arch), nil
case serverBinding == nil && !server.Status.IsClean:
return newAgentEnvironment(arch), nil
case serverBinding == nil:
return nil, ErrNotInUse
return newAgentEnvironment(arch), nil
case conditions.Has(server, metalv1alpha1.ConditionPXEBooted) && !server.Spec.PXEBootAlways:
return nil, ErrBootFromDisk
case server.Spec.EnvironmentRef != nil:
Expand Down

0 comments on commit 701d01b

Please sign in to comment.