Skip to content

Commit

Permalink
ACM-3283 : Introduce Hosted Mode (stolostron#1007)
Browse files Browse the repository at this point in the history
* Allow multiple MCH hosted instances in webhook

Signed-off-by: Jakob Gray <[email protected]>

* Introduce hosted mode support

Signed-off-by: Jakob Gray <[email protected]>

---------

Signed-off-by: Jakob Gray <[email protected]>
  • Loading branch information
JakobGray authored Apr 10, 2023
1 parent d19af67 commit 1485cec
Show file tree
Hide file tree
Showing 10 changed files with 635 additions and 21 deletions.
21 changes: 21 additions & 0 deletions api/v1/multiclusterhub_methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ func GetDefaultDisabledComponents() ([]string, error) {
return defaultDisabledComponents, nil
}

func GetDefaultHostedComponents() []string {
var defaultHostedComponents = []string{
MultiClusterEngine,
//Add other components here when added to hostedmode
}

return defaultHostedComponents
}

func (mch *MultiClusterHub) ComponentPresent(s string) bool {
if mch.Spec.Overrides == nil {
return false
Expand Down Expand Up @@ -197,3 +206,15 @@ func IsCommunity() (bool, error) {
return true, err
}
}

// IsInHostedMode returns true if mch is configured for hosted mode
func (mch *MultiClusterHub) IsInHostedMode() bool {
a := mch.GetAnnotations()
if a == nil {
return false
}
if a["deploymentmode"] == string(ModeHosted) {
return true
}
return false
}
5 changes: 5 additions & 0 deletions api/v1/multiclusterhub_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,16 @@ import (
// AvailabilityType ...
type AvailabilityType string

// DeploymentMode
type DeploymentMode string

const (
// HABasic stands up most app subscriptions with a replicaCount of 1
HABasic AvailabilityType = "Basic"
// HAHigh stands up most app subscriptions with a replicaCount of 2
HAHigh AvailabilityType = "High"
// ModeHosted deploys the MCH on a hosted virtual cluster
ModeHosted DeploymentMode = "Hosted"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
Expand Down
4 changes: 1 addition & 3 deletions controllers/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ func (r *MultiClusterHubReconciler) ensureUnstructuredResource(m *operatorv1.Mul
func (r *MultiClusterHubReconciler) ensureNamespace(m *operatorv1.MultiClusterHub, ns *corev1.Namespace) (ctrl.Result, error) {
ctx := context.Background()

r.Log.Info(fmt.Sprintf("Ensuring namespace: %s", ns.GetName()))

existingNS := &corev1.Namespace{}
err := r.Client.Get(ctx, types.NamespacedName{
Name: ns.GetName(),
Expand Down Expand Up @@ -575,7 +573,7 @@ func (r *MultiClusterHubReconciler) waitForMCEReady(ctx context.Context) (ctrl.R
return ctrl.Result{Requeue: true}, err
}
if existingMCE == nil {
r.Log.Info(fmt.Sprintf("Multiclusterengine: %s is not yet present", existingMCE.GetName()))
r.Log.Info(fmt.Sprintf("Multiclusterengine is not yet present"))
return ctrl.Result{Requeue: true}, nil
}
if utils.IsUnitTest() {
Expand Down
Loading

0 comments on commit 1485cec

Please sign in to comment.