Skip to content

Conversation

@ycyaoxdu
Copy link
Member

Signed-off-by: ycyaoxdu yaoyuchen0626@163.com

@ycyaoxdu
Copy link
Member Author

related issue: #274

@ycyaoxdu ycyaoxdu force-pushed the add-preflight branch 2 times, most recently from ae8e9cf to cba2d75 Compare December 1, 2022 04:44
@ycyaoxdu
Copy link
Member Author

ycyaoxdu commented Dec 2, 2022

/assign @qiujian16

Signed-off-by: ycyaoxdu <yaoyuchen0626@163.com>
@ycyaoxdu ycyaoxdu requested review from qiujian16 and removed request for qiujian16 and yue9944882 December 2, 2022 15:46
@ycyaoxdu ycyaoxdu changed the title add preflight check for join command refactor join command and add preflight check Dec 9, 2022
@ycyaoxdu ycyaoxdu requested a review from qiujian16 December 9, 2022 12:18
@ycyaoxdu ycyaoxdu changed the title refactor join command and add preflight check [wip]refactor join command and add preflight check Dec 9, 2022
@ycyaoxdu ycyaoxdu force-pushed the add-preflight branch 2 times, most recently from e8b4c39 to 373381f Compare December 13, 2022 07:43
@ycyaoxdu ycyaoxdu changed the title [wip]refactor join command and add preflight check refactor join command and add preflight check Dec 13, 2022
//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.
Copy link
Member

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.

if err != nil {
return nil, []error{err}
}
_, err = kubeClient.CertificatesV1().CertificateSigningRequests().List(context.TODO(), metav1.ListOptions{})
Copy link
Member

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>
}
// validate ca
if c.Config.Clusters[0].Cluster.CertificateAuthorityData == nil {
return []error{errors.New("no ca detected, creating hub kubeconfig without ca")}, nil
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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{
Copy link
Member

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>
@ycyaoxdu ycyaoxdu requested a review from qiujian16 December 19, 2022 09:47
KlusterletApiserver string
}

func (c KlusterletApiserverCheck) Check() (warningList []error, errorList []error) {
Copy link
Member

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.

Copy link
Member Author

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>
@ycyaoxdu ycyaoxdu requested review from qiujian16 and removed request for qiujian16 December 21, 2022 08:18
@qiujian16
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Dec 22, 2022
@qiujian16
Copy link
Member

/approve

@openshift-ci
Copy link

openshift-ci bot commented Dec 22, 2022

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit ee238ed into open-cluster-management-io:main Dec 22, 2022
@ycyaoxdu ycyaoxdu deleted the add-preflight branch February 13, 2023 15:04
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