Skip to content

Add commands for event/secret data ingestion - #237

Merged
Fu Wei (fuweid) merged 20 commits into
mainfrom
maliyu/hyperscale-etcd
Oct 27, 2026
Merged

Fu Wei (fuweid) merged 20 commits into
mainfrom
maliyu/hyperscale-etcd

Conversation

@liyu-ma

@liyu-ma Liyu Ma (liyu-ma) commented Mar 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Extend runkperf data with Event, Secret, and Pod ingestion commands for API-server/etcd benchmarks, and consolidate common data-generation helpers.

Changes

  • Add event, secret, and pod commands with add, list, and delete (del) subcommands.
    • Use --group-size to control concurrent creation and deletion requests.
    • Page list requests in batches of 300 items when listing or discovering resources for deletion.
    • Support client-side rate limiting through --qps and --burst for creation and deletion.
    • Generate configurable payloads using --size: Event messages, Secret data, and Pod annotation padding.
    • Identify generated resource sets using labels.
  • Share namespace preparation and the AppLabel constant across data commands, including existing ConfigMap and DaemonSet commands.
  • Allow --group-size to exceed --total for Event, Secret, and ConfigMap creation.
  • Consolidate random payload generation in the request package.
    • Export RandomPayload and move RandBytes from the data helpers.
    • Share one crypto/rand-backed implementation with unbiased alphanumeric sampling.
    • Replace data.RandString callers with request.RandomPayload and use request.RandBytes for Secret data.
    • Preserve RandomPayload's empty-string behavior for non-positive lengths and panic behavior on entropy-source errors; retain error returns for RandBytes.
  • Add Pod ingestion tests and expand random-generation tests for payload lengths, allowed characters, invalid inputs, and concurrent use.

Validation

  • go test ./request ./contrib/cmd/runkperf/commands/data/...
  • go test -race ./request -run 'Test(RandomPayload|RandBytes|RequestPatchBuilderRendersConcurrencySafe)$'
  • git diff --check

No live-cluster validation was performed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR extends runkperf’s data command suite to support ingesting Kubernetes Events and Secrets, while refactoring shared Kubernetes client/namespace helpers into contrib/cmd/runkperf/commands/data/client.go for reuse across data subcommands.

Changes:

  • Add data event subcommands to create/list/delete benchmark Event objects.
  • Add data secret subcommands to create/list/delete benchmark Secret objects.
  • Refactor existing data commands to use shared client + namespace helpers, and centralize random data generation utilities.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
contrib/cmd/runkperf/commands/root.go Registers the new event and secret data subcommands.
contrib/cmd/runkperf/commands/data/events/event.go Implements event set creation, listing, and deletion (with rate limiting options).
contrib/cmd/runkperf/commands/data/secrets/secret.go Implements secret set creation, listing, and deletion (with rate limiting options).
contrib/cmd/runkperf/commands/data/daemonsets/daemonset.go Refactors to use centralized client + namespace helpers from data.
contrib/cmd/runkperf/commands/data/configmaps/configmap.go Refactors to use centralized helpers and shared random string generator.
contrib/cmd/runkperf/commands/data/client.go Adds PrepareNamespace() and shared random data helpers (RandBytes, RandString).
.gitignore Ignores .claude/ directory.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread contrib/cmd/runkperf/commands/data/events/event.go Outdated
Comment thread contrib/cmd/runkperf/commands/data/secrets/secret.go Outdated
Comment thread contrib/cmd/runkperf/commands/data/configmaps/configmap.go
Comment thread contrib/cmd/runkperf/commands/data/secrets/secret.go
Comment thread contrib/cmd/runkperf/commands/data/secrets/secret.go Outdated
Comment thread contrib/cmd/runkperf/commands/data/secrets/secret.go Outdated
Comment thread contrib/cmd/runkperf/commands/data/events/event.go
Comment thread contrib/cmd/runkperf/commands/data/client.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR extends runkperf data with new subcommands for generating and managing Kubernetes Event and Secret objects, while refactoring shared client/namespace helpers into the data package to reduce duplication across data-ingestion commands.

Changes:

  • Add data event subcommands (add/list/delete) for generating labeled Event sets.
  • Add data secret subcommands (add/list/delete) for generating labeled Secret sets.
  • Refactor shared helpers into contrib/cmd/runkperf/commands/data/client.go and update existing configmap/daemonset commands to use them.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
contrib/cmd/runkperf/commands/root.go Registers new data event and data secret subcommands.
contrib/cmd/runkperf/commands/data/secrets/secret.go Implements secret set add/list/delete with batching + pagination.
contrib/cmd/runkperf/commands/data/events/event.go Implements event set add/list/delete with batching + pagination.
contrib/cmd/runkperf/commands/data/daemonsets/daemonset.go Switches to shared data client + namespace helper functions.
contrib/cmd/runkperf/commands/data/configmaps/configmap.go Fixes label var name and switches to shared namespace/random helpers.
contrib/cmd/runkperf/commands/data/client.go Adds PrepareNamespace and random data helpers used across subcommands.
.gitignore Ignores .claude/ directory.

Comment thread contrib/cmd/runkperf/commands/data/secrets/secret.go Outdated
Comment thread contrib/cmd/runkperf/commands/data/secrets/secret.go Outdated
Comment thread contrib/cmd/runkperf/commands/data/events/event.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds new runkperf data subcommands for generating, listing, and deleting Kubernetes Event and Secret objects, while refactoring shared client/helpers into the data client utilities to reduce duplication across existing data commands.

Changes:

  • Introduce data event and data secret command groups with add/list/del workflows, including paging and configurable concurrency (--group-size).
  • Refactor shared helpers into contrib/cmd/runkperf/commands/data/client.go (namespace preparation + random payload generators) and migrate existing commands to use them.
  • Register new subcommands and update ignore rules for local tooling.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
contrib/cmd/runkperf/commands/root.go Registers the new events and secrets data subcommands under runkperf data.
contrib/cmd/runkperf/commands/data/events/event.go Implements data event add/list/del with paging and parallelism controls.
contrib/cmd/runkperf/commands/data/secrets/secret.go Implements data secret add/list/del with paging and parallelism controls.
contrib/cmd/runkperf/commands/data/daemonsets/daemonset.go Switches to shared data client helpers (rate-limited client + PrepareNamespace).
contrib/cmd/runkperf/commands/data/configmaps/configmap.go Switches to shared helpers (PrepareNamespace + RandString + shared AppLabel).
contrib/cmd/runkperf/commands/data/client.go Adds PrepareNamespace, RandString/RandBytes, and AppLabel constant.
.gitignore Ignores .claude/ directory.

Comment thread contrib/cmd/runkperf/commands/data/secrets/secret.go Outdated
Comment thread contrib/cmd/runkperf/commands/data/client.go

padding := request.RandomPayload(size)

pod := &corev1.Pod{

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

the pod is still schedulable to me. probably we need to add random and non-exist scheduler name, or add taint

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added the fake scheduler as suggested.

total int
}

func createEvents(clientset *kubernetes.Clientset, namespace, eventSetName string, total, groupSize int, reason, eventType string, messageSize int, involvedObjectKind, involvedObjectName string) error {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

could you please use option instead of using 10 argus in interface? thanks

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes now wrap these args to createOption

@fuweid Fu Wei (fuweid) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

there is a lot of duplicated logic among event, secret and pod, like pagination and batched deletion. also, the client type is not consistent: pod uses kubernetes.Interface, while event and secret use *kubernetes.Clientset. could you please extract the common logic and keep the interface consistent? thanks

"eventSetName": eventSetName,
},
},
InvolvedObject: corev1.ObjectReference{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would it make sense to group the InvolvedObject fields, EventType, and MessageSize into a struct and pass it in as an option? This could make the event configuration easier to extend and manage.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry just saw your comment here. I added these together with other params to the createOption object. Does that look ok?

@liyu-ma

Copy link
Copy Markdown
Contributor Author

there is a lot of duplicated logic among event, secret and pod, like pagination and batched deletion. also, the client type is not consistent: pod uses kubernetes.Interface, while event and secret use *kubernetes.Clientset. could you please extract the common logic and keep the interface consistent? thanks

Fu Wei (@fuweid) thanks for the suggestion. I did below improvement accordingly:

  • create shared operations.go to abstract common func such as batch delete and paginated list.
  • Use kubernetes.Interface for the added 3 types (better for mock in UT)

I purposely did not touch existing configmap and daemonset types to keep the scope intact. Can do another PR to consolidate these two if you see it needed.

liyu-microsoft and others added 7 commits October 26, 2026 23:35
…onfigmaps add commands

The batch loop already caps work with `j < total`, so groupSize larger than total just results in a single batch — the validation adds no value.
Add `runkperf data pod` (alias `po`) with add/delete/list subcommands
following the events/secrets pattern. Pods are bare unschedulable pause
containers padded via a runkperf.io/padding annotation (default 10 KiB)
to load the apiserver/etcd with pod objects. Includes unit tests using
a fake clientset.
Reuse crypto/rand-backed helpers across benchmark data commands and expand payload tests. Revert the branch-specific Claude ignore entry.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Standardize Event, Secret, and Pod helpers on kubernetes.Interface, group Event creation arguments into options, and add regression tests for shared operations and resource adapters.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use 64-bit atomic counters to satisfy gosec G115 checks.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use fake.NewClientset to satisfy staticcheck SA1019.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@fuweid
Fu Wei (fuweid) merged commit 9fca120 into main Oct 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants