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

Optimize some methods of dashboard #274

Merged
merged 37 commits into from
Apr 1, 2024

Conversation

powerfooI
Copy link
Collaborator

Summary

  1. Added UID for resource response and returned the exact type from handlers
  2. Added RBAC permission for dashboard to discover ob-operator deployment
  3. Fixed some typos and logic redundancy; generated documents
  4. Sorted results of listing OBCluster, OBZone and OBServer eliminating randomness due to k8s list
  5. Restricted OBCluster creation if there is obviously no enough resource for the pods

Conflicts:
	internal/resource/obtenant/obtenant_task.go
@powerfooI powerfooI self-assigned this Mar 29, 2024
@powerfooI powerfooI added the dashboard The issue or PR is related to oceanbase dashboard label Mar 29, 2024
Copy link
Member

@chris-sun-star chris-sun-star left a comment

Choose a reason for hiding this comment

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

is it possible to move resource validation into webhook, thus we don't need to reimpliment the same logic in dashboard

internal/dashboard/business/oceanbase/obcluster.go Outdated Show resolved Hide resolved
internal/dashboard/handler/info_handler.go Outdated Show resolved Hide resolved
@powerfooI
Copy link
Collaborator Author

powerfooI commented Mar 30, 2024

is it possible to move resource validation into webhook, thus we don't need to reimpliment the same logic in dashboard

I don't think it's reasonable to return error message thrown by webhook to dashboard users who do not even know the CRD structure. The error messages thrown from webhook are quite low level which describe the fields of underwater CRs.

powerfooI and others added 4 commits March 30, 2024 22:21
@powerfooI powerfooI requested a review from alv00 April 1, 2024 09:25
@alv00 alv00 merged commit 43c7f39 into oceanbase:master Apr 1, 2024
4 checks passed
@powerfooI powerfooI deleted the optimize/dashboard-api branch April 1, 2024 09:32
powerfooI added a commit to powerfooI/ob-operator that referenced this pull request Apr 1, 2024
commit 43c7f39
Author: powerfool <[email protected]>
Date:   Mon Apr 1 17:26:21 2024 +0800

    Optimize some methods of dashboard (oceanbase#274)

    * feat(term): added websocket connection for xterm connection

    * chore(handler): added UID for resource response; return resource from handlers

    * fix(info): adjust statistics routes

    * chore(manifests): added rbac permission for oceanbase-dashboard

    * fix(typo): fixed typo in operator comments

    * fix(timeout): increase timeout thres for bootstrapping

    Conflicts:
    	internal/resource/obtenant/obtenant_task.go

    * fix(obtenant): restore obtenant with mismatched fields pattern

    * feat(kube-exec): connect obcluster with websocket and kube exec

    * fix(lint): remove redundant equality judge

    * chore(docs): generate swagger docs

    * fix(lint): fixed lint errors

    * chore(websocket): increase websocket idle timeout from 5s to 10m

    * fix(ci): remove go mod tidy in .github/golangci-lint.yaml

    * fix(mod): update go.mod

    * fix(obcluster): prevent negtive remain resource

    * chore(generic): remove unexisting cmp.Order in golang 1.20

    * fix(obcluster): judge resource enough for obcluster; sort zones and servers

    * fix(handlers): added context for all contexts

    * fix(lint): unused parameter in funciton

    * fix(obcluster): concern monitor container when judging resource enough or not

    * fix(obtenant): sort results of listing tenants

    * fix(obcluster): sort results of listing obcluster

    * fix(obcluster): restrict locality principle when deleting obzone

    * fix(conn): connect to the target database through dashboard pod

    * chore(manifests): added mysql client installation in dashboard dockerfile

    * fix(lint): fixed lint error

    * chore(manifests): update swagger docs

    * chore(conn): removed conn-related apis for single-usage PR

    * chore(conn): update go.mod and dockerfile

    * fix(statistics): forbid to get resource with name and empty ns

    * fix(obcluster): restrict modifying obcluster when it is operating

    * Squashed commit of the following:

    commit 1871f64
    Author: yangon <[email protected]>
    Date:   Mon Apr 1 11:14:51 2024 +0800

        Trim string (oceanbase#276)

        * fix: Trim string fields
        * fix: Disabled delete button
        * fix: Remove backup medium editing

    * fix(CR): search ob-operator deployment with List method

commit 64f8b26
Author: yangon <[email protected]>
Date:   Mon Apr 1 16:57:05 2024 +0800

    Refactor url structure (oceanbase#277)

commit 1871f64
Author: yangon <[email protected]>
Date:   Mon Apr 1 11:14:51 2024 +0800

    Trim string (oceanbase#276)

    * fix: Trim string fields
    * fix: Disabled delete button
    * fix: Remove backup medium editing

commit b42863c
Author: yangon <[email protected]>
Date:   Sun Mar 31 13:17:23 2024 +0800

    Feat statistics (oceanbase#275)

    * feat: Statistics

    * fix: Padding ajustment

commit ccb5dbe
Author: Powerfool <[email protected]>
Date:   Fri Mar 29 14:53:05 2024 +0800

    Documentation website built with Docusaurus framework (oceanbase#273)

commit d57ad62
Author: yangon <[email protected]>
Date:   Thu Mar 28 21:13:57 2024 +0800

    Feat behaviour statistics

commit 8453102
Author: Powerfool <[email protected]>
Date:   Thu Mar 28 21:04:47 2024 +0800

    Merge from 2.2.0_release (oceanbase#272)

commit c4540ee
Author: Powerfool <[email protected]>
Date:   Thu Mar 28 19:36:50 2024 +0800

    Transform heading characters in logging sentence to uppercase (oceanbase#267)
powerfooI added a commit to powerfooI/ob-operator that referenced this pull request Apr 2, 2024
commit ae84363
Author: yangon <[email protected]>
Date:   Tue Apr 2 11:22:15 2024 +0800

    Fix resource pool related defects (oceanbase#279)

    * Fix resource pool related defects

    * fix:Avoid repeated requests for public keys

commit 43c7f39
Author: powerfool <[email protected]>
Date:   Mon Apr 1 17:26:21 2024 +0800

    Optimize some methods of dashboard (oceanbase#274)

    * feat(term): added websocket connection for xterm connection

    * chore(handler): added UID for resource response; return resource from handlers

    * fix(info): adjust statistics routes

    * chore(manifests): added rbac permission for oceanbase-dashboard

    * fix(typo): fixed typo in operator comments

    * fix(timeout): increase timeout thres for bootstrapping

    Conflicts:
    	internal/resource/obtenant/obtenant_task.go

    * fix(obtenant): restore obtenant with mismatched fields pattern

    * feat(kube-exec): connect obcluster with websocket and kube exec

    * fix(lint): remove redundant equality judge

    * chore(docs): generate swagger docs

    * fix(lint): fixed lint errors

    * chore(websocket): increase websocket idle timeout from 5s to 10m

    * fix(ci): remove go mod tidy in .github/golangci-lint.yaml

    * fix(mod): update go.mod

    * fix(obcluster): prevent negtive remain resource

    * chore(generic): remove unexisting cmp.Order in golang 1.20

    * fix(obcluster): judge resource enough for obcluster; sort zones and servers

    * fix(handlers): added context for all contexts

    * fix(lint): unused parameter in funciton

    * fix(obcluster): concern monitor container when judging resource enough or not

    * fix(obtenant): sort results of listing tenants

    * fix(obcluster): sort results of listing obcluster

    * fix(obcluster): restrict locality principle when deleting obzone

    * fix(conn): connect to the target database through dashboard pod

    * chore(manifests): added mysql client installation in dashboard dockerfile

    * fix(lint): fixed lint error

    * chore(manifests): update swagger docs

    * chore(conn): removed conn-related apis for single-usage PR

    * chore(conn): update go.mod and dockerfile

    * fix(statistics): forbid to get resource with name and empty ns

    * fix(obcluster): restrict modifying obcluster when it is operating

    * Squashed commit of the following:

    commit 1871f64
    Author: yangon <[email protected]>
    Date:   Mon Apr 1 11:14:51 2024 +0800

        Trim string (oceanbase#276)

        * fix: Trim string fields
        * fix: Disabled delete button
        * fix: Remove backup medium editing

    * fix(CR): search ob-operator deployment with List method

commit 64f8b26
Author: yangon <[email protected]>
Date:   Mon Apr 1 16:57:05 2024 +0800

    Refactor url structure (oceanbase#277)

commit 1871f64
Author: yangon <[email protected]>
Date:   Mon Apr 1 11:14:51 2024 +0800

    Trim string (oceanbase#276)

    * fix: Trim string fields
    * fix: Disabled delete button
    * fix: Remove backup medium editing

commit b42863c
Author: yangon <[email protected]>
Date:   Sun Mar 31 13:17:23 2024 +0800

    Feat statistics (oceanbase#275)

    * feat: Statistics

    * fix: Padding ajustment

commit ccb5dbe
Author: Powerfool <[email protected]>
Date:   Fri Mar 29 14:53:05 2024 +0800

    Documentation website built with Docusaurus framework (oceanbase#273)

commit d57ad62
Author: yangon <[email protected]>
Date:   Thu Mar 28 21:13:57 2024 +0800

    Feat behaviour statistics

commit 8453102
Author: Powerfool <[email protected]>
Date:   Thu Mar 28 21:04:47 2024 +0800

    Merge from 2.2.0_release (oceanbase#272)

commit c4540ee
Author: Powerfool <[email protected]>
Date:   Thu Mar 28 19:36:50 2024 +0800

    Transform heading characters in logging sentence to uppercase (oceanbase#267)
@chris-sun-star
Copy link
Member

is it possible to move resource validation into webhook, thus we don't need to reimpliment the same logic in dashboard

I don't think it's reasonable to return error message thrown by webhook to dashboard users who do not even know the CRD structure. The error messages thrown from webhook are quite low level which describe the fields of underwater CRs.

I just mean the validation logic can be reused, you can return a customized error message in dashboard

@powerfooI
Copy link
Collaborator Author

is it possible to move resource validation into webhook, thus we don't need to reimpliment the same logic in dashboard

I don't think it's reasonable to return error message thrown by webhook to dashboard users who do not even know the CRD structure. The error messages thrown from webhook are quite low level which describe the fields of underwater CRs.

I just mean the validation logic can be reused, you can return a customized error message in dashboard

It's true! Maybe we could extract complex CRD validation logic as an internal package. I'll do this in one of next few PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dashboard The issue or PR is related to oceanbase dashboard
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants