Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import hub in hosted mode #1059

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

ldpliu
Copy link
Contributor

@ldpliu ldpliu commented Aug 19, 2024

Summary

User could set an annotation import-cluster-in-hosted in mgh cr, then we will:
Use webhook to
1. add two annotations to new managedcluster:
2. update klusterletaddonconfig to disable application and policy related addons
Use controller to update clustermanagementconfig work-manager,cluster-proxy,managed-serviceaccount, will change default ns about them.

Related issue(s)

https://issues.redhat.com/browse/ACM-12718
Fixes #

Copy link

Please retry analysis of this Pull-Request directly on SonarCloud

@ldpliu ldpliu force-pushed the add-hosted-import branch from 9e7b640 to 6f91ea2 Compare August 19, 2024 05:58
Copy link

Please retry analysis of this Pull-Request directly on SonarCloud

@ldpliu ldpliu force-pushed the add-hosted-import branch from 6f91ea2 to 5af9ba9 Compare August 19, 2024 07:40
Copy link

Please retry analysis of this Pull-Request directly on SonarCloud

@ldpliu ldpliu force-pushed the add-hosted-import branch 5 times, most recently from ca4a4ef to a7850c9 Compare August 19, 2024 09:34
@stolostron stolostron deleted a comment from sonarqubecloud bot Aug 19, 2024
@stolostron stolostron deleted a comment from sonarqubecloud bot Aug 19, 2024
@stolostron stolostron deleted a comment from sonarqubecloud bot Aug 19, 2024
@ldpliu ldpliu force-pushed the add-hosted-import branch from a7850c9 to 69464b8 Compare August 19, 2024 10:20
Copy link

Please retry analysis of this Pull-Request directly on SonarCloud

@ldpliu ldpliu force-pushed the add-hosted-import branch 2 times, most recently from 1ac534c to 80146b4 Compare August 19, 2024 10:37
Copy link

Please retry analysis of this Pull-Request directly on SonarCloud

@ldpliu ldpliu force-pushed the add-hosted-import branch from 80146b4 to b5d433c Compare August 19, 2024 11:58
Copy link

Please retry analysis of this Pull-Request directly on SonarCloud

@ldpliu ldpliu force-pushed the add-hosted-import branch from b5d433c to 335d469 Compare August 19, 2024 13:01
Copy link

Please retry analysis of this Pull-Request directly on SonarCloud

@ldpliu ldpliu force-pushed the add-hosted-import branch 2 times, most recently from a44b82a to 2b1f4d0 Compare August 19, 2024 23:03
@ldpliu ldpliu force-pushed the add-hosted-import branch 2 times, most recently from cd97a8d to c32a1ae Compare August 20, 2024 00:00
@ldpliu
Copy link
Contributor Author

ldpliu commented Aug 20, 2024

/retest

@ldpliu ldpliu force-pushed the add-hosted-import branch from c32a1ae to 70cf3c9 Compare August 20, 2024 08:01
@ldpliu
Copy link
Contributor Author

ldpliu commented Aug 20, 2024

/retest

1 similar comment
@ldpliu
Copy link
Contributor Author

ldpliu commented Aug 21, 2024

/retest

@ldpliu
Copy link
Contributor Author

ldpliu commented Aug 21, 2024

/cc @clyang82 @yanmxa

@@ -698,10 +706,19 @@ spec:
memory: 100Mi
securityContext:
allowPrivilegeEscalation: false
volumeMounts:
- mountPath: /tmp/k8s-webhook-server/serving-certs
Copy link
Contributor

Choose a reason for hiding this comment

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

why do you mount to /tmp? It can be deleted automatically.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -19,7 +19,7 @@ List all annotations are used by multicluster global hub.
| global-hub.open-cluster-management.io/managed-by= | This annotation is used to identify which managed cluster is managed by which managed hub cluster. |
| global-hub.open-cluster-management.io/origin-ownerreference-uid= | This annotation is used to identify that the resource is from the global hub cluster. The global hub agent is only handled with the resource which has this annotation. |
| mgh-image-repository= | This annotation is used on the MCGH/MGH custom resource to identify a custom image repository. |

|import-cluster-in-hosted=true\|false | This annotation is used to identify if managedhub cluster should be imported in hosted mode |
Copy link
Contributor

Choose a reason for hiding this comment

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

I would like to use global-hub.open-cluster-management.io/ as prefix for our annotations

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -671,6 +677,10 @@ func (r *GlobalHubReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
return ctrl.Result{}, err
}

if err := r.webhookReconciler.Reconcile(ctx, mgh); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

move it into if config.IsACMResourceReady() {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -181,5 +181,5 @@ spec:
secretName: nonk8s-apiserver-cookie-secret
- name: webhook-certs
secret:
secretName: multicluster-global-hub-webhook-certs
secretName: multicluster-global-hub-global-webhook-certs
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe use multicluster-global-hub-manager-webhook-certs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

clientConfig:
service:
name: multicluster-global-hub-webhook
namespace: multicluster-global-hub
Copy link
Contributor

Choose a reason for hiding this comment

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

use {{.Namespace}} instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@ldpliu ldpliu force-pushed the add-hosted-import branch from 277efe4 to f173cb7 Compare August 29, 2024 04:39
Copy link

Copy link
Contributor

@clyang82 clyang82 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

openshift-ci bot commented Aug 29, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: clyang82, ldpliu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 47b787a into stolostron:main Aug 29, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants