mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #129954 from iholder101/swap/capacity-on-node-sys-info
[KEP-2400] Report swap capacity as part of node.status.nodeSystemInfo
This commit is contained in:
commit
2499a2c0a0
15
api/openapi-spec/swagger.json
generated
15
api/openapi-spec/swagger.json
generated
@ -8739,6 +8739,17 @@
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"io.k8s.api.core.v1.NodeSwapStatus": {
|
||||
"description": "NodeSwapStatus represents swap memory information.",
|
||||
"properties": {
|
||||
"capacity": {
|
||||
"description": "Total amount of swap memory in bytes.",
|
||||
"format": "int64",
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"io.k8s.api.core.v1.NodeSystemInfo": {
|
||||
"description": "NodeSystemInfo is a set of ids/uuids to uniquely identify the node.",
|
||||
"properties": {
|
||||
@ -8778,6 +8789,10 @@
|
||||
"description": "OS Image reported by the node from /etc/os-release (e.g. Debian GNU/Linux 7 (wheezy)).",
|
||||
"type": "string"
|
||||
},
|
||||
"swap": {
|
||||
"$ref": "#/definitions/io.k8s.api.core.v1.NodeSwapStatus",
|
||||
"description": "Swap Info reported by the node."
|
||||
},
|
||||
"systemUUID": {
|
||||
"description": "SystemUUID reported by the node. For unique machine identification MachineID is preferred. This field is specific to Red Hat hosts https://access.redhat.com/documentation/en-us/red_hat_subscription_management/1/html/rhsm/uuid",
|
||||
"type": "string"
|
||||
|
19
api/openapi-spec/v3/api__v1_openapi.json
generated
19
api/openapi-spec/v3/api__v1_openapi.json
generated
@ -4149,6 +4149,17 @@
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"io.k8s.api.core.v1.NodeSwapStatus": {
|
||||
"description": "NodeSwapStatus represents swap memory information.",
|
||||
"properties": {
|
||||
"capacity": {
|
||||
"description": "Total amount of swap memory in bytes.",
|
||||
"format": "int64",
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"io.k8s.api.core.v1.NodeSystemInfo": {
|
||||
"description": "NodeSystemInfo is a set of ids/uuids to uniquely identify the node.",
|
||||
"properties": {
|
||||
@ -4197,6 +4208,14 @@
|
||||
"description": "OS Image reported by the node from /etc/os-release (e.g. Debian GNU/Linux 7 (wheezy)).",
|
||||
"type": "string"
|
||||
},
|
||||
"swap": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/io.k8s.api.core.v1.NodeSwapStatus"
|
||||
}
|
||||
],
|
||||
"description": "Swap Info reported by the node."
|
||||
},
|
||||
"systemUUID": {
|
||||
"default": "",
|
||||
"description": "SystemUUID reported by the node. For unique machine identification MachineID is preferred. This field is specific to Red Hat hosts https://access.redhat.com/documentation/en-us/red_hat_subscription_management/1/html/rhsm/uuid",
|
||||
|
@ -5190,6 +5190,15 @@ type NodeSystemInfo struct {
|
||||
OperatingSystem string
|
||||
// The Architecture reported by the node
|
||||
Architecture string
|
||||
// Swap Info reported by the node.
|
||||
Swap *NodeSwapStatus
|
||||
}
|
||||
|
||||
// NodeSwapStatus represents swap memory information.
|
||||
type NodeSwapStatus struct {
|
||||
// Total amount of swap memory in bytes.
|
||||
// +optional
|
||||
Capacity *int64
|
||||
}
|
||||
|
||||
// NodeConfigStatus describes the status of the config assigned by Node.Spec.ConfigSource.
|
||||
|
32
pkg/apis/core/v1/zz_generated.conversion.go
generated
32
pkg/apis/core/v1/zz_generated.conversion.go
generated
@ -1162,6 +1162,16 @@ func RegisterConversions(s *runtime.Scheme) error {
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*corev1.NodeSwapStatus)(nil), (*core.NodeSwapStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_NodeSwapStatus_To_core_NodeSwapStatus(a.(*corev1.NodeSwapStatus), b.(*core.NodeSwapStatus), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*core.NodeSwapStatus)(nil), (*corev1.NodeSwapStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_core_NodeSwapStatus_To_v1_NodeSwapStatus(a.(*core.NodeSwapStatus), b.(*corev1.NodeSwapStatus), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*corev1.NodeSystemInfo)(nil), (*core.NodeSystemInfo)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_NodeSystemInfo_To_core_NodeSystemInfo(a.(*corev1.NodeSystemInfo), b.(*core.NodeSystemInfo), scope)
|
||||
}); err != nil {
|
||||
@ -5419,6 +5429,26 @@ func Convert_core_NodeStatus_To_v1_NodeStatus(in *core.NodeStatus, out *corev1.N
|
||||
return autoConvert_core_NodeStatus_To_v1_NodeStatus(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_NodeSwapStatus_To_core_NodeSwapStatus(in *corev1.NodeSwapStatus, out *core.NodeSwapStatus, s conversion.Scope) error {
|
||||
out.Capacity = (*int64)(unsafe.Pointer(in.Capacity))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_NodeSwapStatus_To_core_NodeSwapStatus is an autogenerated conversion function.
|
||||
func Convert_v1_NodeSwapStatus_To_core_NodeSwapStatus(in *corev1.NodeSwapStatus, out *core.NodeSwapStatus, s conversion.Scope) error {
|
||||
return autoConvert_v1_NodeSwapStatus_To_core_NodeSwapStatus(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_core_NodeSwapStatus_To_v1_NodeSwapStatus(in *core.NodeSwapStatus, out *corev1.NodeSwapStatus, s conversion.Scope) error {
|
||||
out.Capacity = (*int64)(unsafe.Pointer(in.Capacity))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_core_NodeSwapStatus_To_v1_NodeSwapStatus is an autogenerated conversion function.
|
||||
func Convert_core_NodeSwapStatus_To_v1_NodeSwapStatus(in *core.NodeSwapStatus, out *corev1.NodeSwapStatus, s conversion.Scope) error {
|
||||
return autoConvert_core_NodeSwapStatus_To_v1_NodeSwapStatus(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_NodeSystemInfo_To_core_NodeSystemInfo(in *corev1.NodeSystemInfo, out *core.NodeSystemInfo, s conversion.Scope) error {
|
||||
out.MachineID = in.MachineID
|
||||
out.SystemUUID = in.SystemUUID
|
||||
@ -5430,6 +5460,7 @@ func autoConvert_v1_NodeSystemInfo_To_core_NodeSystemInfo(in *corev1.NodeSystemI
|
||||
out.KubeProxyVersion = in.KubeProxyVersion
|
||||
out.OperatingSystem = in.OperatingSystem
|
||||
out.Architecture = in.Architecture
|
||||
out.Swap = (*core.NodeSwapStatus)(unsafe.Pointer(in.Swap))
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -5449,6 +5480,7 @@ func autoConvert_core_NodeSystemInfo_To_v1_NodeSystemInfo(in *core.NodeSystemInf
|
||||
out.KubeProxyVersion = in.KubeProxyVersion
|
||||
out.OperatingSystem = in.OperatingSystem
|
||||
out.Architecture = in.Architecture
|
||||
out.Swap = (*corev1.NodeSwapStatus)(unsafe.Pointer(in.Swap))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -6424,6 +6424,7 @@ func ValidateNode(node *core.Node) field.ErrorList {
|
||||
// All status fields are optional and can be updated later.
|
||||
// That said, if specified, we need to ensure they are valid.
|
||||
allErrs = append(allErrs, ValidateNodeResources(node)...)
|
||||
allErrs = append(allErrs, validateNodeSwapStatus(node.Status.NodeInfo.Swap, fldPath.Child("nodeSwapStatus"))...)
|
||||
|
||||
// validate PodCIDRS only if we need to
|
||||
if len(node.Spec.PodCIDRs) > 0 {
|
||||
@ -8769,3 +8770,22 @@ func IsValidIPForLegacyField(fldPath *field.Path, value string, validOldIPs []st
|
||||
func IsValidCIDRForLegacyField(fldPath *field.Path, value string, validOldCIDRs []string) field.ErrorList {
|
||||
return validation.IsValidCIDRForLegacyField(fldPath, value, utilfeature.DefaultFeatureGate.Enabled(features.StrictIPCIDRValidation), validOldCIDRs)
|
||||
}
|
||||
|
||||
func validateNodeSwapStatus(nodeSwapStatus *core.NodeSwapStatus, fldPath *field.Path) field.ErrorList {
|
||||
allErrors := field.ErrorList{}
|
||||
|
||||
if nodeSwapStatus == nil {
|
||||
return allErrors
|
||||
}
|
||||
|
||||
if nodeSwapStatus.Capacity != nil {
|
||||
capacityFld := fldPath.Child("capacity")
|
||||
|
||||
errs := ValidatePositiveField(*nodeSwapStatus.Capacity, capacityFld)
|
||||
if len(errs) > 0 {
|
||||
allErrors = append(allErrors, errs...)
|
||||
}
|
||||
}
|
||||
|
||||
return allErrors
|
||||
}
|
||||
|
@ -26758,3 +26758,64 @@ func TestValidatePodResize(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateNodeSwapStatus(t *testing.T) {
|
||||
makeNode := func(nodeSwapStatus *core.NodeSwapStatus) core.Node {
|
||||
node := makeNode("test-node", nil)
|
||||
node.Status.NodeInfo.Swap = nodeSwapStatus
|
||||
|
||||
return node
|
||||
}
|
||||
makeSwapStatus := func(capacity int64) *core.NodeSwapStatus {
|
||||
return &core.NodeSwapStatus{
|
||||
Capacity: ptr.To(capacity),
|
||||
}
|
||||
}
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
expectError bool
|
||||
node core.Node
|
||||
}{
|
||||
{
|
||||
name: "node with nil nodeSwapStatus",
|
||||
expectError: false,
|
||||
node: makeNode(nil),
|
||||
},
|
||||
{
|
||||
name: "node with nil nodeSwapStatus.Capacity",
|
||||
expectError: false,
|
||||
node: makeNode(&core.NodeSwapStatus{}),
|
||||
},
|
||||
{
|
||||
name: "node with positive capacity",
|
||||
expectError: false,
|
||||
node: makeNode(makeSwapStatus(123456)),
|
||||
},
|
||||
{
|
||||
name: "node with zero capacity should be invalid (nodeSwapStatus should be nil)",
|
||||
expectError: true,
|
||||
node: makeNode(makeSwapStatus(0)),
|
||||
},
|
||||
{
|
||||
name: "node with negative capacity should be invalid",
|
||||
expectError: true,
|
||||
node: makeNode(makeSwapStatus(-123456)),
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
errs := ValidateNode(&tc.node)
|
||||
|
||||
if len(errs) == 0 && tc.expectError {
|
||||
t.Errorf("expected failure for %s, but there were none", tc.name)
|
||||
return
|
||||
}
|
||||
if len(errs) != 0 && !tc.expectError {
|
||||
t.Errorf("expected success for %s, but there were errors: %v", tc.name, errs)
|
||||
return
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
28
pkg/apis/core/zz_generated.deepcopy.go
generated
28
pkg/apis/core/zz_generated.deepcopy.go
generated
@ -3004,7 +3004,7 @@ func (in *NodeStatus) DeepCopyInto(out *NodeStatus) {
|
||||
copy(*out, *in)
|
||||
}
|
||||
out.DaemonEndpoints = in.DaemonEndpoints
|
||||
out.NodeInfo = in.NodeInfo
|
||||
in.NodeInfo.DeepCopyInto(&out.NodeInfo)
|
||||
if in.Images != nil {
|
||||
in, out := &in.Images, &out.Images
|
||||
*out = make([]ContainerImage, len(*in))
|
||||
@ -3052,9 +3052,35 @@ func (in *NodeStatus) DeepCopy() *NodeStatus {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *NodeSwapStatus) DeepCopyInto(out *NodeSwapStatus) {
|
||||
*out = *in
|
||||
if in.Capacity != nil {
|
||||
in, out := &in.Capacity, &out.Capacity
|
||||
*out = new(int64)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSwapStatus.
|
||||
func (in *NodeSwapStatus) DeepCopy() *NodeSwapStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(NodeSwapStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *NodeSystemInfo) DeepCopyInto(out *NodeSystemInfo) {
|
||||
*out = *in
|
||||
if in.Swap != nil {
|
||||
in, out := &in.Swap, &out.Swap
|
||||
*out = new(NodeSwapStatus)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
29
pkg/generated/openapi/zz_generated.openapi.go
generated
29
pkg/generated/openapi/zz_generated.openapi.go
generated
@ -510,6 +510,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
|
||||
"k8s.io/api/core/v1.NodeSelectorTerm": schema_k8sio_api_core_v1_NodeSelectorTerm(ref),
|
||||
"k8s.io/api/core/v1.NodeSpec": schema_k8sio_api_core_v1_NodeSpec(ref),
|
||||
"k8s.io/api/core/v1.NodeStatus": schema_k8sio_api_core_v1_NodeStatus(ref),
|
||||
"k8s.io/api/core/v1.NodeSwapStatus": schema_k8sio_api_core_v1_NodeSwapStatus(ref),
|
||||
"k8s.io/api/core/v1.NodeSystemInfo": schema_k8sio_api_core_v1_NodeSystemInfo(ref),
|
||||
"k8s.io/api/core/v1.ObjectFieldSelector": schema_k8sio_api_core_v1_ObjectFieldSelector(ref),
|
||||
"k8s.io/api/core/v1.ObjectReference": schema_k8sio_api_core_v1_ObjectReference(ref),
|
||||
@ -26150,6 +26151,26 @@ func schema_k8sio_api_core_v1_NodeStatus(ref common.ReferenceCallback) common.Op
|
||||
}
|
||||
}
|
||||
|
||||
func schema_k8sio_api_core_v1_NodeSwapStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "NodeSwapStatus represents swap memory information.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"capacity": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Total amount of swap memory in bytes.",
|
||||
Type: []string{"integer"},
|
||||
Format: "int64",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_k8sio_api_core_v1_NodeSystemInfo(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
@ -26237,10 +26258,18 @@ func schema_k8sio_api_core_v1_NodeSystemInfo(ref common.ReferenceCallback) commo
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"swap": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Swap Info reported by the node.",
|
||||
Ref: ref("k8s.io/api/core/v1.NodeSwapStatus"),
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"machineID", "systemUUID", "bootID", "kernelVersion", "osImage", "containerRuntimeVersion", "kubeletVersion", "kubeProxyVersion", "operatingSystem", "architecture"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"k8s.io/api/core/v1.NodeSwapStatus"},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,7 @@ import (
|
||||
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
|
||||
"k8s.io/kubernetes/pkg/kubelet/events"
|
||||
netutils "k8s.io/utils/net"
|
||||
"k8s.io/utils/ptr"
|
||||
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
@ -354,6 +355,12 @@ func MachineInfo(nodeName string,
|
||||
// node status.
|
||||
node.Status.Capacity[v1.ResourceName(removedResource)] = *resource.NewQuantity(int64(0), resource.DecimalSI)
|
||||
}
|
||||
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.NodeSwap) && info.SwapCapacity != 0 {
|
||||
node.Status.NodeInfo.Swap = &v1.NodeSwapStatus{
|
||||
Capacity: ptr.To(int64(info.SwapCapacity)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set Allocatable.
|
||||
|
@ -40,6 +40,7 @@ import (
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
cloudprovider "k8s.io/cloud-provider"
|
||||
fakecloud "k8s.io/cloud-provider/fake"
|
||||
"k8s.io/component-base/featuregate"
|
||||
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
||||
"k8s.io/component-base/version"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
@ -49,6 +50,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/kubelet/events"
|
||||
"k8s.io/kubernetes/pkg/kubelet/util/sliceutils"
|
||||
netutils "k8s.io/utils/net"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -911,6 +913,7 @@ func TestMachineInfo(t *testing.T) {
|
||||
expectNode *v1.Node
|
||||
expectEvents []testEvent
|
||||
disableLocalStorageCapacityIsolation bool
|
||||
featureGateDependencies []featuregate.Feature
|
||||
}{
|
||||
{
|
||||
desc: "machine identifiers, basic capacity and allocatable",
|
||||
@ -1330,9 +1333,48 @@ func TestMachineInfo(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "with swap info",
|
||||
node: &v1.Node{},
|
||||
machineInfo: &cadvisorapiv1.MachineInfo{
|
||||
SwapCapacity: uint64(20 * 1024 * 1024 * 1024),
|
||||
},
|
||||
expectNode: &v1.Node{
|
||||
Status: v1.NodeStatus{
|
||||
NodeInfo: v1.NodeSystemInfo{
|
||||
Swap: &v1.NodeSwapStatus{
|
||||
Capacity: ptr.To(int64(20 * 1024 * 1024 * 1024)),
|
||||
},
|
||||
},
|
||||
Capacity: v1.ResourceList{
|
||||
v1.ResourceCPU: *resource.NewMilliQuantity(0, resource.DecimalSI),
|
||||
v1.ResourceMemory: *resource.NewQuantity(0, resource.BinarySI),
|
||||
v1.ResourcePods: *resource.NewQuantity(0, resource.DecimalSI),
|
||||
},
|
||||
Allocatable: v1.ResourceList{
|
||||
v1.ResourceCPU: *resource.NewMilliQuantity(0, resource.DecimalSI),
|
||||
v1.ResourceMemory: *resource.NewQuantity(0, resource.BinarySI),
|
||||
v1.ResourcePods: *resource.NewQuantity(0, resource.DecimalSI),
|
||||
},
|
||||
},
|
||||
},
|
||||
featureGateDependencies: []featuregate.Feature{features.NodeSwap},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
featureGatesMissing := false
|
||||
for _, featureGateDependency := range tc.featureGateDependencies {
|
||||
if !utilfeature.DefaultFeatureGate.Enabled(featureGateDependency) {
|
||||
featureGatesMissing = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if featureGatesMissing {
|
||||
continue
|
||||
}
|
||||
|
||||
t.Run(tc.desc, func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
machineInfoFunc := func() (*cadvisorapiv1.MachineInfo, error) {
|
||||
|
2458
staging/src/k8s.io/api/core/v1/generated.pb.go
generated
2458
staging/src/k8s.io/api/core/v1/generated.pb.go
generated
File diff suppressed because it is too large
Load Diff
@ -2872,6 +2872,13 @@ message NodeStatus {
|
||||
optional NodeFeatures features = 13;
|
||||
}
|
||||
|
||||
// NodeSwapStatus represents swap memory information.
|
||||
message NodeSwapStatus {
|
||||
// Total amount of swap memory in bytes.
|
||||
// +optional
|
||||
optional int64 capacity = 1;
|
||||
}
|
||||
|
||||
// NodeSystemInfo is a set of ids/uuids to uniquely identify the node.
|
||||
message NodeSystemInfo {
|
||||
// MachineID reported by the node. For unique machine identification
|
||||
@ -2907,6 +2914,9 @@ message NodeSystemInfo {
|
||||
|
||||
// The Architecture reported by the node
|
||||
optional string architecture = 10;
|
||||
|
||||
// Swap Info reported by the node.
|
||||
optional NodeSwapStatus swap = 11;
|
||||
}
|
||||
|
||||
// ObjectFieldSelector selects an APIVersioned field of an object.
|
||||
|
@ -6213,6 +6213,15 @@ type NodeSystemInfo struct {
|
||||
OperatingSystem string `json:"operatingSystem" protobuf:"bytes,9,opt,name=operatingSystem"`
|
||||
// The Architecture reported by the node
|
||||
Architecture string `json:"architecture" protobuf:"bytes,10,opt,name=architecture"`
|
||||
// Swap Info reported by the node.
|
||||
Swap *NodeSwapStatus `json:"swap,omitempty" protobuf:"bytes,11,opt,name=swap"`
|
||||
}
|
||||
|
||||
// NodeSwapStatus represents swap memory information.
|
||||
type NodeSwapStatus struct {
|
||||
// Total amount of swap memory in bytes.
|
||||
// +optional
|
||||
Capacity *int64 `json:"capacity,omitempty" protobuf:"varint,1,opt,name=capacity"`
|
||||
}
|
||||
|
||||
// NodeConfigStatus describes the status of the config assigned by Node.Spec.ConfigSource.
|
||||
|
@ -1335,6 +1335,15 @@ func (NodeStatus) SwaggerDoc() map[string]string {
|
||||
return map_NodeStatus
|
||||
}
|
||||
|
||||
var map_NodeSwapStatus = map[string]string{
|
||||
"": "NodeSwapStatus represents swap memory information.",
|
||||
"capacity": "Total amount of swap memory in bytes.",
|
||||
}
|
||||
|
||||
func (NodeSwapStatus) SwaggerDoc() map[string]string {
|
||||
return map_NodeSwapStatus
|
||||
}
|
||||
|
||||
var map_NodeSystemInfo = map[string]string{
|
||||
"": "NodeSystemInfo is a set of ids/uuids to uniquely identify the node.",
|
||||
"machineID": "MachineID reported by the node. For unique machine identification in the cluster this field is preferred. Learn more from man(5) machine-id: http://man7.org/linux/man-pages/man5/machine-id.5.html",
|
||||
@ -1347,6 +1356,7 @@ var map_NodeSystemInfo = map[string]string{
|
||||
"kubeProxyVersion": "Deprecated: KubeProxy Version reported by the node.",
|
||||
"operatingSystem": "The Operating System reported by the node",
|
||||
"architecture": "The Architecture reported by the node",
|
||||
"swap": "Swap Info reported by the node.",
|
||||
}
|
||||
|
||||
func (NodeSystemInfo) SwaggerDoc() map[string]string {
|
||||
|
@ -3002,7 +3002,7 @@ func (in *NodeStatus) DeepCopyInto(out *NodeStatus) {
|
||||
copy(*out, *in)
|
||||
}
|
||||
out.DaemonEndpoints = in.DaemonEndpoints
|
||||
out.NodeInfo = in.NodeInfo
|
||||
in.NodeInfo.DeepCopyInto(&out.NodeInfo)
|
||||
if in.Images != nil {
|
||||
in, out := &in.Images, &out.Images
|
||||
*out = make([]ContainerImage, len(*in))
|
||||
@ -3050,9 +3050,35 @@ func (in *NodeStatus) DeepCopy() *NodeStatus {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *NodeSwapStatus) DeepCopyInto(out *NodeSwapStatus) {
|
||||
*out = *in
|
||||
if in.Capacity != nil {
|
||||
in, out := &in.Capacity, &out.Capacity
|
||||
*out = new(int64)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSwapStatus.
|
||||
func (in *NodeSwapStatus) DeepCopy() *NodeSwapStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(NodeSwapStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *NodeSystemInfo) DeepCopyInto(out *NodeSystemInfo) {
|
||||
*out = *in
|
||||
if in.Swap != nil {
|
||||
in, out := &in.Swap, &out.Swap
|
||||
*out = new(NodeSwapStatus)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,10 @@
|
||||
"kubeletVersion": "kubeletVersionValue",
|
||||
"kubeProxyVersion": "kubeProxyVersionValue",
|
||||
"operatingSystem": "operatingSystemValue",
|
||||
"architecture": "architectureValue"
|
||||
"architecture": "architectureValue",
|
||||
"swap": {
|
||||
"capacity": 1
|
||||
}
|
||||
},
|
||||
"images": [
|
||||
{
|
||||
|
BIN
staging/src/k8s.io/api/testdata/HEAD/core.v1.Node.pb
vendored
BIN
staging/src/k8s.io/api/testdata/HEAD/core.v1.Node.pb
vendored
Binary file not shown.
@ -108,6 +108,8 @@ status:
|
||||
machineID: machineIDValue
|
||||
operatingSystem: operatingSystemValue
|
||||
osImage: osImageValue
|
||||
swap:
|
||||
capacity: 1
|
||||
systemUUID: systemUUIDValue
|
||||
phase: phaseValue
|
||||
runtimeHandlers:
|
||||
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
// NodeSwapStatusApplyConfiguration represents a declarative configuration of the NodeSwapStatus type for use
|
||||
// with apply.
|
||||
type NodeSwapStatusApplyConfiguration struct {
|
||||
Capacity *int64 `json:"capacity,omitempty"`
|
||||
}
|
||||
|
||||
// NodeSwapStatusApplyConfiguration constructs a declarative configuration of the NodeSwapStatus type for use with
|
||||
// apply.
|
||||
func NodeSwapStatus() *NodeSwapStatusApplyConfiguration {
|
||||
return &NodeSwapStatusApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithCapacity sets the Capacity field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Capacity field is set to the value of the last call.
|
||||
func (b *NodeSwapStatusApplyConfiguration) WithCapacity(value int64) *NodeSwapStatusApplyConfiguration {
|
||||
b.Capacity = &value
|
||||
return b
|
||||
}
|
@ -21,16 +21,17 @@ package v1
|
||||
// NodeSystemInfoApplyConfiguration represents a declarative configuration of the NodeSystemInfo type for use
|
||||
// with apply.
|
||||
type NodeSystemInfoApplyConfiguration struct {
|
||||
MachineID *string `json:"machineID,omitempty"`
|
||||
SystemUUID *string `json:"systemUUID,omitempty"`
|
||||
BootID *string `json:"bootID,omitempty"`
|
||||
KernelVersion *string `json:"kernelVersion,omitempty"`
|
||||
OSImage *string `json:"osImage,omitempty"`
|
||||
ContainerRuntimeVersion *string `json:"containerRuntimeVersion,omitempty"`
|
||||
KubeletVersion *string `json:"kubeletVersion,omitempty"`
|
||||
KubeProxyVersion *string `json:"kubeProxyVersion,omitempty"`
|
||||
OperatingSystem *string `json:"operatingSystem,omitempty"`
|
||||
Architecture *string `json:"architecture,omitempty"`
|
||||
MachineID *string `json:"machineID,omitempty"`
|
||||
SystemUUID *string `json:"systemUUID,omitempty"`
|
||||
BootID *string `json:"bootID,omitempty"`
|
||||
KernelVersion *string `json:"kernelVersion,omitempty"`
|
||||
OSImage *string `json:"osImage,omitempty"`
|
||||
ContainerRuntimeVersion *string `json:"containerRuntimeVersion,omitempty"`
|
||||
KubeletVersion *string `json:"kubeletVersion,omitempty"`
|
||||
KubeProxyVersion *string `json:"kubeProxyVersion,omitempty"`
|
||||
OperatingSystem *string `json:"operatingSystem,omitempty"`
|
||||
Architecture *string `json:"architecture,omitempty"`
|
||||
Swap *NodeSwapStatusApplyConfiguration `json:"swap,omitempty"`
|
||||
}
|
||||
|
||||
// NodeSystemInfoApplyConfiguration constructs a declarative configuration of the NodeSystemInfo type for use with
|
||||
@ -118,3 +119,11 @@ func (b *NodeSystemInfoApplyConfiguration) WithArchitecture(value string) *NodeS
|
||||
b.Architecture = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithSwap sets the Swap field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Swap field is set to the value of the last call.
|
||||
func (b *NodeSystemInfoApplyConfiguration) WithSwap(value *NodeSwapStatusApplyConfiguration) *NodeSystemInfoApplyConfiguration {
|
||||
b.Swap = value
|
||||
return b
|
||||
}
|
||||
|
@ -6528,6 +6528,12 @@ var schemaYAML = typed.YAMLObject(`types:
|
||||
elementType:
|
||||
scalar: string
|
||||
elementRelationship: atomic
|
||||
- name: io.k8s.api.core.v1.NodeSwapStatus
|
||||
map:
|
||||
fields:
|
||||
- name: capacity
|
||||
type:
|
||||
scalar: numeric
|
||||
- name: io.k8s.api.core.v1.NodeSystemInfo
|
||||
map:
|
||||
fields:
|
||||
@ -6567,6 +6573,9 @@ var schemaYAML = typed.YAMLObject(`types:
|
||||
type:
|
||||
scalar: string
|
||||
default: ""
|
||||
- name: swap
|
||||
type:
|
||||
namedType: io.k8s.api.core.v1.NodeSwapStatus
|
||||
- name: systemUUID
|
||||
type:
|
||||
scalar: string
|
||||
|
@ -856,6 +856,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
|
||||
return &applyconfigurationscorev1.NodeSpecApplyConfiguration{}
|
||||
case corev1.SchemeGroupVersion.WithKind("NodeStatus"):
|
||||
return &applyconfigurationscorev1.NodeStatusApplyConfiguration{}
|
||||
case corev1.SchemeGroupVersion.WithKind("NodeSwapStatus"):
|
||||
return &applyconfigurationscorev1.NodeSwapStatusApplyConfiguration{}
|
||||
case corev1.SchemeGroupVersion.WithKind("NodeSystemInfo"):
|
||||
return &applyconfigurationscorev1.NodeSystemInfoApplyConfiguration{}
|
||||
case corev1.SchemeGroupVersion.WithKind("ObjectFieldSelector"):
|
||||
|
Loading…
Reference in New Issue
Block a user