Skip to content

Commit

Permalink
Merge pull request kubernetes#23684 from luxas/auto_label_arch
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue

Automatically add node labels beta.kubernetes.io/{os,arch}

Proposal: kubernetes#17981
As discussed in kubernetes#22623:
> @davidopp: kubernetes#9044 says cloud provider but can also cover platform stuff.

Adds a label `beta.kubernetes.io/platform` to `kubelet` that informs about the os/arch it's running on.
Makes it easy to specify `nodeSelectors` for different arches in multi-arch clusters.

```console
$ kubectl get no --show-labels
NAME        STATUS    AGE       LABELS
127.0.0.1   Ready     1m        beta.kubernetes.io/platform=linux-amd64,kubernetes.io/hostname=127.0.0.1
$ kubectl describe no
Name:			127.0.0.1
Labels:			beta.kubernetes.io/platform=linux-amd64,kubernetes.io/hostname=127.0.0.1
CreationTimestamp:	Thu, 31 Mar 2016 20:39:15 +0300
```
@davidopp @vishh @fgrzadkowski @thockin @wojtek-t @ixdy @bgrant0607 @dchen1107 @preillyme
  • Loading branch information
k8s-merge-robot committed May 13, 2016
2 parents 4aabafe + 0b6b723 commit 399b086
Show file tree
Hide file tree
Showing 16 changed files with 416 additions and 111 deletions.
12 changes: 11 additions & 1 deletion api/swagger-spec/v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -16063,7 +16063,9 @@
"osImage",
"containerRuntimeVersion",
"kubeletVersion",
"kubeProxyVersion"
"kubeProxyVersion",
"operatingSystem",
"architecture"
],
"properties": {
"machineID": {
Expand Down Expand Up @@ -16097,6 +16099,14 @@
"kubeProxyVersion": {
"type": "string",
"description": "KubeProxy Version reported by the node."
},
"operatingSystem": {
"type": "string",
"description": "The Operating System reported by the node"
},
"architecture": {
"type": "string",
"description": "The Architecture reported by the node"
}
}
},
Expand Down
16 changes: 15 additions & 1 deletion docs/api-reference/v1/definitions.html
Original file line number Diff line number Diff line change
Expand Up @@ -7549,6 +7549,20 @@ <h3 id="_v1_nodesysteminfo">v1.NodeSystemInfo</h3>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">operatingSystem</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The Operating System reported by the node</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">architecture</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The Architecture reported by the node</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>

Expand Down Expand Up @@ -7846,7 +7860,7 @@ <h3 id="_any">any</h3>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2016-05-06 04:28:14 UTC
Last updated 2016-05-10 14:28:49 UTC
</div>
</div>
</body>
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/deep_copy_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,8 @@ func DeepCopy_api_NodeSystemInfo(in NodeSystemInfo, out *NodeSystemInfo, c *conv
out.ContainerRuntimeVersion = in.ContainerRuntimeVersion
out.KubeletVersion = in.KubeletVersion
out.KubeProxyVersion = in.KubeProxyVersion
out.OperatingSystem = in.OperatingSystem
out.Architecture = in.Architecture
return nil
}

Expand Down
188 changes: 135 additions & 53 deletions pkg/api/types.generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -34275,14 +34275,14 @@ func (x *NodeSystemInfo) CodecEncodeSelf(e *codec1978.Encoder) {
} else {
yysep2 := !z.EncBinary()
yy2arr2 := z.EncBasicHandle().StructToArray
var yyq2 [8]bool
var yyq2 [10]bool
_, _, _ = yysep2, yyq2, yy2arr2
const yyr2 bool = false
var yynn2 int
if yyr2 || yy2arr2 {
r.EncodeArrayStart(8)
r.EncodeArrayStart(10)
} else {
yynn2 = 8
yynn2 = 10
for _, b := range yyq2 {
if b {
yynn2++
Expand Down Expand Up @@ -34443,6 +34443,44 @@ func (x *NodeSystemInfo) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeString(codecSelferC_UTF81234, string(x.KubeProxyVersion))
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
yym28 := z.EncBinary()
_ = yym28
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.OperatingSystem))
}
} else {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("operatingSystem"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym29 := z.EncBinary()
_ = yym29
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.OperatingSystem))
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
yym31 := z.EncBinary()
_ = yym31
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Architecture))
}
} else {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("architecture"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym32 := z.EncBinary()
_ = yym32
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Architecture))
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
Expand Down Expand Up @@ -34552,6 +34590,18 @@ func (x *NodeSystemInfo) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
} else {
x.KubeProxyVersion = string(r.DecodeString())
}
case "operatingSystem":
if r.TryDecodeAsNil() {
x.OperatingSystem = ""
} else {
x.OperatingSystem = string(r.DecodeString())
}
case "architecture":
if r.TryDecodeAsNil() {
x.Architecture = ""
} else {
x.Architecture = string(r.DecodeString())
}
default:
z.DecStructFieldNotFound(-1, yys3)
} // end switch yys3
Expand All @@ -34563,16 +34613,16 @@ func (x *NodeSystemInfo) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yyj12 int
var yyb12 bool
var yyhl12 bool = l >= 0
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
var yyj14 int
var yyb14 bool
var yyhl14 bool = l >= 0
yyj14++
if yyhl14 {
yyb14 = yyj14 > l
} else {
yyb12 = r.CheckBreak()
yyb14 = r.CheckBreak()
}
if yyb12 {
if yyb14 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
Expand All @@ -34582,13 +34632,13 @@ func (x *NodeSystemInfo) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
} else {
x.MachineID = string(r.DecodeString())
}
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
yyj14++
if yyhl14 {
yyb14 = yyj14 > l
} else {
yyb12 = r.CheckBreak()
yyb14 = r.CheckBreak()
}
if yyb12 {
if yyb14 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
Expand All @@ -34598,13 +34648,13 @@ func (x *NodeSystemInfo) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
} else {
x.SystemUUID = string(r.DecodeString())
}
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
yyj14++
if yyhl14 {
yyb14 = yyj14 > l
} else {
yyb12 = r.CheckBreak()
yyb14 = r.CheckBreak()
}
if yyb12 {
if yyb14 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
Expand All @@ -34614,13 +34664,13 @@ func (x *NodeSystemInfo) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
} else {
x.BootID = string(r.DecodeString())
}
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
yyj14++
if yyhl14 {
yyb14 = yyj14 > l
} else {
yyb12 = r.CheckBreak()
yyb14 = r.CheckBreak()
}
if yyb12 {
if yyb14 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
Expand All @@ -34630,13 +34680,13 @@ func (x *NodeSystemInfo) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
} else {
x.KernelVersion = string(r.DecodeString())
}
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
yyj14++
if yyhl14 {
yyb14 = yyj14 > l
} else {
yyb12 = r.CheckBreak()
yyb14 = r.CheckBreak()
}
if yyb12 {
if yyb14 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
Expand All @@ -34646,13 +34696,13 @@ func (x *NodeSystemInfo) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
} else {
x.OSImage = string(r.DecodeString())
}
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
yyj14++
if yyhl14 {
yyb14 = yyj14 > l
} else {
yyb12 = r.CheckBreak()
yyb14 = r.CheckBreak()
}
if yyb12 {
if yyb14 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
Expand All @@ -34662,13 +34712,13 @@ func (x *NodeSystemInfo) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
} else {
x.ContainerRuntimeVersion = string(r.DecodeString())
}
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
yyj14++
if yyhl14 {
yyb14 = yyj14 > l
} else {
yyb12 = r.CheckBreak()
yyb14 = r.CheckBreak()
}
if yyb12 {
if yyb14 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
Expand All @@ -34678,13 +34728,13 @@ func (x *NodeSystemInfo) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
} else {
x.KubeletVersion = string(r.DecodeString())
}
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
yyj14++
if yyhl14 {
yyb14 = yyj14 > l
} else {
yyb12 = r.CheckBreak()
yyb14 = r.CheckBreak()
}
if yyb12 {
if yyb14 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
Expand All @@ -34694,18 +34744,50 @@ func (x *NodeSystemInfo) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
} else {
x.KubeProxyVersion = string(r.DecodeString())
}
yyj14++
if yyhl14 {
yyb14 = yyj14 > l
} else {
yyb14 = r.CheckBreak()
}
if yyb14 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.OperatingSystem = ""
} else {
x.OperatingSystem = string(r.DecodeString())
}
yyj14++
if yyhl14 {
yyb14 = yyj14 > l
} else {
yyb14 = r.CheckBreak()
}
if yyb14 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Architecture = ""
} else {
x.Architecture = string(r.DecodeString())
}
for {
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
yyj14++
if yyhl14 {
yyb14 = yyj14 > l
} else {
yyb12 = r.CheckBreak()
yyb14 = r.CheckBreak()
}
if yyb12 {
if yyb14 {
break
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj12-1, "")
z.DecStructFieldNotFound(yyj14-1, "")
}
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
Expand Down Expand Up @@ -55547,7 +55629,7 @@ func (x codecSelfer1234) decSliceNode(v *[]Node, d *codec1978.Decoder) {

yyrg1 := len(yyv1) > 0
yyv21 := yyv1
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 536)
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 568)
if yyrt1 {
if yyrl1 <= cap(yyv1) {
yyv1 = yyv1[:yyrl1]
Expand Down
4 changes: 4 additions & 0 deletions pkg/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,10 @@ type NodeSystemInfo struct {
KubeletVersion string `json:"kubeletVersion"`
// KubeProxy Version reported by the node.
KubeProxyVersion string `json:"kubeProxyVersion"`
// The Operating System reported by the node
OperatingSystem string `json:"operatingSystem"`
// The Architecture reported by the node
Architecture string `json:"architecture"`
}

// NodeStatus is information about the current status of a node.
Expand Down
3 changes: 3 additions & 0 deletions pkg/api/unversioned/well_known_labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ const (
LabelZoneRegion = "failure-domain.beta.kubernetes.io/region"

LabelInstanceType = "beta.kubernetes.io/instance-type"

LabelOS = "beta.kubernetes.io/os"
LabelArch = "beta.kubernetes.io/arch"
)
Loading

0 comments on commit 399b086

Please sign in to comment.