2016-11-22 16:49:54 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
2017-11-09 10:10:35 +00:00
|
|
|
"time"
|
|
|
|
|
2016-11-22 16:49:54 +00:00
|
|
|
"golang.org/x/net/context"
|
2018-02-12 20:13:07 +00:00
|
|
|
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
2016-11-22 16:49:54 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Status returns the status of the runtime
|
2017-11-09 10:10:35 +00:00
|
|
|
func (s *Server) Status(ctx context.Context, req *pb.StatusRequest) (resp *pb.StatusResponse, err error) {
|
|
|
|
const operation = "status"
|
|
|
|
defer func() {
|
|
|
|
recordOperation(operation, time.Now())
|
|
|
|
recordError(operation, err)
|
|
|
|
}()
|
2016-11-22 16:49:54 +00:00
|
|
|
|
|
|
|
// Deal with Runtime conditions
|
2017-07-17 12:25:32 +00:00
|
|
|
runtimeReady, err := s.Runtime().RuntimeReady()
|
2016-11-22 16:49:54 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2017-07-17 12:25:32 +00:00
|
|
|
networkReady, err := s.Runtime().NetworkReady()
|
2016-11-22 16:49:54 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
// Use vendored strings
|
|
|
|
runtimeReadyConditionString := pb.RuntimeReady
|
|
|
|
networkReadyConditionString := pb.NetworkReady
|
|
|
|
|
2017-11-09 10:10:35 +00:00
|
|
|
resp = &pb.StatusResponse{
|
2016-11-22 16:49:54 +00:00
|
|
|
Status: &pb.RuntimeStatus{
|
|
|
|
Conditions: []*pb.RuntimeCondition{
|
2016-12-14 11:31:41 +00:00
|
|
|
{
|
2017-02-03 14:41:28 +00:00
|
|
|
Type: runtimeReadyConditionString,
|
|
|
|
Status: runtimeReady,
|
2016-11-22 16:49:54 +00:00
|
|
|
},
|
2016-12-14 11:31:41 +00:00
|
|
|
{
|
2017-02-03 14:41:28 +00:00
|
|
|
Type: networkReadyConditionString,
|
|
|
|
Status: networkReady,
|
2016-11-22 16:49:54 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
return resp, nil
|
|
|
|
}
|