actionNetwork

create_network_policy

Add a network policty

Activity as code

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

Typeaction
Modulechaosk8s.networking.actions
Namecreate_network_policy
Returnnone

Usage

JSON

{
  "name": "create-network-policy",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.networking.actions",
    "func": "create_network_policy"
  }
}

YAML

name: create-network-policy
provider:
  func: create_network_policy
  module: chaosk8s.networking.actions
  type: python
type: action

Arguments

NameTypeDefaultRequiredTitleDescription
nsstring“default”YesNamespace
specmappingnullNoNetwork Policy SpecificationJSON payload of a Kubernetes network policy
spec_pathstringnullNoNetwork Policy Specification FilePath to a YAML/JSON file containing a Kubernetes network policy. Either this one or the one above.

Create a network policy in the given namespace either from the definition as spec or from a file containing the definition at spec_path.

Signature

def create_network_policy(spec: Dict[str, Any] = None,
                          spec_path: str = None,
                          ns: str = 'default',
                          secrets: Dict[str, Dict[str, str]] = None):
    pass