will facilitate better client side UX ⼤意是给所有的资源请求接⼝,返回Kind这个字段,对于客户端更加友好 我们可以在提交的 pr 中给ServiceList 这个结构体中添加了 JsonBase 这个内嵌对象,同时在ServiceRestStroage 中给Kind字段赋值为 cluster#service PR #23 Add test to kubelet, coverage up to 37% ⼤意是给 kubelet 增加测试代码 1. ⾸先将 KubeletServer 结构体中 Kubelet 变成 kubeletInterface 接⼝,⽅便后续测试时候mock // JSONBase is shared by all objects sent to, or returned from the client type JSONBase struct { Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` ID string `json:"id,omitempty" yaml:"id,omitempty"` CreationTimestamp string `json:"creationTimestamp,omitempty" yaml:"creationTimestamp,omitempty"` SelfLink string `json:"selfLink,omitempty" yaml:"selfLink,omitempty"` } // kubeletInterface contains all the kubelet methods required by the server. // For testablitiy. type kubeletInterface interface { GetContainerID(name string) (string, error) GetContainerInfo(name string) (string, error) }