Merge pull request #129954 from iholder101/swap/capacity-on-node-sys-info

[KEP-2400] Report swap capacity as part of node.status.nodeSystemInfo

Kubernetes-commit: 2499a2c0a0f61f259156925cdd25dfb65df334f1
This commit is contained in:
Kubernetes Publisher 2025-03-17 19:17:48 -07:00
commit c5b5caed20
6 changed files with 72 additions and 13 deletions

View File

@ -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
}

View File

@ -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
}

View File

@ -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

View File

@ -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"):

2
go.mod
View File

@ -25,7 +25,7 @@ require (
golang.org/x/time v0.9.0
google.golang.org/protobuf v1.36.5
gopkg.in/evanphx/json-patch.v4 v4.12.0
k8s.io/api v0.0.0-20250314173034-c4f583a4a0c0
k8s.io/api v0.0.0-20250318053045-472f333f329e
k8s.io/apimachinery v0.0.0-20250316224947-6ce776c88d38
k8s.io/klog/v2 v2.130.1
k8s.io/kube-openapi v0.0.0-20250304201544-e5f78fe3ede9

4
go.sum
View File

@ -146,8 +146,8 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.0.0-20250314173034-c4f583a4a0c0 h1:lhmrz3g0hGKYb1C6kbotRXKcRCx/1x2qcbEMQ++/dPM=
k8s.io/api v0.0.0-20250314173034-c4f583a4a0c0/go.mod h1:KyMJKlD84N/kjcmc/m15SaydURaQRYKGRGRLsz83opo=
k8s.io/api v0.0.0-20250318053045-472f333f329e h1:vBbFtW46XgHqhJnDZMKvXK7gT83X28FtmZQDyFWV43Y=
k8s.io/api v0.0.0-20250318053045-472f333f329e/go.mod h1:QVPe5QA1dSSd0GA9ar7uur23kVBq1V/YzRaqwLDm6e4=
k8s.io/apimachinery v0.0.0-20250316224947-6ce776c88d38 h1:FRtTvD6cz3EPDpIonDNShy6I5sB7LebdSb8/oEj5bkg=
k8s.io/apimachinery v0.0.0-20250316224947-6ce776c88d38/go.mod h1:S2OIkExGqJOXYSYcAJwQ9zWcc6BkBUdTJUu4M7z0cvo=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=