Manifest
This module defines the Manifest class for handling ankaios manifests.
Classes
- Manifest:
Represents a workload manifest and provides methods to validate and load it.
Usage
- Load a manifest from a file:
manifest = Manifest.from_file("path/to/manifest.yaml")
- Load a manifest from a string:
manifest = Manifest.from_string("apiVersion: 1.0\nworkloads: {}")
- Load a manifest from a dictionary:
manifest = Manifest.from_dict({"apiVersion": "1.0", "workloads": {}})
Manifest Class
- class ankaios_sdk._components.manifest.Manifest(desired_state)[source]
Bases:
object
Represents a workload manifest. The manifest can be loaded from a yaml file, string or dictionary.
- __init__(desired_state)[source]
Initializes a Manifest instance with the given manifest data. For creation, it is recommended to use the from_file, from_string or from_dict methods. The manifest data is validated upon initialization.
- Parameters:
desired_state (_ank_base.State) – The desired state proto.
- Raises:
ValueError – If the manifest data is invalid.
- static from_file(file_path)[source]
Loads a manifest from a file.
- Parameters:
file_path (str) – The path to the manifest file.
- Returns:
An instance of the Manifest class with the loaded data.
- Return type:
- Raises:
FileNotFoundError – If the file does not exist.
yaml.YAMLError – If there is an error parsing the YAML file.
- static from_string(manifest)[source]
Creates a Manifest instance from a YAML string.
- Parameters:
manifest (str) – The YAML string representing the manifest.
- Returns:
An instance of the Manifest class with the parsed data.
- Return type:
- Raises:
ValueError – If there is an error parsing the YAML string.