Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -807,12 +807,15 @@ func (r *HostedClusterReconciler) Reconcile(ctx context.Context, req ctrl.Reques
}

// Reconcile the CAPI Cluster resource
capiCluster := controlplaneoperator.CAPICluster(controlPlaneNamespace.Name, hcluster.Spec.InfraID)
_, err = createOrUpdate(ctx, r.Client, capiCluster, func() error {
return reconcileCAPICluster(capiCluster, hcluster, hcp, infraCR)
})
if err != nil {
return ctrl.Result{}, fmt.Errorf("failed to reconcile capi cluster: %w", err)
// In the None platform case, there is no CAPI provider/resources so infraCR is nil
if infraCR != nil {
capiCluster := controlplaneoperator.CAPICluster(controlPlaneNamespace.Name, hcluster.Spec.InfraID)
_, err = createOrUpdate(ctx, r.Client, capiCluster, func() error {
return reconcileCAPICluster(capiCluster, hcluster, hcp, infraCR)
})
if err != nil {
return ctrl.Result{}, fmt.Errorf("failed to reconcile capi cluster: %w", err)
}
}

// Reconcile the HostedControlPlane kubeconfig if one is reported
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ func GetPlatform(hcluster *hyperv1.HostedCluster) (Platform, error) {
platform = aws.AWS{}
case hyperv1.IBMCloudPlatform:
platform = ibmcloud.IBMCloud{}
case hyperv1.NonePlatform:
platform = none.None{}
default:
return nil, fmt.Errorf("unsupported platform: %s", hcluster.Spec.Platform.Type)
}
Expand Down
2 changes: 2 additions & 0 deletions support/globalconfig/infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,7 @@ func ReconcileInfrastructure(infra *configv1.Infrastructure, hcp *hyperv1.Hosted
case hyperv1.IBMCloudPlatform:
infra.Status.PlatformStatus = &configv1.PlatformStatus{}
infra.Status.PlatformStatus.Type = configv1.IBMCloudPlatformType
case hyperv1.NonePlatform:
infra.Status.PlatformStatus = &configv1.PlatformStatus{}
Copy link
Member

@enxebre enxebre Dec 9, 2021

Choose a reason for hiding this comment

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

Please just set
infra.Status.PlatformStatus.Type = configv1.PlatformType(hcp.Spec.Platform.Type)
for any case, no need to discriminate by platform for that. Then for case hyperv1.AWSPlatform: keep setting the infra.Status.PlatformStatus.AWS specifics.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack thanks, I see that's already the default so I'll remove setting the Type

Copy link
Member

Choose a reason for hiding this comment

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

we can drop ibm/none specifics and just do:

infra.Status.PlatformStatus = &configv1.PlatformStatus{}
infra.Status.Platform = configv1.PlatformType(hcp.Spec.Platform.Type)

switch hcp.Spec.Platform.Type {
	case hyperv1.AWSPlatform:
		infra.Spec.PlatformSpec.AWS = &configv1.AWSPlatformSpec{}
		infra.Status.PlatformStatus.Type = configv1.AWSPlatformType
		infra.Status.PlatformStatus.AWS = &configv1.AWSPlatformStatus{
			Region: hcp.Spec.Platform.AWS.Region,
		}
		tags := []configv1.AWSResourceTag{}
		for _, tag := range hcp.Spec.Platform.AWS.ResourceTags {
			tags = append(tags, configv1.AWSResourceTag{
				Key:   tag.Key,
				Value: tag.Value,
			})
		}
		infra.Status.PlatformStatus.AWS.ResourceTags = tags

I'll do that in a follow up PR.

Copy link
Member

Choose a reason for hiding this comment

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

}
}