actionGKE

swap_nodepool

Create a new nodepool, drain the old one so pods can be rescheduled on the new pool

Activity as code

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

Typeaction
Modulechaosgcp.gke.nodepool.actions
Nameswap_nodepool
Returnmapping

Usage

JSON

{
  "name": "swap-nodepool",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.gke.nodepool.actions",
    "func": "swap_nodepool",
    "arguments": {
      "old_node_pool_id": "",
      "new_nodepool_body": {}
    }
  }
}

YAML

name: swap-nodepool
provider:
  arguments:
    new_nodepool_body: {}
    old_node_pool_id: ""
  func: swap_nodepool
  module: chaosgcp.gke.nodepool.actions
  type: python
type: action

Arguments

NameTypeDefaultRequiredTitleDescription
old_node_pool_idstringYesCurrent Node Pool IdentifierName of the current nodepool to swap from
new_nodepool_bodymappingYesNew Node Pool IdentifierName of the new nodepool
delete_old_node_poolbooleanfalseNoDelete Current Node PoolWhether to also delete the current nodepool
drain_timeoutinteger120NoDrain TimeoutTime allowed to drain the nodes
wait_until_completebooleantrueNoWait Until CompleteWait until operation has completed

The old node pool is only deleted if delete_old_node_pool is set to True, which is not the default. Otherwise, the old node pool is left cordoned so it cannot be scheduled any longer.

Signature

def swap_nodepool(old_node_pool_id: str,
                  new_nodepool_body: Dict[str, Any],
                  wait_until_complete: bool = True,
                  delete_old_node_pool: bool = False,
                  drain_timeout: int = 120,
                  configuration: Dict[str, Dict[str, str]] = None,
                  secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass