-
Notifications
You must be signed in to change notification settings - Fork 68
refactor join command and add preflight check #291
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
refactor join command and add preflight check #291
Conversation
|
related issue: #274 |
ae8e9cf to
cba2d75
Compare
|
/assign @qiujian16 |
Signed-off-by: ycyaoxdu <yaoyuchen0626@163.com>
cba2d75 to
675a4b9
Compare
e8b4c39 to
373381f
Compare
pkg/helpers/client.go
Outdated
| //it searches in the kube-root-ca.crt configmap. | ||
| // GetCACert returns the CA cert. | ||
| // First by looking in the cluster-info configmap of the kube-public ns and if not found, | ||
| // it searches in the kube-root-ca.crt configmap. |
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.
it should return empty if kube-root-ca.crt configmap is not found also.
pkg/cmd/join/preflight/checks.go
Outdated
| if err != nil { | ||
| return nil, []error{err} | ||
| } | ||
| _, err = kubeClient.CertificatesV1().CertificateSigningRequests().List(context.TODO(), metav1.ListOptions{}) |
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.
maybe just check the version. Or check if it connects to a hub, by discovery?
Signed-off-by: ycyaoxdu <yaoyuchen0626@163.com>
373381f to
aa0ff26
Compare
pkg/cmd/join/preflight/checks.go
Outdated
| } | ||
| // validate ca | ||
| if c.Config.Clusters[0].Cluster.CertificateAuthorityData == nil { | ||
| return []error{errors.New("no ca detected, creating hub kubeconfig without ca")}, nil |
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.
is this an error or warning?
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.
this is an warning telling the user that the client has built up with no ca data. I think the user should make the decision whether use --ca-file to specify a ca file himself/herself in this condition @qiujian16
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.
but we return an error here.
| preflight.HubKubeconfigCheck{ | ||
| Config: o.HubConfig, | ||
| }, | ||
| preflight.KlusterletApiserverCheck{ |
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.
nit: should we put "check if it is hub" and "check if it is spoke" also as preflight check. Such that this can be used in each cmd? Won't be a blocker for this pr, but worth thinking.
Signed-off-by: ycyaoxdu <yaoyuchen0626@163.com>
pkg/cmd/join/preflight/checks.go
Outdated
| KlusterletApiserver string | ||
| } | ||
|
|
||
| func (c KlusterletApiserverCheck) Check() (warningList []error, errorList []error) { |
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 see what's going on here. But you may want warnings as a []string to avoid confusion.
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.
done
Signed-off-by: ycyaoxdu <yaoyuchen0626@163.com>
|
/lgtm |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: qiujian16, ycyaoxdu 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 |
Signed-off-by: ycyaoxdu yaoyuchen0626@163.com