prefect_kubernetes.utilities
Utilities for working with the Python Kubernetes API.
Functions
convert_manifest_to_model
Recursively converts a dict
representation of a Kubernetes resource to the
corresponding Python model containing the Python models that compose it,
according to the openapi_types
on the class retrieved with v1_model_name
.
If manifest
is a path-like object with a .yaml
or .yml
extension, it will be
treated as a path to a Kubernetes resource manifest and loaded into a dict
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
manifest |
Union[Path, str, KubernetesManifest]
|
A path to a Kubernetes resource manifest or its |
required |
v1_model_name |
str
|
The name of a Kubernetes client model to convert the manifest to. |
required |
Returns:
Type | Description |
---|---|
V1KubernetesModel
|
A populated instance of a Kubernetes client model with type |
Raises:
Type | Description |
---|---|
ValueError
|
If |
ValueError
|
If |
Source code in prefect_kubernetes/utilities.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
enable_socket_keep_alive
Setting the keep-alive flags on the kubernetes client object. Unfortunately neither the kubernetes library nor the urllib3 library which kubernetes is using internally offer the functionality to enable keep-alive messages. Thus the flags are added to be used on the underlying sockets.
Source code in prefect_kubernetes/utilities.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|