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

✨ Add importer into registraiton #753

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

qiujian16
Copy link
Member

Summary

Related issue(s)

Fixes #

/hold

@openshift-ci openshift-ci bot requested review from elgnay and skeeey December 9, 2024 05:35
@openshift-ci openshift-ci bot added the approved label Dec 9, 2024
@qiujian16 qiujian16 force-pushed the importer branch 2 times, most recently from 249dbc8 to 9ee219c Compare December 9, 2024 06:00
Copy link

codecov bot commented Dec 9, 2024

Codecov Report

Attention: Patch coverage is 58.22454% with 160 lines in your changes missing coverage. Please review.

Project coverage is 63.46%. Comparing base (ddc5024) to head (e645d30).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
pkg/registration/hub/importer/importer.go 51.70% 75 Missing and 10 partials ⚠️
...gistration/hub/importer/providers/capi/provider.go 49.45% 41 Missing and 5 partials ⚠️
pkg/registration/hub/importer/renderers.go 80.00% 9 Missing and 4 partials ⚠️
...g/registration/hub/importer/providers/interface.go 47.82% 8 Missing and 4 partials ⚠️
pkg/registration/hub/importer/options/options.go 40.00% 3 Missing ⚠️
pkg/registration/hub/manager.go 95.65% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #753      +/-   ##
==========================================
- Coverage   63.58%   63.46%   -0.13%     
==========================================
  Files         187      192       +5     
  Lines       17989    18372     +383     
==========================================
+ Hits        11439    11659     +220     
- Misses       5601     5740     +139     
- Partials      949      973      +24     
Flag Coverage Δ
unit 63.46% <58.22%> (-0.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

openshift-ci bot commented Dec 10, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qiujian16

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

Signed-off-by: Jian Qiu <[email protected]>
Signed-off-by: Jian Qiu <[email protected]>
}
}
if provider == nil {
logger.V(4).Info("provider not found for cluster", "cluster", cluster.Name)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
logger.V(4).Info("provider not found for cluster", "cluster", cluster.Name)
logger.Info("provider not found for cluster", "cluster", cluster.Name)

Copy link
Member Author

Choose a reason for hiding this comment

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

maybe V(2), otherwise when we enable the controller, this logs will always be printed since it watches managedCluster

const (
operatorNamesapce = "open-cluster-management"
bootstrapSA = "cluster-bootstrap"
ConditionTypeImported = "Imported"
Copy link
Member

Choose a reason for hiding this comment

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

We have the condition ManagedClusterJoined and ManagedClusterConditionAvailable, consider changing this to ManagedClusterImported or ManagedClusterConditionImported

result.Result, result.Changed, result.Error = resourceapply.ApplyDeployment(
ctx, clients.KubeClient.AppsV1(), recorder, t, 0)
results = append(results, result)
case *operatorv1.Klusterlet:
Copy link
Member

Choose a reason for hiding this comment

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

Here I don't quite understand why we handle the Deployment and Klusterlet separately, instead of using the resourceapply.ApplyDirectly?

Copy link
Member Author

Choose a reason for hiding this comment

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

it only support ApplyDirectly only can apply certain static resource, deployment/klusterlet can do be applied with this func.

// into the queue with the name of the managed cluster
Register(syncCtx factory.SyncContext)

// Run starts the provider
Copy link
Member

Choose a reason for hiding this comment

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

It is better to add more details for the Run comment, I don't know what I should do from the current comment to implement the Run.


// Interface is the interface that a cluster provider should implement
type Interface interface {
// Clients is to return the client to connect to the target cluster.
Copy link
Member

Choose a reason for hiding this comment

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

Should we add some comments about what permission the returned client should have?

@zhujian7
Copy link
Member

👍🏻 LGTM, left some nit comments.

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.

2 participants