Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /trisongz_lazyops /src /lazyops /configs /k8s.py
| """ | |
| K8s Configs | |
| """ | |
| import pathlib | |
| from typing import Optional, Union | |
| from lazyops.types.models import BaseSettings, validator | |
| from lazyops.types.classprops import lazyproperty | |
| class K8sSettings(BaseSettings): | |
| namespace: Optional[str] = None | |
| kubeconfig: Optional[Union[str, pathlib.Path]] = None | |
| kubernetes_service_host: Optional[str] = None | |
| kubernetes_service_port: Optional[int] = None | |
| def validate_kubeconfig(cls, v): | |
| if v is not None: return v | |
| from lazyops.utils.system import ( | |
| get_k8s_kubeconfig | |
| ) | |
| return get_k8s_kubeconfig() | |
| def validate_namespace(cls, v): | |
| if v is not None: return v | |
| from lazyops.utils.system import ( | |
| get_k8s_namespace | |
| ) | |
| return get_k8s_namespace() | |
| def in_k8s(self) -> bool: | |
| from lazyops.utils.system import ( | |
| is_in_kubernetes | |
| ) | |
| return is_in_kubernetes() | |
| def in_cluster(self) -> bool: | |
| return ( | |
| self.kubernetes_service_host is not None and self.kubernetes_service_port is not None | |
| ) or self.in_k8s | |
Xet Storage Details
- Size:
- 1.24 kB
- Xet hash:
- 16e56578d822e4f83d74e519e9f2197e36a14ba5cd7f94e808d4cb60c3286ab1
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.