Returns the runtime and orchestrator of a container. If neither value is present, the metadata client.env.container field will be omitted.
()
| 110 | |
| 111 | |
| 112 | def get_container_env_info() -> dict[str, str]: |
| 113 | """Returns the runtime and orchestrator of a container. |
| 114 | If neither value is present, the metadata client.env.container field will be omitted.""" |
| 115 | container = {} |
| 116 | |
| 117 | if Path(DOCKER_ENV_PATH).exists(): |
| 118 | container["runtime"] = RUNTIME_NAME_DOCKER |
| 119 | if os.getenv(ENV_VAR_K8S): |
| 120 | container["orchestrator"] = ORCHESTRATOR_NAME_K8S |
| 121 | |
| 122 | return container |
| 123 | |
| 124 | |
| 125 | def _is_lambda() -> bool: |