Skip to content

Commit ca67a57

Browse files
Fix review comments
1 parent 86fe072 commit ca67a57

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

api/v1beta2/awsmachinetemplate_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ import (
2525

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

3230
// Architecture constants.
@@ -47,10 +45,12 @@ const (
4745
type NodeInfo struct {
4846
// Architecture is the CPU architecture of the node.
4947
// Its underlying type is a string and its value can be any of amd64, arm64.
48+
// +kubebuilder:validation:Enum=amd64;arm64
5049
// +optional
5150
Architecture Architecture `json:"architecture,omitempty"`
5251
// OperatingSystem is a string representing the operating system of the node.
5352
// This may be a string like 'linux' or 'windows'.
53+
// +kubebuilder:validation:Enum=linux;windows
5454
// +optional
5555
OperatingSystem string `json:"operatingSystem,omitempty"`
5656
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,6 +1174,9 @@ spec:
11741174
description: |-
11751175
OperatingSystem is a string representing the operating system of the node.
11761176
This may be a string like 'linux' or 'windows'.
1177+
enum:
1178+
- linux
1179+
- windows
11771180
type: string
11781181
type: object
11791182
type: object

controllers/awsmachinetemplate_controller.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,17 @@ type AWSMachineTemplateReconciler struct {
5252
WatchFilterValue string
5353
}
5454

55+
// SetupWithManager sets up the controller with the Manager.
56+
func (r *AWSMachineTemplateReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
57+
log := logger.FromContext(ctx)
58+
59+
return ctrl.NewControllerManagedBy(mgr).
60+
For(&infrav1.AWSMachineTemplate{}).
61+
WithOptions(options).
62+
WithEventFilter(predicates.ResourceHasFilterLabel(mgr.GetScheme(), log.GetLogger(), r.WatchFilterValue)).
63+
Complete(r)
64+
}
65+
5566
// +kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=awsmachinetemplates,verbs=get;list;watch
5667
// +kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=awsmachinetemplates/status,verbs=get;update;patch
5768
// +kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=awsclusters,verbs=get;list;watch
@@ -363,14 +374,3 @@ func (r *AWSMachineTemplateReconciler) getKubernetesVersion(ctx context.Context,
363374

364375
return "", errors.New("no MachineDeployment or KubeadmControlPlane found referencing this AWSMachineTemplate with a version")
365376
}
366-
367-
// SetupWithManager sets up the controller with the Manager.
368-
func (r *AWSMachineTemplateReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
369-
log := logger.FromContext(ctx)
370-
371-
return ctrl.NewControllerManagedBy(mgr).
372-
For(&infrav1.AWSMachineTemplate{}).
373-
WithOptions(options).
374-
WithEventFilter(predicates.ResourceHasFilterLabel(mgr.GetScheme(), log.GetLogger(), r.WatchFilterValue)).
375-
Complete(r)
376-
}

0 commit comments

Comments
 (0)