Skip to content

Commit

Permalink
Merge pull request #3670 from KodieGlosserIBM/kodie/disable-machine-c…
Browse files Browse the repository at this point in the history
…omponents-release-4.15

OCPBUGS-30281: [release-4.15] OCPBUGS-30102: Support to disable machine management components
  • Loading branch information
openshift-merge-bot[bot] committed Mar 6, 2024
2 parents 7c0eb70 + 63df113 commit 6c0a96b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 15 deletions.
3 changes: 3 additions & 0 deletions api/hypershift/v1beta1/hostedcluster_types.go
Expand Up @@ -222,6 +222,9 @@ const (
// components should be scheduled on dedicated nodes in the management cluster.
DedicatedRequestServingComponentsTopology = "dedicated-request-serving-components"

// DisableMachineManagement Disable deployments related to machine management that includes cluster-api, cluster-autoscaler, machine-approver.
DisableMachineManagement = "hypershift.openshift.io/disable-machine-management"

// AllowGuestWebhooksServiceLabel marks a service deployed in the control plane as a valid target
// for validating/mutating webhooks running in the guest cluster.
AllowGuestWebhooksServiceLabel = "hypershift.openshift.io/allow-guest-webhooks"
Expand Down
Expand Up @@ -1198,14 +1198,17 @@ func (r *HostedControlPlaneReconciler) reconcile(ctx context.Context, hostedCont
}
}

r.Log.Info("Reconciling autoscaler")
if err := r.reconcileAutoscaler(ctx, hostedControlPlane, releaseImageProvider, createOrUpdate); err != nil {
return fmt.Errorf("failed to reconcile autoscaler: %w", err)
}
// Disable machine management components if enabled
if _, exists := hostedControlPlane.Annotations[hyperv1.DisableMachineManagement]; !exists {
r.Log.Info("Reconciling autoscaler")
if err := r.reconcileAutoscaler(ctx, hostedControlPlane, releaseImageProvider, createOrUpdate); err != nil {
return fmt.Errorf("failed to reconcile autoscaler: %w", err)
}

r.Log.Info("Reconciling machine approver")
if err := r.reconcileMachineApprover(ctx, hostedControlPlane, releaseImageProvider, createOrUpdate); err != nil {
return fmt.Errorf("failed to reconcile machine approver: %w", err)
r.Log.Info("Reconciling machine approver")
if err := r.reconcileMachineApprover(ctx, hostedControlPlane, releaseImageProvider, createOrUpdate); err != nil {
return fmt.Errorf("failed to reconcile machine approver: %w", err)
}
}

r.Log.Info("Reconciling default security group")
Expand Down
Expand Up @@ -1620,15 +1620,18 @@ func (r *HostedClusterReconciler) reconcile(ctx context.Context, req ctrl.Reques
}
}

// Reconcile the CAPI manager components
err = r.reconcileCAPIManager(ctx, createOrUpdate, hcluster, hcp, pullSecretBytes)
if err != nil {
return ctrl.Result{}, fmt.Errorf("failed to reconcile capi manager: %w", err)
}
// Disable machine management components if enabled
if _, exists := hcluster.Annotations[hyperv1.DisableMachineManagement]; !exists {
// Reconcile the CAPI manager components
err = r.reconcileCAPIManager(ctx, createOrUpdate, hcluster, hcp, pullSecretBytes)
if err != nil {
return ctrl.Result{}, fmt.Errorf("failed to reconcile capi manager: %w", err)
}

// Reconcile the CAPI provider components
if err = r.reconcileCAPIProvider(ctx, createOrUpdate, hcluster, hcp, capiProviderDeploymentSpec, p); err != nil {
return ctrl.Result{}, fmt.Errorf("failed to reconcile capi provider: %w", err)
// Reconcile the CAPI provider components
if err = r.reconcileCAPIProvider(ctx, createOrUpdate, hcluster, hcp, capiProviderDeploymentSpec, p); err != nil {
return ctrl.Result{}, fmt.Errorf("failed to reconcile capi provider: %w", err)
}
}

// Get release image version
Expand Down Expand Up @@ -1774,6 +1777,7 @@ func reconcileHostedControlPlane(hcp *hyperv1.HostedControlPlane, hcluster *hype
hyperv1.EtcdPriorityClass,
hyperv1.EnsureExistsPullSecretReconciliation,
hyperv1.TopologyAnnotation,
hyperv1.DisableMachineManagement,
hyperv1.CertifiedOperatorsCatalogImageAnnotation,
hyperv1.CommunityOperatorsCatalogImageAnnotation,
hyperv1.RedHatMarketplaceCatalogImageAnnotation,
Expand Down

0 comments on commit 6c0a96b

Please sign in to comment.