airflow.providers.cncf.kubernetes.pod_generator_deprecated
¶
Pod 產生的向後相容性。
此模組提供先前的 Pod API 之間的介面,並輸出 kubernetes.client.models.V1Pod。優點是支援完整的 Kubernetes API,且無需編寫序列化。
模組內容¶
類別¶
Pod 的靜態預設值。 |
|
包含 Kubernetes Airflow Worker 組態邏輯。 |
函數¶
|
正規化提供的標籤以使其長度和字元有效。 |
屬性¶
- airflow.providers.cncf.kubernetes.pod_generator_deprecated.make_safe_label_value(string)[source]¶
正規化提供的標籤以使其長度和字元有效。
有效的標籤值必須少於或等於 63 個字元,且必須為空或以英數字元 ([a-z0-9A-Z]) 開頭和結尾,中間可以是破折號 (-)、底線 (_)、點 (.) 和英數字元。
如果標籤值在安全化後大於 63 個字元,或與傳送至此函數的原始值有任何差異,則我們需要截斷為 53 個字元,並附加唯一的雜湊值。
- class airflow.providers.cncf.kubernetes.pod_generator_deprecated.PodGenerator(image=None, name=None, namespace=None, volume_mounts=None, envs=None, cmds=None, args=None, labels=None, node_selectors=None, ports=None, volumes=None, image_pull_policy=None, restart_policy=None, image_pull_secrets=None, init_containers=None, service_account_name=None, resources=None, annotations=None, affinity=None, hostnetwork=False, tolerations=None, security_context=None, configmaps=None, dnspolicy=None, schedulername=None, extract_xcom=False, priority_class_name=None)[source]¶
包含 Kubernetes Airflow Worker 組態邏輯。
表示 Kubernetes Pod 並管理單個 Pod 的執行。任何容器特定的組態都會套用至容器列表中的第一個容器。
- 參數
image (str | None) – Docker 映像檔
name (str | None) – metadata 區段中的名稱(非容器名稱)
namespace (str | None) – Pod 命名空間
volume_mounts (list[kubernetes.client.models.V1VolumeMount | dict] | None) – Kubernetes 卷宗掛載列表
ports (list[kubernetes.client.models.V1ContainerPort | dict] | None) – 埠列表。適用於第一個容器。
volumes (list[kubernetes.client.models.V1Volume | dict] | None) – 要附加到第一個容器的卷宗
image_pull_policy (str | None) – 指定快取或始終提取映像檔的策略
restart_policy (str | None) – Pod 的重新啟動策略
image_pull_secrets (str | None) – 要提供給 Pod 的任何映像檔提取密碼。如果需要多個密碼,請提供逗號分隔的列表:secret_a,secret_b
init_containers (list[kubernetes.client.models.V1Container] | None) – 初始化容器的列表
service_account_name (str | None) – 在 Pod 中執行的程序的身分
resources (kubernetes.client.models.V1ResourceRequirements | dict | None) – 第一個容器的資源需求
affinity (dict | None) – 包含一組親緣性排程規則的字典
hostnetwork (bool) – 如果為 True,則在 Pod 上啟用主機網路
tolerations (list | None) – Kubernetes 容忍度的列表
security_context (kubernetes.client.models.V1PodSecurityContext | dict | None) – 包含 Pod 安全性內容的字典
configmaps (list[str] | None) – 要從中讀取環境的任何 configmap 參考
configmaps
。如果需要多個 configmap,請提供逗號分隔的列表 configmap_a,configmap_bdnspolicy (str | None) – 指定 Pod 的 dnspolicy
schedulername (str | None) – 指定 Pod 的 schedulername
pod – 完全指定的 Pod。與 path_or_string 互斥
extract_xcom (bool) – 是否啟動用於 xcom 的容器
priority_class_name (str | None) – 啟動的 Pod 的優先順序類別名稱