Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/v1beta1/awsmachine_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ func (r *AWSMachineTemplate) ConvertTo(dstRaw conversion.Hub) error {
}
}

// Restore Status fields that don't exist in v1beta1.
dst.Status.NodeInfo = restored.Status.NodeInfo

return nil
}

Expand Down
7 changes: 7 additions & 0 deletions api/v1beta1/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,10 @@ func Convert_v1beta2_S3Bucket_To_v1beta1_S3Bucket(in *v1beta2.S3Bucket, out *S3B
func Convert_v1beta2_Ignition_To_v1beta1_Ignition(in *v1beta2.Ignition, out *Ignition, s conversion.Scope) error {
return autoConvert_v1beta2_Ignition_To_v1beta1_Ignition(in, out, s)
}

// Convert_v1beta2_AWSMachineTemplateStatus_To_v1beta1_AWSMachineTemplateStatus converts v1beta2 AWSMachineTemplateStatus to v1beta1.
// The NodeInfo field is dropped during conversion as it doesn't exist in v1beta1.
func Convert_v1beta2_AWSMachineTemplateStatus_To_v1beta1_AWSMachineTemplateStatus(in *v1beta2.AWSMachineTemplateStatus, out *AWSMachineTemplateStatus, s conversion.Scope) error {
// NodeInfo field is ignored (dropped) as it doesn't exist in v1beta1
return autoConvert_v1beta2_AWSMachineTemplateStatus_To_v1beta1_AWSMachineTemplateStatus(in, out, s)
}
6 changes: 1 addition & 5 deletions api/v1beta1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions api/v1beta2/awsmachinetemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,51 @@ import (
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
)

// Architecture represents the CPU architecture of the node.
// Its underlying type is a string and its value can be any of amd64, arm64.
// +kubebuilder:validation:Enum=amd64;arm64
// +enum
type Architecture string

// Architecture constants.
const (
ArchitectureAmd64 Architecture = "amd64"
ArchitectureArm64 Architecture = "arm64"
)

// Operating system constants.
const (
// OperatingSystemLinux represents the Linux operating system.
OperatingSystemLinux = "linux"
// OperatingSystemWindows represents the Windows operating system.
OperatingSystemWindows = "windows"
)

// NodeInfo contains information about the node's architecture and operating system.
type NodeInfo struct {
// Architecture is the CPU architecture of the node.
// Its underlying type is a string and its value can be any of amd64, arm64.
// +optional
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// +optional
// +kubebuilder:validation:Enum=amd64;arm64
// +optional

Architecture Architecture `json:"architecture,omitempty"`
// OperatingSystem is a string representing the operating system of the node.
// This may be a string like 'linux' or 'windows'.
// +optional
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// +optional
// +kubebuilder:validation:Enum=linux;windows
// +optional

OperatingSystem string `json:"operatingSystem,omitempty"`
}

// AWSMachineTemplateStatus defines a status for an AWSMachineTemplate.
type AWSMachineTemplateStatus struct {
// Capacity defines the resource capacity for this machine.
// This value is used for autoscaling from zero operations as defined in:
// https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20210310-opt-in-autoscaling-from-zero.md
// +optional
Capacity corev1.ResourceList `json:"capacity,omitempty"`

// NodeInfo contains information about the node's architecture and operating system.
// This value is used for autoscaling from zero operations as defined in:
// https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20210310-opt-in-autoscaling-from-zero.md
// +optional
NodeInfo *NodeInfo `json:"nodeInfo,omitempty"`
}

// AWSMachineTemplateSpec defines the desired state of AWSMachineTemplate.
Expand All @@ -40,6 +78,7 @@ type AWSMachineTemplateSpec struct {
// +kubebuilder:object:root=true
// +kubebuilder:resource:path=awsmachinetemplates,scope=Namespaced,categories=cluster-api,shortName=awsmt
// +kubebuilder:storageversion
// +kubebuilder:subresource:status
// +k8s:defaulter-gen=true

// AWSMachineTemplate is the schema for the Amazon EC2 Machine Templates API.
Expand Down
20 changes: 20 additions & 0 deletions api/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,29 @@ spec:
This value is used for autoscaling from zero operations as defined in:
https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20210310-opt-in-autoscaling-from-zero.md
type: object
nodeInfo:
description: |-
NodeInfo contains information about the node's architecture and operating system.
This value is used for autoscaling from zero operations as defined in:
https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20210310-opt-in-autoscaling-from-zero.md
properties:
architecture:
description: |-
Architecture is the CPU architecture of the node.
Its underlying type is a string and its value can be any of amd64, arm64.
enum:
- amd64
- arm64
type: string
operatingSystem:
description: |-
OperatingSystem is a string representing the operating system of the node.
This may be a string like 'linux' or 'windows'.
type: string
type: object
type: object
type: object
served: true
storage: true
subresources:
status: {}
1 change: 1 addition & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ rules:
resources:
- awsclusters/status
- awsfargateprofiles/status
- awsmachinetemplates/status
- rosaclusters/status
- rosanetworks/status
- rosaroleconfigs/status
Expand Down
Loading