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

[kwokctl] Support k8s format for snapshot #381

Merged
merged 1 commit into from
Mar 31, 2023

Conversation

wzshiming
Copy link
Member

@wzshiming wzshiming commented Mar 16, 2023

What type of PR is this?

/kind feature

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #32

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Support k8s format for snapshot

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 16, 2023
@netlify
Copy link

netlify bot commented Mar 16, 2023

Deploy Preview for k8s-kwok canceled.

Name Link
🔨 Latest commit 5a9e9e4
🔍 Latest deploy log https://app.netlify.com/sites/k8s-kwok/deploys/64184259f08bff000717a906

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wzshiming

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

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Mar 16, 2023
@k8s-ci-robot k8s-ci-robot requested a review from yibozhuang March 16, 2023 04:33
@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 16, 2023
@wzshiming wzshiming force-pushed the feat/snapshot-yaml branch 18 times, most recently from ce9d959 to ea6f378 Compare March 16, 2023 07:55
@wzshiming wzshiming changed the title [WIP] Add snapshot with yaml [WIP] Support yaml format for snapshot Mar 16, 2023
@wzshiming wzshiming force-pushed the feat/snapshot-yaml branch 3 times, most recently from 91116f9 to 7ef2f37 Compare March 16, 2023 08:33
@wzshiming wzshiming force-pushed the feat/snapshot-yaml branch 12 times, most recently from e828375 to 08d503d Compare March 17, 2023 07:00
@wzshiming wzshiming changed the title [WIP] Support yaml format for snapshot Support yaml format for snapshot Mar 17, 2023
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 17, 2023
@wzshiming wzshiming changed the title Support yaml format for snapshot Support k8s format for snapshot Mar 17, 2023
@wzshiming wzshiming force-pushed the feat/snapshot-yaml branch from 08d503d to 9ab2a0e Compare March 17, 2023 11:07
@wzshiming wzshiming changed the title Support k8s format for snapshot [kwokctl] Support k8s format for snapshot Mar 20, 2023
@wzshiming wzshiming force-pushed the feat/snapshot-yaml branch from 9ab2a0e to 2cbe85c Compare March 20, 2023 11:15
@wzshiming wzshiming force-pushed the feat/snapshot-yaml branch from 2cbe85c to 5a9e9e4 Compare March 20, 2023 11:24
@wzshiming wzshiming merged commit 4dee933 into kubernetes-sigs:main Mar 31, 2023
@wzshiming wzshiming deleted the feat/snapshot-yaml branch March 31, 2023 02:56

// Save saves the snapshot of cluster
func Save(ctx context.Context, rt Runtime, w io.Writer, filters []string) error {
err := rt.KubectlInCluster(exec.WithWriteTo(ctx, w), "get", strings.Join(filters, ","), "-o=yaml", "--all-namespaces")
Copy link
Contributor

Choose a reason for hiding this comment

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

in practice, it's likely to fail due to hitting QPS limits, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've tried the latest kubectl, which supports chunking without failing even with very large amounts of data.

However, the QPS limit causes it to be really slow, so I will try to remove the client/server QPS limit in the future to make this work better.

--chunk-size 500  Return large lists in chunks rather than all at once. Pass 0 to disable. This flag is beta and may change in the future.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's put it to this week's meeting discussion. My understanding is that --chunk-size is not the same thing as "client-go's paged query utility" (where it can define pageSize and retry logic programmatically), so IMO the latter impl. is what we need to pursue.

Copy link
Member Author

@wzshiming wzshiming Apr 4, 2023

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that is correct. In my local fork, I utilized client-go's paged query to take a snapshot of the API objects. I had planned to contribute it back for really a while... hopefully I can find some time to make it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[kwokctl] Support k8s format for snapshot
3 participants