×

Hosted clusters are automatically imported into multicluster engine Operator after the hosted control plane becomes available.

Manually importing hosted clusters

If you want to import hosted clusters manually, complete the following steps.

Procedure
  1. In the console, click InfrastructureClusters and select the hosted cluster that you want to import.

  2. Click Import hosted cluster.

    For your discovered hosted cluster, you can also import from the console, but the cluster must be in an upgradable state. Import on your cluster is disabled if the hosted cluster is not in an upgradable state because the hosted control plane is not available. Click Import to begin the process. The status is Importing while the cluster receives updates and then changes to Ready.

Manually importing a hosted cluster on AWS

You can also import a hosted cluster on Amazon Web Services (AWS) with the command-line interface.

Procedure
  1. Create your ManagedCluster resource by using the following sample YAML file:

    apiVersion: cluster.open-cluster-management.io/v1
    kind: ManagedCluster
    metadata:
      annotations:
        import.open-cluster-management.io/hosting-cluster-name: local-cluster
        import.open-cluster-management.io/klusterlet-deploy-mode: Hosted
        open-cluster-management/created-via: hypershift
      labels:
        cloud: auto-detect
        cluster.open-cluster-management.io/clusterset: default
        name: <cluster_name>
        vendor: OpenShift
      name: <cluster_name>
    spec:
      hubAcceptsClient: true
      leaseDurationSeconds: 60

    Replace <cluster_name> with the name of your hosted cluster.

  2. Run the following command to apply the resource:

    $ oc apply -f <file_name>

    Replace <file_name> with the YAML file name you created in the previous step.

  3. If you have Red Hat Advanced Cluster Management installed, create your KlusterletAddonConfig resource by using the following sample YAML file. If you have installed multicluster engine Operator only, skip this step:

    apiVersion: agent.open-cluster-management.io/v1
    kind: KlusterletAddonConfig
    metadata:
      name: <cluster_name>
      namespace: <cluster_name>
    spec:
      clusterName: <cluster_name>
      clusterNamespace: <cluster_name>
      clusterLabels:
        cloud: auto-detect
        vendor: auto-detect
      applicationManager:
        enabled: true
      certPolicyController:
        enabled: true
      iamPolicyController:
        enabled: true
      policyController:
        enabled: true
      searchCollector:
        enabled: false

    Replace <cluster_name> with the name of your hosted cluster.

  4. Run the following command to apply the resource:

    $ oc apply -f <file_name>

    Replace <file_name> with the YAML file name you created in the previous step.

  5. After the import process is complete, your hosted cluster becomes visible in the console. You can also check the status of your hosted cluster by running the following command:

    $ oc get managedcluster <cluster_name>

Disabling the automatic import of hosted clusters into multicluster engine Operator

Hosted clusters are automatically imported into multicluster engine Operator after the control plane becomes available. If needed, you can disable the automatic import of hosted clusters.

Any hosted clusters that were previously imported are not affected, even if you disable automatic import. When you upgrade to multicluster engine Operator 2.5 and automatic import is enabled, all hosted clusters that are not imported are automatically imported if their control planes are available.

If Red Hat Advanced Cluster Management is installed, all Red Hat Advanced Cluster Management add-ons are also enabled.

When automatic import is disabled, only newly created hosted clusters are not automatically imported. Hosted clusters that were already imported are not affected. You can still manually import clusters by using the console or by creating the ManagedCluster and KlusterletAddonConfig custom resources.

Procedure

To disable the automatic import of hosted clusters, complete the following steps:

  1. On the hub cluster, open the hypershift-addon-deploy-config specification that is in the AddonDeploymentConfig resource in the namespace where multicluster engine Operator is installed by entering the following command:

    $ oc edit addondeploymentconfig hypershift-addon-deploy-config -n multicluster-engine
  2. In the spec.customizedVariables section, add the autoImportDisabled variable with value of "true", as shown in the following example:

    apiVersion: addon.open-cluster-management.io/v1alpha1
    kind: AddOnDeploymentConfig
    metadata:
      name: hypershift-addon-deploy-config
      namespace: multicluster-engine
    spec:
      customizedVariables:
       - name: hcMaxNumber
         value: "80"
      - name: hcThresholdNumber
        value: "60"
      - name: autoImportDisabled
        value: "true"
  3. To re-enable automatic import, set the value of the autoImportDisabled variable to "false" or remove the variable from the AddonDeploymentConfig resource.