Skip to content

Commit 955bdda

Browse files
rebase #5720
1 parent ffdf7db commit 955bdda

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

api/v1beta1/zz_generated.conversion.go

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

api/v1beta2/awsmachinetemplate_types.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ type AWSMachineTemplateStatus struct {
7575

7676
// Conditions defines current service state of the AWSMachineTemplate.
7777
// +optional
78-
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
78+
Conditions clusterv1beta1.Conditions `json:"conditions,omitempty"`
7979
}
8080

8181
// AWSMachineTemplateSpec defines the desired state of AWSMachineTemplate.
@@ -119,12 +119,12 @@ type AWSMachineTemplateResource struct {
119119
}
120120

121121
// GetConditions returns the observations of the operational state of the AWSMachineTemplate resource.
122-
func (r *AWSMachineTemplate) GetConditions() clusterv1.Conditions {
122+
func (r *AWSMachineTemplate) GetConditions() clusterv1beta1.Conditions {
123123
return r.Status.Conditions
124124
}
125125

126-
// SetConditions sets the underlying service state of the AWSMachineTemplate to the predescribed clusterv1.Conditions.
127-
func (r *AWSMachineTemplate) SetConditions(conditions clusterv1.Conditions) {
126+
// SetConditions sets the underlying service state of the AWSMachineTemplate to the predescribed clusterv1beta1.Conditions.
127+
func (r *AWSMachineTemplate) SetConditions(conditions clusterv1beta1.Conditions) {
128128
r.Status.Conditions = conditions
129129
}
130130

controllers/awsmachinetemplate_controller.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ import (
4141
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/logger"
4242
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/record"
4343
"sigs.k8s.io/cluster-api-provider-aws/v2/util/paused"
44-
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
45-
controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta1"
44+
controlplanev1 "sigs.k8s.io/cluster-api/api/controlplane/kubeadm/v1beta2"
45+
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"
4646
"sigs.k8s.io/cluster-api/util"
4747
"sigs.k8s.io/cluster-api/util/predicates"
4848
)
@@ -176,7 +176,7 @@ func (r *AWSMachineTemplateReconciler) getRegion(ctx context.Context, cluster *c
176176
}
177177

178178
// Get region from AWSCluster (standard EC2-based cluster)
179-
if cluster.Spec.InfrastructureRef != nil && cluster.Spec.InfrastructureRef.Kind == "AWSCluster" {
179+
if cluster.Spec.InfrastructureRef.IsDefined() && cluster.Spec.InfrastructureRef.Kind == "AWSCluster" {
180180
awsCluster := &infrav1.AWSCluster{}
181181
if err := r.Get(ctx, client.ObjectKey{
182182
Namespace: cluster.Namespace,
@@ -191,7 +191,7 @@ func (r *AWSMachineTemplateReconciler) getRegion(ctx context.Context, cluster *c
191191
}
192192

193193
// Get region from AWSManagedControlPlane (EKS cluster)
194-
if cluster.Spec.ControlPlaneRef != nil && cluster.Spec.ControlPlaneRef.Kind == "AWSManagedControlPlane" {
194+
if cluster.Spec.ControlPlaneRef.IsDefined() && cluster.Spec.ControlPlaneRef.Kind == "AWSManagedControlPlane" {
195195
awsManagedCP := &ekscontrolplanev1.AWSManagedControlPlane{}
196196
if err := r.Get(ctx, client.ObjectKey{
197197
Namespace: cluster.Namespace,
@@ -373,9 +373,10 @@ func (r *AWSMachineTemplateReconciler) getKubernetesVersion(ctx context.Context,
373373

374374
// Find MachineDeployments that reference this AWSMachineTemplate
375375
for _, md := range machineDeploymentList.Items {
376-
if version := ptr.Deref(md.Spec.Template.Spec.Version, ""); md.Spec.Template.Spec.InfrastructureRef.Kind == "AWSMachineTemplate" &&
377-
md.Spec.Template.Spec.InfrastructureRef.Name == template.Name && version != "" {
378-
return version, nil
376+
if md.Spec.Template.Spec.InfrastructureRef.Kind == "AWSMachineTemplate" &&
377+
md.Spec.Template.Spec.InfrastructureRef.Name == template.Name &&
378+
md.Spec.Template.Spec.Version != "" {
379+
return md.Spec.Template.Spec.Version, nil
379380
}
380381
}
381382

@@ -387,8 +388,8 @@ func (r *AWSMachineTemplateReconciler) getKubernetesVersion(ctx context.Context,
387388

388389
// Find KubeadmControlPlanes that reference this AWSMachineTemplate
389390
for _, kcp := range kcpList.Items {
390-
if kcp.Spec.MachineTemplate.InfrastructureRef.Kind == "AWSMachineTemplate" &&
391-
kcp.Spec.MachineTemplate.InfrastructureRef.Name == template.Name &&
391+
if kcp.Spec.MachineTemplate.Spec.InfrastructureRef.Kind == "AWSMachineTemplate" &&
392+
kcp.Spec.MachineTemplate.Spec.InfrastructureRef.Name == template.Name &&
392393
kcp.Spec.Version != "" {
393394
return kcp.Spec.Version, nil
394395
}

0 commit comments

Comments
 (0)