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

Add augerctl like kubectl #62

Closed
wants to merge 1 commit into from

Conversation

wzshiming
Copy link
Member

@wzshiming wzshiming commented May 22, 2024

Fixes #3

Test

Preparation cluster

Create a cluster and expose etcd port, to facilitate the creation of a cluster using kwokctl, this can be any other k8s cluster

# brew install kwok
kwokctl create cluster --etcd-port 2379

Get a single resource

Get the kubernetes.default service

go run ./cmd/augerctl get services -n default kubernetes

Get the all of the resource

go run ./cmd/augerctl get leases -n kube-system

Get the all of the etcd

go run ./cmd/augerctl get

Modify immutable data

# change the creation time to very long ago
go run ./cmd/augerctl get services -n default kubernetes | sed 's/creationTimestamp: .*/creationTimestamp: "2006-01-02T15:04:05Z"/' | go run ./cmd/augerctl put --path -
kubectl get services -n default kubernetes

Maybe patch subcommands can be added in the future

Delete data

go run ./cmd/augerctl del services -n default kubernetes

cmd/ctl/main.go Outdated Show resolved Hide resolved
pkg/ctl/command/get/get.go Outdated Show resolved Hide resolved
pkg/ctl/ctl.go Outdated Show resolved Hide resolved
@wzshiming wzshiming changed the title [WIP] Support command like kubectl [WIP] Support subcommand like kubectl May 22, 2024
@wzshiming
Copy link
Member Author

/assign @jmhbnz
/assign @siyuanfoundation

This PR is expected to add a subcommand like kubectl to manipulate etcd data, do you guys have time to take a look at it and leave suggestions and comments to guide this forward?

@wzshiming wzshiming force-pushed the feat/kubectl-like branch 2 times, most recently from 28c7dd1 to 99c4fe5 Compare May 22, 2024 10:15
pkg/ctl/command/global.go Outdated Show resolved Hide resolved
cmd/ctl/main.go Outdated Show resolved Hide resolved
@wzshiming wzshiming force-pushed the feat/kubectl-like branch 7 times, most recently from 0e12fa6 to 9630434 Compare May 23, 2024 03:18
@wzshiming wzshiming mentioned this pull request May 23, 2024
@wzshiming wzshiming force-pushed the feat/kubectl-like branch 6 times, most recently from a6e0c9b to 8bb63f4 Compare May 24, 2024 04:26
@wzshiming wzshiming changed the title [WIP] Support subcommand like kubectl Support ctl subcommand like kubectl May 27, 2024
@wzshiming
Copy link
Member Author

wzshiming commented Jul 19, 2024

Hi @jmhbnz @siyuanfoundation

Is it out of scope?
So I'm alternatively planning to make this a separate project, would it be OK to call it augerctl or kectl(Kubernetes Etcd ctl)?

@siyuanfoundation
Copy link
Contributor

I think it's a good idea. 'augerctl' sounds good.

Can you break up the PR to smaller pieces so that they are easier to review?

Thank you!

@wzshiming wzshiming force-pushed the feat/kubectl-like branch from 8bb63f4 to 31c3630 Compare July 22, 2024 03:04
@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: wzshiming
Once this PR has been reviewed and has the lgtm label, please ask for approval from jmhbnz. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@wzshiming wzshiming force-pushed the feat/kubectl-like branch 2 times, most recently from 2ab0a1a to d1d50bb Compare July 22, 2024 03:09
@wzshiming wzshiming changed the title Support ctl subcommand like kubectl Add augerctl like kubectl Jul 22, 2024
@wzshiming wzshiming force-pushed the feat/kubectl-like branch 2 times, most recently from 59f3fb2 to 800a42b Compare July 22, 2024 03:19
@wzshiming
Copy link
Member Author

wzshiming commented Jul 22, 2024

Ahhh, I don't know how much more this can be split, it's already the smallest possible implementation of the tool.
I understand your concern that this merge will mess up the current codebase.
So I create a new repo https://github.com/wzshiming/kectl, and make it stable, and then propose it to the sig-etcd.
WDYT?

@siyuanfoundation
Copy link
Contributor

Ahhh, I don't know how much more this can be split, it's already the smallest possible implementation of the tool. I understand your concern that this merge will mess up the current codebase. So I create a new repo https://github.com/wzshiming/kectl, and make it stable, and then propose it to the sig-etcd. WDYT?

Examples of how to breaking up the PR could be

  1. 1 PR for get
  2. 1 PR for delete
  3. ...

Yes, I think the idea could be worth discussing in sig-etcd meeting.

@wzshiming wzshiming mentioned this pull request Jul 27, 2024
@wzshiming wzshiming marked this pull request as draft July 27, 2024 08:40
@wzshiming
Copy link
Member Author

Ahhh, I don't know how much more this can be split, it's already the smallest possible implementation of the tool. I understand your concern that this merge will mess up the current codebase. So I create a new repo https://github.com/wzshiming/kectl, and make it stable, and then propose it to the sig-etcd. WDYT?

Examples of how to breaking up the PR could be

  1. 1 PR for get
  2. 1 PR for delete
  3. ...

I've created a new PR for the get and removed optional features. #82

Signed-off-by: Shiming Zhang <[email protected]>
@jmhbnz
Copy link
Member

jmhbnz commented Aug 14, 2024

Closed in favor of #82

@jmhbnz jmhbnz closed this Aug 14, 2024
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.

Migrate the etcd implementations of the operations to here
4 participants