actionMemory

stress_memory

Stress the memory of a Pod's container

Activity as code

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

Typeaction
Modulechaosk8s.chaosmesh.stress.actions
Namestress_memory
Returnmapping

Usage

JSON

{
  "name": "stress-memory",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.chaosmesh.stress.actions",
    "func": "stress_memory",
    "arguments": {
      "name": ""
    }
  }
}

YAML

name: stress-memory
provider:
  arguments:
    name: ''
  func: stress_memory
  module: chaosk8s.chaosmesh.stress.actions
  type: python
type: action

Arguments

NameTypeDefaultRequiredTitleDescription
namestringYesNameA unique name to identify this particular fault
container_namesstringNoContainer NamesComma-seperated list of container names to target
workersintegerYesWorkersNumber of worker threads that stress the memory
sizestringYesSizeTotal memory size to use, such as 256MB or 25%
time_to_get_to_sizestringNoTimeTime to take to fill the memory to the asked amount. Such as 10mn
durationstring30sNoDurationDuration of the stress, such as 30s
nsstringdefaultNoNamespaceNamespace where to apply the fault
namespaces_selectorsstringNoNamespaces SelectorsComma-separated list of namespaces to scope the fault to
label_selectorsstringNoLabel SelectorsComma-separated list of key=value pairs to scope the fault to
annotations_selectorsstringNoAnnotation SelectorsComma-separated list of key=value pairs to scope the fault to
modestringoneNoModeMode of fault injection: one, all, fixed, fixed-percent, random-max-percent
mode_valuestringNoMode ValueValue depending on the mode above
stressng_stressorsstringNoAdditional ParametersAdditional Stress-ng command line parameters

This action relies on Chaos Mesh to perform the fault. Make sure to install it before hand.

Signature

def stress_memory(name: str,
                  workers: Optional[int] = None,
                  size: Optional[str] = None,
                  oom_score: Optional[int] = None,
                  time_to_get_to_size: Optional[str] = None,
                  ns: str = 'default',
                  namespaces_selectors: Optional[str] = None,
                  label_selectors: Optional[str] = None,
                  annotations_selectors: Optional[str] = None,
                  mode: str = 'one',
                  mode_value: Optional[str] = None,
                  direction: str = 'to',
                  duration: str = '30s',
                  container_names: Union[str, List[str], NoneType] = None,
                  stressng_stressors: Optional[str] = None,
                  secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass