Repository navigation
Add commands for event/secret data ingestion - #237
Conversation
0a9d91a to
834a06b
Compare
There was a problem hiding this comment.
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 eventsubcommands to create/list/delete benchmark Event objects. - Add
data secretsubcommands 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.
There was a problem hiding this comment.
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 eventsubcommands (add/list/delete) for generating labeled Event sets. - Add
data secretsubcommands (add/list/delete) for generating labeled Secret sets. - Refactor shared helpers into
contrib/cmd/runkperf/commands/data/client.goand 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. |
60d6e23 to
62fdb8d
Compare
There was a problem hiding this comment.
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 eventanddata secretcommand groups withadd/list/delworkflows, 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. |
a40aaa5 to
9ef6467
Compare
|
|
||
| padding := request.RandomPayload(size) | ||
|
|
||
| pod := &corev1.Pod{ |
There was a problem hiding this comment.
the pod is still schedulable to me. probably we need to add random and non-exist scheduler name, or add taint
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
could you please use option instead of using 10 argus in interface? thanks
There was a problem hiding this comment.
Yes now wrap these args to createOption
Fu Wei (fuweid)
left a comment
There was a problem hiding this comment.
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{ |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Sorry just saw your comment here. I added these together with other params to the createOption object. Does that look ok?
Fu Wei (@fuweid) thanks for the suggestion. I did below improvement accordingly:
I purposely did not touch existing |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
… with secrets and configmap commands
…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>
9442e6d to
a8dd7bb
Compare
Use fake.NewClientset to satisfy staticcheck SA1019. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
Extend
runkperf datawith Event, Secret, and Pod ingestion commands for API-server/etcd benchmarks, and consolidate common data-generation helpers.Changes
event,secret, andpodcommands withadd,list, anddelete(del) subcommands.--group-sizeto control concurrent creation and deletion requests.--qpsand--burstfor creation and deletion.--size: Event messages, Secret data, and Pod annotation padding.AppLabelconstant across data commands, including existing ConfigMap and DaemonSet commands.--group-sizeto exceed--totalfor Event, Secret, and ConfigMap creation.requestpackage.RandomPayloadand moveRandBytesfrom the data helpers.crypto/rand-backed implementation with unbiased alphanumeric sampling.data.RandStringcallers withrequest.RandomPayloadand userequest.RandBytesfor Secret data.RandomPayload's empty-string behavior for non-positive lengths and panic behavior on entropy-source errors; retain error returns forRandBytes.Validation
go test ./request ./contrib/cmd/runkperf/commands/data/...go test -race ./request -run 'Test(RandomPayload|RandBytes|RequestPatchBuilderRendersConcurrencySafe)$'git diff --checkNo live-cluster validation was performed.