actionNetwork

set_loss

Trigger packet loss on a Pod network link

Activity as code

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

Typeaction
Modulechaosk8s.chaosmesh.network.actions
Nameset_loss
Returnmapping

Usage

JSON

{
  "name": "set-loss",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.chaosmesh.network.actions",
    "func": "set_loss",
    "arguments": {
      "name": ""
    }
  }
}

YAML

name: set-loss
provider:
  arguments:
    name: ''
  func: set_loss
  module: chaosk8s.chaosmesh.network.actions
  type: python
type: action

Arguments

NameTypeDefaultRequiredTitleDescription
namestringYesNameA unique name to identify this particular fault
directionstringtoNoDirectionWhich direction to apply the loss: from, to or both
lossstringYesProbabilityPacket loss probability between 0 and 100
correlationstringNoCorrelationHow much correlation compared to the previous loss. Between 0 and 100
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
external_targetsstringNoExternal TargetsIPv4 or domain targetted by the fault when direction is set to “to”
target_namespaces_selectorsstringNoTarget Namespaces SelectorsComma-separated list of namespaces to scope the fault to the right target pod. Only works when direction is set to both or from
target_label_selectorsstringNoTarget Label SelectorsComma-separated list of key=value pairs to scope the network fault to the right target pod. Only works when direction is set to both or from
target_annotations_selectorsstringNoTarget Annotation SelectorsComma-separated list of key=value pairs to scope the fault to the right target pod. Only works when direction is set to both or from
target_modestringoneNoTarget ModeTarget Mode of fault injection: one, all, fixed, fixed-percent, random-max-percent
target_mode_valuestringNoTarget Mode ValueValue depending on the mode above

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

Signature

def set_loss(name: str,
             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',
             loss: Optional[str] = None,
             correlation: Optional[str] = None,
             external_targets: Union[str, List[str], NoneType] = None,
             target_mode: Optional[str] = 'one',
             target_mode_value: Optional[str] = None,
             target_namespaces_selectors: Union[str, List[str],
                                                NoneType] = None,
             target_label_selectors: Union[str, Dict[str, Any],
                                           NoneType] = None,
             target_annotations_selectors: Union[str, Dict[str, Any],
                                                 NoneType] = None,
             secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass