Complete State
This script defines the CompleteState class for managing the state of the Ankaios cluster.
Classes
- CompleteState:
Represents the complete state of the Ankaios cluster.
Usage
- Create a CompleteState instance:
complete_state = CompleteState()
- Get the API version of the complete state:
api_version = complete_state.get_api_version()
- Add a workload to the complete state:
complete_state.add_workload(workload)
- Get a workload from the complete state:
workload = complete_state.get_workload("nginx")
- Get the entire list of workloads from the complete state:
workloads = complete_state.get_workloads()
- Get the connected agents:
agents = complete_state.get_agents()
- Get the workload states:
workload_states = complete_state.get_workload_states()
- Create a CompleteState instance from a Manifest:
complete_state = CompleteState.from_manifest(manifest)
CompleteState Class
- class ankaios_sdk._components.complete_state.CompleteState[source]
Bases:
object
A class to represent the complete state.
- __str__()[source]
Returns the string representation of the complete state.
- Returns:
The string representation of the complete state.
- Return type:
str
- get_api_version()[source]
Gets the API version of the complete state.
- Returns:
The API version of the complete state.
- Return type:
str
- add_workload(workload)[source]
Adds a workload to the complete state.
- Parameters:
workload (Workload) – The workload to add.
- Return type:
None
- get_workload(workload_name)[source]
Gets a workload from the complete state by its name.
- Parameters:
workload_name (str) – The name of the workload to retrieve.
- Returns:
- The workload with the specified name,
or None if not found.
- Return type:
- get_workloads()[source]
Gets a list of workloads from the complete state.
- Returns:
A list of workloads in the complete state.
- Return type:
list[Workload]
- get_workload_states()[source]
Gets the workload states.
- Returns:
The collection of workload states.
- Return type:
- get_agents()[source]
Gets the connected agents and their attributes.
- Returns:
A dict with the agents and their attributes.
- Return type:
dict[str, dict]
- set_configs(configs)[source]
Sets the configurations in the complete state.
- Parameters:
configs (dict) – The configurations to set in the complete state.
- Return type:
None
- get_configs()[source]
Gets the configurations from the complete state.
- Returns:
The configurations from the complete state
- Return type:
dict