Skip to content

Commit

Permalink
Boiler plate for kubernetes#12090 to allow Nodes to send features sup…
Browse files Browse the repository at this point in the history
…ported by the container runtime and OS to the master.
  • Loading branch information
pwittrock committed Aug 21, 2015
1 parent 5f36c07 commit 25fb4b7
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 1 deletion.
10 changes: 9 additions & 1 deletion api/swagger-spec/v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -11797,7 +11797,8 @@
"osImage",
"containerRuntimeVersion",
"kubeletVersion",
"kubeProxyVersion"
"kubeProxyVersion",
"featureInfo"
],
"properties": {
"machineID": {
Expand Down Expand Up @@ -11831,9 +11832,16 @@
"kubeProxyVersion": {
"type": "string",
"description": "Kube-proxy version reported by the node"
},
"featureInfo": {
"$ref": "v1.NodeFeatureInfo"
}
}
},
"v1.NodeFeatureInfo": {
"id": "v1.NodeFeatureInfo",
"properties": {}
},
"v1.PersistentVolumeClaimList": {
"id": "v1.PersistentVolumeClaimList",
"properties": {
Expand Down
8 changes: 8 additions & 0 deletions pkg/api/deep_copy_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,10 @@ func deepCopy_api_NodeCondition(in NodeCondition, out *NodeCondition, c *convers
return nil
}

func deepCopy_api_NodeFeatureInfo(in NodeFeatureInfo, out *NodeFeatureInfo, c *conversion.Cloner) error {
return nil
}

func deepCopy_api_NodeList(in NodeList, out *NodeList, c *conversion.Cloner) error {
if err := deepCopy_api_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
Expand Down Expand Up @@ -983,6 +987,9 @@ func deepCopy_api_NodeSystemInfo(in NodeSystemInfo, out *NodeSystemInfo, c *conv
out.ContainerRuntimeVersion = in.ContainerRuntimeVersion
out.KubeletVersion = in.KubeletVersion
out.KubeProxyVersion = in.KubeProxyVersion
if err := deepCopy_api_NodeFeatureInfo(in.FeatureInfo, &out.FeatureInfo, c); err != nil {
return err
}
return nil
}

Expand Down Expand Up @@ -2290,6 +2297,7 @@ func init() {
deepCopy_api_Node,
deepCopy_api_NodeAddress,
deepCopy_api_NodeCondition,
deepCopy_api_NodeFeatureInfo,
deepCopy_api_NodeList,
deepCopy_api_NodeSpec,
deepCopy_api_NodeStatus,
Expand Down
5 changes: 5 additions & 0 deletions pkg/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1366,6 +1366,11 @@ type NodeSystemInfo struct {
KubeletVersion string `json:"kubeletVersion"`
// Kube-proxy version reported by the node
KubeProxyVersion string `json:"kubeProxyVersion"`
// Kubernetes features supported by this node
FeatureInfo NodeFeatureInfo `json:"featureInfo"`
}

type NodeFeatureInfo struct {
}

// NodeStatus is information about the current status of a node.
Expand Down
22 changes: 22 additions & 0 deletions pkg/api/v1/conversion_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,13 @@ func convert_api_NodeCondition_To_v1_NodeCondition(in *api.NodeCondition, out *N
return nil
}

func convert_api_NodeFeatureInfo_To_v1_NodeFeatureInfo(in *api.NodeFeatureInfo, out *NodeFeatureInfo, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*api.NodeFeatureInfo))(in)
}
return nil
}

func convert_api_NodeList_To_v1_NodeList(in *api.NodeList, out *NodeList, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*api.NodeList))(in)
Expand Down Expand Up @@ -1143,6 +1150,9 @@ func convert_api_NodeSystemInfo_To_v1_NodeSystemInfo(in *api.NodeSystemInfo, out
out.ContainerRuntimeVersion = in.ContainerRuntimeVersion
out.KubeletVersion = in.KubeletVersion
out.KubeProxyVersion = in.KubeProxyVersion
if err := convert_api_NodeFeatureInfo_To_v1_NodeFeatureInfo(&in.FeatureInfo, &out.FeatureInfo, s); err != nil {
return err
}
return nil
}

Expand Down Expand Up @@ -3475,6 +3485,13 @@ func convert_v1_NodeCondition_To_api_NodeCondition(in *NodeCondition, out *api.N
return nil
}

func convert_v1_NodeFeatureInfo_To_api_NodeFeatureInfo(in *NodeFeatureInfo, out *api.NodeFeatureInfo, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*NodeFeatureInfo))(in)
}
return nil
}

func convert_v1_NodeList_To_api_NodeList(in *NodeList, out *api.NodeList, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*NodeList))(in)
Expand Down Expand Up @@ -3564,6 +3581,9 @@ func convert_v1_NodeSystemInfo_To_api_NodeSystemInfo(in *NodeSystemInfo, out *ap
out.ContainerRuntimeVersion = in.ContainerRuntimeVersion
out.KubeletVersion = in.KubeletVersion
out.KubeProxyVersion = in.KubeProxyVersion
if err := convert_v1_NodeFeatureInfo_To_api_NodeFeatureInfo(&in.FeatureInfo, &out.FeatureInfo, s); err != nil {
return err
}
return nil
}

Expand Down Expand Up @@ -4926,6 +4946,7 @@ func init() {
convert_api_Namespace_To_v1_Namespace,
convert_api_NodeAddress_To_v1_NodeAddress,
convert_api_NodeCondition_To_v1_NodeCondition,
convert_api_NodeFeatureInfo_To_v1_NodeFeatureInfo,
convert_api_NodeList_To_v1_NodeList,
convert_api_NodeSpec_To_v1_NodeSpec,
convert_api_NodeStatus_To_v1_NodeStatus,
Expand Down Expand Up @@ -5047,6 +5068,7 @@ func init() {
convert_v1_Namespace_To_api_Namespace,
convert_v1_NodeAddress_To_api_NodeAddress,
convert_v1_NodeCondition_To_api_NodeCondition,
convert_v1_NodeFeatureInfo_To_api_NodeFeatureInfo,
convert_v1_NodeList_To_api_NodeList,
convert_v1_NodeSpec_To_api_NodeSpec,
convert_v1_NodeStatus_To_api_NodeStatus,
Expand Down
8 changes: 8 additions & 0 deletions pkg/api/v1/deep_copy_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,10 @@ func deepCopy_v1_NodeCondition(in NodeCondition, out *NodeCondition, c *conversi
return nil
}

func deepCopy_v1_NodeFeatureInfo(in NodeFeatureInfo, out *NodeFeatureInfo, c *conversion.Cloner) error {
return nil
}

func deepCopy_v1_NodeList(in NodeList, out *NodeList, c *conversion.Cloner) error {
if err := deepCopy_v1_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
Expand Down Expand Up @@ -982,6 +986,9 @@ func deepCopy_v1_NodeSystemInfo(in NodeSystemInfo, out *NodeSystemInfo, c *conve
out.ContainerRuntimeVersion = in.ContainerRuntimeVersion
out.KubeletVersion = in.KubeletVersion
out.KubeProxyVersion = in.KubeProxyVersion
if err := deepCopy_v1_NodeFeatureInfo(in.FeatureInfo, &out.FeatureInfo, c); err != nil {
return err
}
return nil
}

Expand Down Expand Up @@ -2292,6 +2299,7 @@ func init() {
deepCopy_v1_Node,
deepCopy_v1_NodeAddress,
deepCopy_v1_NodeCondition,
deepCopy_v1_NodeFeatureInfo,
deepCopy_v1_NodeList,
deepCopy_v1_NodeSpec,
deepCopy_v1_NodeStatus,
Expand Down
5 changes: 5 additions & 0 deletions pkg/api/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1336,6 +1336,11 @@ type NodeSystemInfo struct {
KubeletVersion string `json:"kubeletVersion" description:"Kubelet version reported by the node"`
// Kube-proxy version reported by the node
KubeProxyVersion string `json:"kubeProxyVersion" description:"Kube-proxy version reported by the node"`
// Kubernetes features supported by this node
FeatureInfo NodeFeatureInfo `json:"featureInfo"`
}

type NodeFeatureInfo struct {
}

// NodeStatus is information about the current status of a node.
Expand Down
9 changes: 9 additions & 0 deletions pkg/kubelet/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -2115,6 +2115,7 @@ func (kl *Kubelet) setNodeStatus(node *api.Node) error {
node.Status.NodeInfo.KubeletVersion = version.Get().String()
// TODO: kube-proxy might be different version from kubelet in the future
node.Status.NodeInfo.KubeProxyVersion = version.Get().String()
node.Status.NodeInfo.FeatureInfo = kl.getFeatureInfo(verinfo)
}

// Check whether container runtime can be reported as up.
Expand Down Expand Up @@ -2514,6 +2515,14 @@ func (kl *Kubelet) GetCachedMachineInfo() (*cadvisorApi.MachineInfo, error) {
return kl.machineInfo, nil
}

// getFeatureInfo creates a NodeFeatureInfo describing the Kubernetes features supported by the
// available container runtime and OS
// TODO: Consider moving these mappings into a configurable file so they can be overridden
func (kl *Kubelet) getFeatureInfo(*cadvisorApi.VersionInfo) api.NodeFeatureInfo {
// TODO: Implement this once we have the mappings
return api.NodeFeatureInfo{}
}

func (kl *Kubelet) ListenAndServe(address net.IP, port uint, tlsOptions *TLSOptions, enableDebuggingHandlers bool) {
ListenAndServeKubeletServer(kl, address, port, tlsOptions, enableDebuggingHandlers)
}
Expand Down

0 comments on commit 25fb4b7

Please sign in to comment.