-
Notifications
You must be signed in to change notification settings - Fork 94
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
✨ Registration-agent supports multiple bootstrapkubeconfigs. #443
✨ Registration-agent supports multiple bootstrapkubeconfigs. #443
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we split this to two PRs. the first one only update the registration part.
...anager/olm-catalog/0.13.1/manifests/operator.open-cluster-management.io_clustermanagers.yaml
Outdated
Show resolved
Hide resolved
pkg/operator/operators/klusterlet/controllers/klusterletcontroller/klusterlet_controller.go
Outdated
Show resolved
Hide resolved
7115d11
to
51b4c3b
Compare
Yes, I have split the PR and now it only contains registration part. |
649f468
to
55d1b74
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #443 +/- ##
==========================================
- Coverage 62.71% 62.12% -0.59%
==========================================
Files 136 140 +4
Lines 11578 11728 +150
==========================================
+ Hits 7261 7286 +25
- Misses 3549 3670 +121
- Partials 768 772 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
4645a2a
to
3b52b6e
Compare
eeeee2a
to
73f58c6
Compare
2baf7de
to
fa7196e
Compare
pkg/registration/spoke/bootstrapkubeconfigsmanager/bootstrapkubeconfiginuse.go
Outdated
Show resolved
Hide resolved
pkg/registration/spoke/bootstrapkubeconfigsmanager/bootstrapkubeconfigsmanager.go
Outdated
Show resolved
Hide resolved
pkg/registration/spoke/bootstrapkubeconfigsmanager/bootstrapkubeconfig.go
Outdated
Show resolved
Hide resolved
pkg/registration/spoke/bootstrapkubeconfigsmanager/bootstrapkubeconfigsmanager.go
Outdated
Show resolved
Hide resolved
pkg/registration/spoke/bootstrapkubeconfigsmanager/bootstrapkubeconfiginuse.go
Outdated
Show resolved
Hide resolved
pkg/registration/spoke/bootstrapkubeconfigsmanager/bootstrapkubeconfiginuse.go
Outdated
Show resolved
Hide resolved
pkg/registration/spoke/bootstrapkubeconfigsmanager/bootstrapkubeconfigsmanager.go
Outdated
Show resolved
Hide resolved
fa7196e
to
fc574c1
Compare
f1102ed
to
294b8fa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
2 nit comment on test, but should not block merge. This is a good start. Great work!
gomega.Expect(err).NotTo(gomega.HaveOccurred()) | ||
} | ||
|
||
func assertManagedClusterSuccessfullyJoined(testNamespace, managedClusterName, hubKubeconfigSecret string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have an existing assert that already cover this ?
return agentCtx, stopAgent | ||
} | ||
|
||
func approveAndAcceptManagedCluster(managedClusterName string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have an existing helper that already did this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you mean this function?
assertSuccessClusterBootstrap := func(testNamespace, managedClusterName, hubKubeconfigSecret string, |
It's a closure function, and do multiple jobs in one function. The approveAndAcceptManagedCluster
and assertManagedClusterSuccessfullyJoined
is first and second parts from this function.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: qiujian16, xuezhaojun 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 |
/assign @zhujian7 |
pkg/registration/spoke/options.go
Outdated
BootstrapKubeconfigSecret string | ||
// The differences among BootstrapKubeconfig, BootstrapKubeconfigSecret, BootstrapKubeconfigSecrets are: | ||
// 1. BootstrapKubeconfig is a file path, the controller uses it to build the client. | ||
// 2. BootstrapKubeconfigSecret is the secret, a eventhandler will watch it, if the secret is changed, threbootstrap. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// 2. BootstrapKubeconfigSecret is the secret, a eventhandler will watch it, if the secret is changed, threbootstrap. | |
// 2. BootstrapKubeconfigSecret is the secret, an event handler will watch it, if the secret is changed, then rebootstrap. |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, fixed.
logger.Info("Lease timeout", "cluster", c.clusterName, "lease", leaseName) | ||
err := c.handleTimeout(ctx) | ||
if err != nil { | ||
logger.Error(err, "Failed to handle lease timeout", "cluster", c.clusterName, "lease", leaseName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we return the error here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The controller will reconcile every minute, it could be a timer actually. whether reconcile again on the error case doesn't matter, we have a TODO to implement the timeout feature in leaseController later on.
@xuezhaojun great work! |
294b8fa
to
5432c2d
Compare
…hub. Signed-off-by: xuezhaojun <zxue@redhat.com>
5432c2d
to
19f1f5c
Compare
@zhujian7 Thanks for the review! Code updated according to the comments, also need a /lgtm again. |
/hold |
I think we should have more UTs to cover #443 (comment) |
The score doesn't perfectly reflect the coverage, we have many lines of uncovered code are imports or construction functions like:
And intergration-test also covers some logic of the controller at the high level. |
/lgtm |
/unhold |
0357cb9
into
open-cluster-management-io:main
Summary
Klusterlet supports configure multiple bootstrapkubeconfigs and switch when hub doesn't accpet it or failed to connect to a hub.
Special Notes: