mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
Remove nodeinfo endpoint from kubelet
This commit is contained in:
parent
8dfd7001f5
commit
868e05ce96
@ -103,10 +103,6 @@ func (fakeKubeletClient) GetPodStatus(host, podNamespace, podName string) (api.P
|
|||||||
return r, nil
|
return r, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fakeKubeletClient) GetNodeInfo(host string) (api.NodeInfo, error) {
|
|
||||||
return api.NodeInfo{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (fakeKubeletClient) GetConnectionInfo(host string) (string, uint, http.RoundTripper, error) {
|
func (fakeKubeletClient) GetConnectionInfo(host string) (string, uint, http.RoundTripper, error) {
|
||||||
return "", 0, nil, errors.New("Not Implemented")
|
return "", 0, nil, errors.New("Not Implemented")
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,6 @@ func init() {
|
|||||||
&Service{},
|
&Service{},
|
||||||
&NodeList{},
|
&NodeList{},
|
||||||
&Node{},
|
&Node{},
|
||||||
&NodeInfo{},
|
|
||||||
&Status{},
|
&Status{},
|
||||||
&Endpoints{},
|
&Endpoints{},
|
||||||
&EndpointsList{},
|
&EndpointsList{},
|
||||||
@ -75,7 +74,6 @@ func (*ServiceList) IsAnAPIObject() {}
|
|||||||
func (*Endpoints) IsAnAPIObject() {}
|
func (*Endpoints) IsAnAPIObject() {}
|
||||||
func (*EndpointsList) IsAnAPIObject() {}
|
func (*EndpointsList) IsAnAPIObject() {}
|
||||||
func (*Node) IsAnAPIObject() {}
|
func (*Node) IsAnAPIObject() {}
|
||||||
func (*NodeInfo) IsAnAPIObject() {}
|
|
||||||
func (*NodeList) IsAnAPIObject() {}
|
func (*NodeList) IsAnAPIObject() {}
|
||||||
func (*Binding) IsAnAPIObject() {}
|
func (*Binding) IsAnAPIObject() {}
|
||||||
func (*Status) IsAnAPIObject() {}
|
func (*Status) IsAnAPIObject() {}
|
||||||
|
@ -1079,15 +1079,6 @@ type NodeStatus struct {
|
|||||||
NodeInfo NodeSystemInfo `json:"nodeInfo,omitempty"`
|
NodeInfo NodeSystemInfo `json:"nodeInfo,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeInfo is the information collected on the node.
|
|
||||||
type NodeInfo struct {
|
|
||||||
TypeMeta `json:",inline"`
|
|
||||||
// Capacity represents the available resources of a node
|
|
||||||
Capacity ResourceList `json:"capacity,omitempty"`
|
|
||||||
// NodeSystemInfo is a set of ids/uuids to uniquely identify the node
|
|
||||||
NodeSystemInfo `json:",inline,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type NodePhase string
|
type NodePhase string
|
||||||
|
|
||||||
// These are the valid phases of node.
|
// These are the valid phases of node.
|
||||||
|
@ -38,7 +38,6 @@ func init() {
|
|||||||
&Endpoints{},
|
&Endpoints{},
|
||||||
&EndpointsList{},
|
&EndpointsList{},
|
||||||
&Node{},
|
&Node{},
|
||||||
&NodeInfo{},
|
|
||||||
&NodeList{},
|
&NodeList{},
|
||||||
&Binding{},
|
&Binding{},
|
||||||
&Status{},
|
&Status{},
|
||||||
@ -78,7 +77,6 @@ func (*ServiceList) IsAnAPIObject() {}
|
|||||||
func (*Endpoints) IsAnAPIObject() {}
|
func (*Endpoints) IsAnAPIObject() {}
|
||||||
func (*EndpointsList) IsAnAPIObject() {}
|
func (*EndpointsList) IsAnAPIObject() {}
|
||||||
func (*Node) IsAnAPIObject() {}
|
func (*Node) IsAnAPIObject() {}
|
||||||
func (*NodeInfo) IsAnAPIObject() {}
|
|
||||||
func (*NodeList) IsAnAPIObject() {}
|
func (*NodeList) IsAnAPIObject() {}
|
||||||
func (*Binding) IsAnAPIObject() {}
|
func (*Binding) IsAnAPIObject() {}
|
||||||
func (*Status) IsAnAPIObject() {}
|
func (*Status) IsAnAPIObject() {}
|
||||||
|
@ -1073,15 +1073,6 @@ type NodeStatus struct {
|
|||||||
NodeInfo NodeSystemInfo `json:"nodeInfo,omitempty"`
|
NodeInfo NodeSystemInfo `json:"nodeInfo,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeInfo is the information collected on the node.
|
|
||||||
type NodeInfo struct {
|
|
||||||
TypeMeta `json:",inline"`
|
|
||||||
// Capacity represents the available resources of a node
|
|
||||||
Capacity ResourceList `json:"capacity,omitempty"`
|
|
||||||
// NodeSystemInfo is a set of ids/uuids to uniquely identify the node
|
|
||||||
NodeSystemInfo `json:",inline,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type NodePhase string
|
type NodePhase string
|
||||||
|
|
||||||
// These are the valid phases of node.
|
// These are the valid phases of node.
|
||||||
|
@ -39,7 +39,6 @@ var ErrPodInfoNotAvailable = errors.New("no pod info available")
|
|||||||
type KubeletClient interface {
|
type KubeletClient interface {
|
||||||
KubeletHealthChecker
|
KubeletHealthChecker
|
||||||
PodInfoGetter
|
PodInfoGetter
|
||||||
NodeInfoGetter
|
|
||||||
ConnectionInfoGetter
|
ConnectionInfoGetter
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,10 +55,6 @@ type PodInfoGetter interface {
|
|||||||
GetPodStatus(host, podNamespace, podID string) (api.PodStatusResult, error)
|
GetPodStatus(host, podNamespace, podID string) (api.PodStatusResult, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type NodeInfoGetter interface {
|
|
||||||
GetNodeInfo(host string) (api.NodeInfo, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type ConnectionInfoGetter interface {
|
type ConnectionInfoGetter interface {
|
||||||
GetConnectionInfo(host string) (scheme string, port uint, transport http.RoundTripper, error error)
|
GetConnectionInfo(host string) (scheme string, port uint, transport http.RoundTripper, error error)
|
||||||
}
|
}
|
||||||
@ -136,13 +131,6 @@ func (c *HTTPKubeletClient) GetPodStatus(host, podNamespace, podID string) (api.
|
|||||||
return status, err
|
return status, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetNodeInfo gets information about the specified node.
|
|
||||||
func (c *HTTPKubeletClient) GetNodeInfo(host string) (api.NodeInfo, error) {
|
|
||||||
info := api.NodeInfo{}
|
|
||||||
_, err := c.getEntity(host, "/api/v1beta1/nodeInfo", "", &info)
|
|
||||||
return info, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// getEntity might return a nil response.
|
// getEntity might return a nil response.
|
||||||
func (c *HTTPKubeletClient) getEntity(host, path, query string, entity runtime.Object) (*http.Response, error) {
|
func (c *HTTPKubeletClient) getEntity(host, path, query string, entity runtime.Object) (*http.Response, error) {
|
||||||
request, err := http.NewRequest("GET", c.url(host, path, query), nil)
|
request, err := http.NewRequest("GET", c.url(host, path, query), nil)
|
||||||
@ -179,11 +167,6 @@ func (c FakeKubeletClient) GetPodStatus(host, podNamespace string, podID string)
|
|||||||
return api.PodStatusResult{}, errors.New("Not Implemented")
|
return api.PodStatusResult{}, errors.New("Not Implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetNodeInfo is a fake implementation of PodInfoGetter.GetNodeInfo
|
|
||||||
func (c FakeKubeletClient) GetNodeInfo(host string) (api.NodeInfo, error) {
|
|
||||||
return api.NodeInfo{}, errors.New("Not Implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c FakeKubeletClient) HealthCheck(host string) (probe.Result, error) {
|
func (c FakeKubeletClient) HealthCheck(host string) (probe.Result, error) {
|
||||||
return probe.Unknown, errors.New("Not Implemented")
|
return probe.Unknown, errors.New("Not Implemented")
|
||||||
}
|
}
|
||||||
|
@ -146,10 +146,6 @@ func (c *FakeKubeletClient) GetPodStatus(host, podNamespace, podID string) (api.
|
|||||||
return api.PodStatusResult{}, errors.New("Not Implemented")
|
return api.PodStatusResult{}, errors.New("Not Implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeKubeletClient) GetNodeInfo(host string) (api.NodeInfo, error) {
|
|
||||||
return api.NodeInfo{}, errors.New("Not Implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeKubeletClient) GetConnectionInfo(host string) (string, uint, http.RoundTripper, error) {
|
func (c *FakeKubeletClient) GetConnectionInfo(host string) (string, uint, http.RoundTripper, error) {
|
||||||
return "", 0, nil, errors.New("Not Implemented")
|
return "", 0, nil, errors.New("Not Implemented")
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,6 @@ func (s *Server) InstallDefaultHandlers() {
|
|||||||
)
|
)
|
||||||
s.mux.HandleFunc("/podInfo", s.handlePodInfoOld)
|
s.mux.HandleFunc("/podInfo", s.handlePodInfoOld)
|
||||||
s.mux.HandleFunc("/api/v1beta1/podInfo", s.handlePodInfoVersioned)
|
s.mux.HandleFunc("/api/v1beta1/podInfo", s.handlePodInfoVersioned)
|
||||||
s.mux.HandleFunc("/api/v1beta1/nodeInfo", s.handleNodeInfoVersioned)
|
|
||||||
s.mux.HandleFunc("/pods", s.handlePods)
|
s.mux.HandleFunc("/pods", s.handlePods)
|
||||||
s.mux.HandleFunc("/stats/", s.handleStats)
|
s.mux.HandleFunc("/stats/", s.handleStats)
|
||||||
s.mux.HandleFunc("/spec/", s.handleSpec)
|
s.mux.HandleFunc("/spec/", s.handleSpec)
|
||||||
@ -346,31 +345,6 @@ func (s *Server) handleLogs(w http.ResponseWriter, req *http.Request) {
|
|||||||
s.host.ServeLogs(w, req)
|
s.host.ServeLogs(w, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
// handleNodeInfoVersioned handles node info requests against the Kubelet.
|
|
||||||
func (s *Server) handleNodeInfoVersioned(w http.ResponseWriter, req *http.Request) {
|
|
||||||
info, err := s.host.GetCachedMachineInfo()
|
|
||||||
if err != nil {
|
|
||||||
s.error(w, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
capacity := CapacityFromMachineInfo(info)
|
|
||||||
data, err := json.Marshal(api.NodeInfo{
|
|
||||||
Capacity: capacity,
|
|
||||||
NodeSystemInfo: api.NodeSystemInfo{
|
|
||||||
MachineID: info.MachineID,
|
|
||||||
SystemUUID: info.SystemUUID,
|
|
||||||
BootID: info.BootID,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
s.error(w, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
w.Header().Add("Content-type", "application/json")
|
|
||||||
w.Write(data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// handleSpec handles spec requests against the Kubelet.
|
// handleSpec handles spec requests against the Kubelet.
|
||||||
func (s *Server) handleSpec(w http.ResponseWriter, req *http.Request) {
|
func (s *Server) handleSpec(w http.ResponseWriter, req *http.Request) {
|
||||||
info, err := s.host.GetCachedMachineInfo()
|
info, err := s.host.GetCachedMachineInfo()
|
||||||
|
Loading…
Reference in New Issue
Block a user