grafana / xk6-kubernetes

Client extension for interacting with Kubernetes clusters from your k6 tests.
Apache License 2.0
64 stars 21 forks source link

Add function for retrieving replicas (pods) of a deployment #63

Closed pablochacin closed 2 years ago

pablochacin commented 2 years ago

A very basic requirement when executing chaos tests on deployments is to act on one of replicas (for example, kill it). Even when it is possible to obtain the list of replicas by listing all pods in a namespace and filtering those that matches the label selector of the deployment, this in inconvenient.

Therefore, it would be convenient to have a function that, given a deployment, returns the existing list of pods. This function could optionally accept some flag(s) for common field selectors, such as state (e.g. to filter-out non running replicas)

pablochacin commented 2 years ago

This issue was initially proposed for supporting the injection of faults in the pods backing a Deployment However, this functionality should be rather implemented in the xk6-disruptor extension, as part of a DeploymentDisruptor class, similar to the ServiceDisrupor.