Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
addyess committed Apr 30, 2024
1 parent e6acaf3 commit 5f71d28
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/k8s/pkg/k8sd/api/cluster_remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (e *Endpoints) postClusterRemove(s *state.State, r *http.Request) response.
}

if !isWorker && !isControlPlane {
return NodeUnavalable(fmt.Errorf("node %q is not part of the cluster", req.Name))
return NodeUnavailable(fmt.Errorf("node %q is not part of the cluster", req.Name))
}
return response.SyncResponse(true, nil)
}
8 changes: 5 additions & 3 deletions src/k8s/pkg/k8sd/api/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import (
)

const (
StatusNodeUnavailable = 520 // Node cannot be removed because it isn't in the cluster
StatusNodeInUse = 521 // Node cannot be joined because it is in the cluster.
// StatusNodeUnavailable is the Http status code that the API returns if the node isn't in the cluster
StatusNodeUnavailable = 520
// StatusNodeInUse is the Http status code that the API returns if the node is already in the cluster
StatusNodeInUse = 521
)

func NodeUnavalable(err error) response.Response {
func NodeUnavailable(err error) response.Response {
return response.ErrorResponse(StatusNodeUnavailable, err.Error())
}

Expand Down

0 comments on commit 5f71d28

Please sign in to comment.