probePod

count_pods

Count the number of pods matching the given selector

Activity as code

Below are the details and signature of the activity Python module.

Typeprobe
Modulechaosk8s.pod.probes
Namecount_pods
Returninteger

Usage

JSON

{
  "name": "count-pods",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.pod.probes",
    "func": "count_pods",
    "arguments": {
      "label_selector": ""
    }
  }
}

YAML

name: count-pods
provider:
  arguments:
    label_selector: ""
  func: count_pods
  module: chaosk8s.pod.probes
  type: python
type: probe

Arguments

NameTypeDefaultRequiredTitleDescription
nsstring“default”YesNamespace
label_selectorstringnullYesLabel SelectorSelectors to target the appropriate pods
phasestringnullNoPod PhasePod phase as defined by Kubernetes. If not provided, count all pods no matter their phase

Signature

def count_pods(label_selector: str,
               phase: str = None,
               ns: str = 'default',
               secrets: Dict[str, Dict[str, str]] = None) -> int:
    pass