Skip to content

Commit e679335

Browse files
Fix review comments 2
1 parent ddaf62c commit e679335

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

api/v1beta2/awsmachinetemplate_types.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,16 @@ const (
3333
ArchitectureArm64 Architecture = "arm64"
3434
)
3535

36+
// OperatingSystem represents the operating system of the node.
37+
// Its underlying type is a string and its value can be any of linux, windows.
38+
type OperatingSystem string
39+
3640
// Operating system constants.
3741
const (
3842
// OperatingSystemLinux represents the Linux operating system.
39-
OperatingSystemLinux = "linux"
43+
OperatingSystemLinux OperatingSystem = "linux"
4044
// OperatingSystemWindows represents the Windows operating system.
41-
OperatingSystemWindows = "windows"
45+
OperatingSystemWindows OperatingSystem = "windows"
4246
)
4347

4448
// NodeInfo contains information about the node's architecture and operating system.
@@ -48,11 +52,11 @@ type NodeInfo struct {
4852
// +kubebuilder:validation:Enum=amd64;arm64
4953
// +optional
5054
Architecture Architecture `json:"architecture,omitempty"`
51-
// OperatingSystem is a string representing the operating system of the node.
52-
// This may be a string like 'linux' or 'windows'.
55+
// OperatingSystem is the operating system of the node.
56+
// Its underlying type is a string and its value can be any of linux, windows.
5357
// +kubebuilder:validation:Enum=linux;windows
5458
// +optional
55-
OperatingSystem string `json:"operatingSystem,omitempty"`
59+
OperatingSystem OperatingSystem `json:"operatingSystem,omitempty"`
5660
}
5761

5862
// AWSMachineTemplateStatus defines a status for an AWSMachineTemplate.

config/crd/bases/infrastructure.cluster.x-k8s.io_awsmachinetemplates.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,8 +1172,8 @@ spec:
11721172
type: string
11731173
operatingSystem:
11741174
description: |-
1175-
OperatingSystem is a string representing the operating system of the node.
1176-
This may be a string like 'linux' or 'windows'.
1175+
OperatingSystem is the operating system of the node.
1176+
Its underlying type is a string and its value can be any of linux, windows.
11771177
enum:
11781178
- linux
11791179
- windows

controllers/awsmachinetemplate_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ func (r *AWSMachineTemplateReconciler) getNodeInfo(ctx context.Context, ec2Clien
288288
}
289289

290290
// getNodeInfoFromAMI queries the AMI to determine architecture and operating system.
291-
func (r *AWSMachineTemplateReconciler) getNodeInfoFromAMI(ctx context.Context, ec2Client *ec2.Client, amiID string) (infrav1.Architecture, string, error) {
291+
func (r *AWSMachineTemplateReconciler) getNodeInfoFromAMI(ctx context.Context, ec2Client *ec2.Client, amiID string) (infrav1.Architecture, infrav1.OperatingSystem, error) {
292292
input := &ec2.DescribeImagesInput{
293293
ImageIds: []string{amiID},
294294
}
@@ -325,7 +325,7 @@ func (r *AWSMachineTemplateReconciler) getNodeInfoFromAMI(ctx context.Context, e
325325
// 2. Check PlatformDetails field for Windows indication
326326
if os != infrav1.OperatingSystemWindows && image.PlatformDetails != nil {
327327
platformDetails := strings.ToLower(*image.PlatformDetails)
328-
if strings.Contains(platformDetails, infrav1.OperatingSystemWindows) {
328+
if strings.Contains(platformDetails, string(infrav1.OperatingSystemWindows)) {
329329
os = infrav1.OperatingSystemWindows
330330
}
331331
}

0 commit comments

Comments
 (0)