2016-11-22 16:49:54 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"golang.org/x/net/context"
|
2017-08-04 11:13:19 +00:00
|
|
|
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
|
2016-11-22 16:49:54 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Status returns the status of the runtime
|
|
|
|
func (s *Server) Status(ctx context.Context, req *pb.StatusRequest) (*pb.StatusResponse, error) {
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
|
resp := &pb.StatusResponse{
|
|
|
|
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
|
|
|
|
}
|