Skip to content

Commit 57207d8

Browse files
committed
feat(api): add Architecture and NodeInfo types to core API
Add centralized Architecture type and NodeInfo struct to both v1beta1 and v1beta2 core APIs. These types enable infrastructure providers to implement the status.nodeInfo field on Infrastructure Machine Templates as defined in the Opt-in Autoscaling from Zero proposal. This eliminates the need for providers to independently copy and maintain these type definitions, ensuring consistency across the Cluster API ecosystem. Supported architectures: amd64, arm64, s390x, ppc64le Signed-off-by: Bryan Cox <[email protected]>
1 parent bb31ead commit 57207d8

File tree

6 files changed

+164
-0
lines changed

6 files changed

+164
-0
lines changed

api/core/v1beta1/common_types.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,3 +358,40 @@ func (metadata *ObjectMeta) Validate(parent *field.Path) field.ErrorList {
358358
)...)
359359
return allErrs
360360
}
361+
362+
// Architecture represents the CPU architecture of a node.
363+
// This type is defined centrally here so that all infrastructure providers
364+
// can use consistent architecture values when implementing the status.nodeInfo
365+
// field on Infrastructure Machine Templates as defined in the
366+
// Opt-in Autoscaling from Zero proposal.
367+
// See: docs/proposals/20210310-opt-in-autoscaling-from-zero.md
368+
// +kubebuilder:validation:Enum=amd64;arm64;s390x;ppc64le
369+
type Architecture string
370+
371+
// Define the Architecture constants.
372+
const (
373+
ArchitectureAmd64 Architecture = "amd64"
374+
ArchitectureArm64 Architecture = "arm64"
375+
ArchitectureS390x Architecture = "s390x"
376+
ArchitecturePpc64le Architecture = "ppc64le"
377+
)
378+
379+
// NodeInfo contains information about a node's architecture and operating system.
380+
// This type is defined centrally here so that all infrastructure providers
381+
// can use consistent types when implementing the status.nodeInfo field on
382+
// Infrastructure Machine Templates as defined in the
383+
// Opt-in Autoscaling from Zero proposal.
384+
// See: docs/proposals/20210310-opt-in-autoscaling-from-zero.md
385+
// +kubebuilder:validation:MinProperties=1
386+
type NodeInfo struct {
387+
// architecture is the CPU architecture of the node.
388+
// +optional
389+
Architecture Architecture `json:"architecture,omitempty"`
390+
391+
// operatingSystem is a string representing the operating system of the node.
392+
// This may be a string like 'linux' or 'windows'.
393+
// +optional
394+
// +kubebuilder:validation:MinLength=1
395+
// +kubebuilder:validation:MaxLength=256
396+
OperatingSystem string `json:"operatingSystem,omitempty"`
397+
}

api/core/v1beta1/zz_generated.conversion.go

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/core/v1beta1/zz_generated.deepcopy.go

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/core/v1beta2/common_types.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,3 +463,40 @@ const (
463463
// - If an OnInitialization taint is removed from the node, it will not be re-added during reconciliation.
464464
MachineTaintPropagationOnInitialization MachineTaintPropagation = "OnInitialization"
465465
)
466+
467+
// Architecture represents the CPU architecture of a node.
468+
// This type is defined centrally here so that all infrastructure providers
469+
// can use consistent architecture values when implementing the status.nodeInfo
470+
// field on Infrastructure Machine Templates as defined in the
471+
// Opt-in Autoscaling from Zero proposal.
472+
// See: docs/proposals/20210310-opt-in-autoscaling-from-zero.md
473+
// +kubebuilder:validation:Enum=amd64;arm64;s390x;ppc64le
474+
type Architecture string
475+
476+
// Define the Architecture constants.
477+
const (
478+
ArchitectureAmd64 Architecture = "amd64"
479+
ArchitectureArm64 Architecture = "arm64"
480+
ArchitectureS390x Architecture = "s390x"
481+
ArchitecturePpc64le Architecture = "ppc64le"
482+
)
483+
484+
// NodeInfo contains information about a node's architecture and operating system.
485+
// This type is defined centrally here so that all infrastructure providers
486+
// can use consistent types when implementing the status.nodeInfo field on
487+
// Infrastructure Machine Templates as defined in the
488+
// Opt-in Autoscaling from Zero proposal.
489+
// See: docs/proposals/20210310-opt-in-autoscaling-from-zero.md
490+
// +kubebuilder:validation:MinProperties=1
491+
type NodeInfo struct {
492+
// architecture is the CPU architecture of the node.
493+
// +optional
494+
Architecture Architecture `json:"architecture,omitempty"`
495+
496+
// operatingSystem is a string representing the operating system of the node.
497+
// This may be a string like 'linux' or 'windows'.
498+
// +optional
499+
// +kubebuilder:validation:MinLength=1
500+
// +kubebuilder:validation:MaxLength=256
501+
OperatingSystem string `json:"operatingSystem,omitempty"`
502+
}

api/core/v1beta2/zz_generated.deepcopy.go

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/core/v1beta2/zz_generated.openapi.go

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)