diff --git a/src/k8s/pkg/k8sd/api/cluster_remove.go b/src/k8s/pkg/k8sd/api/cluster_remove.go index b1b31ee79..47336503d 100644 --- a/src/k8s/pkg/k8sd/api/cluster_remove.go +++ b/src/k8s/pkg/k8sd/api/cluster_remove.go @@ -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) } diff --git a/src/k8s/pkg/k8sd/api/response.go b/src/k8s/pkg/k8sd/api/response.go index 78f84aa1f..626aadfa8 100644 --- a/src/k8s/pkg/k8sd/api/response.go +++ b/src/k8s/pkg/k8sd/api/response.go @@ -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()) }