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

Feat: clusteradm get klusterlet-info #143

Conversation

ycyaoxdu
Copy link
Member

@ycyaoxdu ycyaoxdu commented Mar 7, 2022

Signed-off-by: ycyaoxdu [email protected]

for issue: #133

this feature is a modification of #128

@openshift-ci openshift-ci bot requested review from itdove and qiujian16 March 7, 2022 09:18
@ycyaoxdu
Copy link
Member Author

ycyaoxdu commented Mar 7, 2022

@qiujian16 please help to review

@ycyaoxdu
Copy link
Member Author

ycyaoxdu commented Mar 7, 2022

╰─$ clusteradm get klusterlet-info --context kind-cluster1                                                                                                                                                    Registration Operator:
  Controller:   (3/3) <none>
  CustomResourceDefinition:
    (installed) klusterlets.operator.open-cluster-management.io
Components:
  Registration:
    Agent:      (1/1) quay.io/open-cluster-management/registration:v0.6.0
  Work:
    Webhook:    (1/1) quay.io/open-cluster-management/work:v0.6.0
  CustomResourceDefinition:
    (installed) appliedmanifestworks.work.open-cluster-management.io [*v1]
    (installed) clusterclaims.cluster.open-cluster-management.io [*v1alpha1]

pkg/cmd/get/klusterletinfo/exec.go Outdated Show resolved Hide resolved
pkg/cmd/get/klusterletinfo/exec.go Outdated Show resolved Hide resolved
pkg/cmd/get/klusterletinfo/exec.go Show resolved Hide resolved
)

func (o *Options) run() error {
// printing registration-operator
Copy link
Member

Choose a reason for hiding this comment

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

I think we should also consider showing the klusterlet API info here. There is some very helpful info like whether the klusterlet secret is correctly configured.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will we print the whole API info with the tree-style?

Copy link
Member Author

Choose a reason for hiding this comment

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

Or we just choose some to show? such as Spec.DeployOption, Status.Conditions?

Copy link
Member

Choose a reason for hiding this comment

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

I would think conditions at first. Actually since it has relatedObject and generations in the status. It probably should read resource from there first and then get the certain resources.

add common utility PrintComponentsCRD for cluster-manager/klusterlet to print crd

Signed-off-by: ycyaoxdu <[email protected]>
@ycyaoxdu ycyaoxdu force-pushed the feat/get-klusterlet-info branch from 706908e to 0aa7e82 Compare March 9, 2022 00:10
@ycyaoxdu
Copy link
Member Author

ycyaoxdu commented Mar 9, 2022

For now, the output looks like this:

╰─$ clusteradm get klusterlet-info --context kind-cluster1                                             
Klusterlet Conditions:
  Type:                 HubConnectionDegraded
  Status:               False
  LastTransitionTime:   2022-03-09 08:03:41 +0800 CST
  Reason:               HubConnectionFunctional
  Message:              Hub connection is functioning correctly

  Type:                 Applied
  Status:               True
  LastTransitionTime:   2022-03-07 17:53:17 +0800 CST
  Reason:               KlusterletApplied
  Message:              Klusterlet Component Applied

  Type:                 Available
  Status:               True
  LastTransitionTime:   2022-03-07 17:54:51 +0800 CST
  Reason:               klusterletAvailable
  Message:              deployments are ready: klusterlet-registration-agent,klusterlet-work-agent

  Type:                 RegistrationDesiredDegraded
  Status:               False
  LastTransitionTime:   2022-03-07 17:53:43 +0800 CST
  Reason:               DeploymentsFunctional
  Message:              deployments replicas are desired: 824649212184

  Type:                 WorkDesiredDegraded
  Status:               False
  LastTransitionTime:   2022-03-07 17:54:51 +0800 CST
  Reason:               DeploymentsFunctional
  Message:              deployments replicas are desired: 824649253144

Registration Operator:
  Controller:   (3/3) <none>
  CustomResourceDefinition:
    (installed) klusterlets.operator.open-cluster-management.io
Components:
  Registration:
    Agent:      (1/1) quay.io/open-cluster-management/registration:v0.6.0
  Work:
    Agent:      (1/1) quay.io/open-cluster-management/work:v0.6.0
  CustomResourceDefinition:
    (installed) appliedmanifestworks.work.open-cluster-management.io [*v1]
    (installed) clusterclaims.cluster.open-cluster-management.io [*v1alpha1]

@ycyaoxdu ycyaoxdu changed the title Feat: clusteradm get klusterlet-info WIP Feat: clusteradm get klusterlet-info Mar 9, 2022
@ycyaoxdu
Copy link
Member Author

ycyaoxdu commented Mar 9, 2022

For now, the output looks like this:

╰─$ clusteradm get klusterlet-info --context kind-cluster1                                             
Klusterlet Conditions:
  Type:                 HubConnectionDegraded
  Status:               False
  LastTransitionTime:   2022-03-09 08:03:41 +0800 CST
  Reason:               HubConnectionFunctional
  Message:              Hub connection is functioning correctly

  Type:                 Applied
  Status:               True
  LastTransitionTime:   2022-03-07 17:53:17 +0800 CST
  Reason:               KlusterletApplied
  Message:              Klusterlet Component Applied

  Type:                 Available
  Status:               True
  LastTransitionTime:   2022-03-07 17:54:51 +0800 CST
  Reason:               klusterletAvailable
  Message:              deployments are ready: klusterlet-registration-agent,klusterlet-work-agent

  Type:                 RegistrationDesiredDegraded
  Status:               False
  LastTransitionTime:   2022-03-07 17:53:43 +0800 CST
  Reason:               DeploymentsFunctional
  Message:              deployments replicas are desired: 824649212184

  Type:                 WorkDesiredDegraded
  Status:               False
  LastTransitionTime:   2022-03-07 17:54:51 +0800 CST
  Reason:               DeploymentsFunctional
  Message:              deployments replicas are desired: 824649253144

Registration Operator:
  Controller:   (3/3) <none>
  CustomResourceDefinition:
    (installed) klusterlets.operator.open-cluster-management.io
Components:
  Registration:
    Agent:      (1/1) quay.io/open-cluster-management/registration:v0.6.0
  Work:
    Agent:      (1/1) quay.io/open-cluster-management/work:v0.6.0
  CustomResourceDefinition:
    (installed) appliedmanifestworks.work.open-cluster-management.io [*v1]
    (installed) clusterclaims.cluster.open-cluster-management.io [*v1alpha1]

seems like other info are shown here except below 5: role rolebinding clusterrole clusterrolebinding serviceaccont.
will we show all these in output ?
@qiujian16

@ycyaoxdu ycyaoxdu changed the title WIP Feat: clusteradm get klusterlet-info Feat: clusteradm get klusterlet-info Mar 9, 2022
@ycyaoxdu ycyaoxdu force-pushed the feat/get-klusterlet-info branch from 0aa7e82 to eab7e7d Compare March 14, 2022 02:56
…mponentsCRD, printer.PrintComponentsDeploy to replace printComponentsDelpoyment.

Signed-off-by: ycyaoxdu <[email protected]>
@ycyaoxdu ycyaoxdu force-pushed the feat/get-klusterlet-info branch from eab7e7d to 02f2cf4 Compare March 14, 2022 02:58
@ycyaoxdu
Copy link
Member Author

add common utilities: printer.PrintComponentsDeploy and printer.PrintComponentsCRD.
and also modified command clusteradm get hub-info

Copy link
Member

@qiujian16 qiujian16 left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm

}

func (o *Options) printComponents() error {
klet, err := o.operatorClient.OperatorV1().
Copy link
Member

Choose a reason for hiding this comment

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

why get this again?

@openshift-ci
Copy link

openshift-ci bot commented Mar 15, 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 1a74a74 into open-cluster-management-io:main Mar 15, 2022
@ycyaoxdu ycyaoxdu deleted the feat/get-klusterlet-info branch March 15, 2022 07:51
@ycyaoxdu ycyaoxdu restored the feat/get-klusterlet-info branch March 15, 2022 08:12
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