airflow.providers.amazon.aws.hooks.eks

使用 boto3 庫與 Amazon EKS 互動。

屬性

DEFAULT_PAGINATION_TOKEN

STS_TOKEN_EXPIRES_IN

AUTHENTICATION_API_VERSION

COMMAND

ClusterStates

包含 EKS 叢集的可能狀態值。

FargateProfileStates

包含 AWS Fargate 配置檔案的可能狀態值。

NodegroupStates

包含 EKS 託管節點組的可能狀態值。

EksHook

與 Amazon Elastic Kubernetes Service (EKS) 互動。

模組內容

airflow.providers.amazon.aws.hooks.eks.DEFAULT_PAGINATION_TOKEN = ''[source]
airflow.providers.amazon.aws.hooks.eks.STS_TOKEN_EXPIRES_IN = 60[source]
airflow.providers.amazon.aws.hooks.eks.AUTHENTICATION_API_VERSION = 'client.authentication.k8s.io/v1alpha1'[source]
class airflow.providers.amazon.aws.hooks.eks.ClusterStates[source]

基類: enum.Enum

包含 EKS 叢集的可能狀態值。

CREATING = 'CREATING'[source]
ACTIVE = 'ACTIVE'[source]
DELETING = 'DELETING'[source]
FAILED = 'FAILED'[source]
UPDATING = 'UPDATING'[source]
NONEXISTENT = 'NONEXISTENT'[source]
class airflow.providers.amazon.aws.hooks.eks.FargateProfileStates[source]

基類: enum.Enum

包含 AWS Fargate 配置檔案的可能狀態值。

CREATING = 'CREATING'[source]
ACTIVE = 'ACTIVE'[source]
DELETING = 'DELETING'[source]
CREATE_FAILED = 'CREATE_FAILED'[source]
DELETE_FAILED = 'DELETE_FAILED'[source]
NONEXISTENT = 'NONEXISTENT'[source]
class airflow.providers.amazon.aws.hooks.eks.NodegroupStates[source]

基類: enum.Enum

包含 EKS 託管節點組的可能狀態值。

CREATING = 'CREATING'[source]
ACTIVE = 'ACTIVE'[source]
UPDATING = 'UPDATING'[source]
DELETING = 'DELETING'[source]
CREATE_FAILED = 'CREATE_FAILED'[source]
DELETE_FAILED = 'DELETE_FAILED'[source]
DEGRADED = 'DEGRADED'[source]
NONEXISTENT = 'NONEXISTENT'[source]
airflow.providers.amazon.aws.hooks.eks.COMMAND = Multiline-String[source]
顯示值
"""
            output=$({python_executable} -m airflow.providers.amazon.aws.utils.eks_get_token                 --cluster-name {eks_cluster_name} {args} 2>&1)

            if [ $? -ne 0 ]; then
                echo "Error running the script"
                exit 1
            fi

            expiration_timestamp=$(echo "$output" | grep -oP 'expirationTimestamp: \K[^,]+')
            token=$(echo "$output" | grep -oP 'token: \K[^,]+')

            json_string=$(printf '{{"kind": "ExecCredential","apiVersion":                 "client.authentication.k8s.io/v1alpha1","spec": {{}},"status":                 {{"expirationTimestamp": "%s","token": "%s"}}}}' "$expiration_timestamp" "$token")
            echo $json_string
            """
class airflow.providers.amazon.aws.hooks.eks.EksHook(*args, **kwargs)[source]

基類: airflow.providers.amazon.aws.hooks.base_aws.AwsBaseHook

與 Amazon Elastic Kubernetes Service (EKS) 互動。

提供對 boto3.client("eks") 的輕量級包裝。

可以指定額外的引數(例如 aws_conn_id),並將這些引數傳遞給底層的 AwsBaseHook。

client_type = 'eks'[source]
create_cluster(name, roleArn, resourcesVpcConfig, **kwargs)[source]

建立一個 Amazon EKS 控制平面。

引數:
  • name (str) – 為您的 Amazon EKS 叢集指定的唯一名稱。

  • roleArn (str) – IAM 角色的 Amazon Resource Name (ARN),該角色提供許可權使 Kubernetes 控制平面能夠代表您呼叫 AWS API 操作。

  • resourcesVpcConfig (dict) – 叢集控制平面使用的 VPC 配置。

返回:

返回有關已建立的 EKS 叢集的描述性資訊。

返回型別:

dict

create_nodegroup(clusterName, nodegroupName, subnets, nodeRole, *, tags=None, **kwargs)[source]

為 Amazon EKS 叢集建立一個 Amazon EKS 託管節點組。

引數:
  • clusterName (str) – 要在其內部建立 EKS 託管節點組的 Amazon EKS 叢集的名稱。

  • nodegroupName (str) – 為您的託管節點組指定的唯一名稱。

  • subnets (list[str]) – 用於為您的節點組建立的 Auto Scaling 組的子網。

  • nodeRole (str | None) – 要與您的節點組關聯的 IAM 角色的 Amazon Resource Name (ARN)。

  • tags (dict | None) – 可選的標籤,用於應用於您的節點組。

返回:

返回有關已建立的 EKS 託管節點組的描述性資訊。

返回型別:

dict

create_fargate_profile(clusterName, fargateProfileName, podExecutionRoleArn, selectors, **kwargs)[source]

為 Amazon EKS 叢集建立一個 AWS Fargate 配置檔案。

引數:
  • clusterName (str) – 要應用 Fargate 配置檔案的 Amazon EKS 叢集的名稱。

  • fargateProfileName (str | None) – Fargate 配置檔案的名稱。

  • podExecutionRoleArn (str | None) – Pod 執行角色的 Amazon Resource Name (ARN),用於與 Fargate 配置檔案中的選擇器匹配的 Pod。

  • selectors (list) – 用於匹配使用此 Fargate 配置檔案的 Pod 的選擇器。

返回:

返回有關已建立的 Fargate 配置檔案的描述性資訊。

返回型別:

dict

delete_cluster(name)[source]

刪除 Amazon EKS 叢集控制平面。

引數:

name (str) – 要刪除的叢集的名稱。

返回:

返回有關已刪除的 EKS 叢集的描述性資訊。

返回型別:

dict

delete_nodegroup(clusterName, nodegroupName)[source]

從指定的叢集中刪除 Amazon EKS 託管節點組。

引數:
  • clusterName (str) – 與您的節點組關聯的 Amazon EKS 叢集的名稱。

  • nodegroupName (str) – 要刪除的節點組的名稱。

返回:

返回有關已刪除的 EKS 託管節點組的描述性資訊。

返回型別:

dict

delete_fargate_profile(clusterName, fargateProfileName)[source]

從指定的 Amazon EKS 叢集中刪除 AWS Fargate 配置檔案。

引數:
  • clusterName (str) – 與要刪除的 Fargate 配置檔案關聯的 Amazon EKS 叢集的名稱。

  • fargateProfileName (str) – 要刪除的 Fargate 配置檔案的名稱。

返回:

返回有關已刪除的 Fargate 配置檔案的描述性資訊。

返回型別:

dict

describe_cluster(name, verbose=False)[source]

返回有關 Amazon EKS 叢集的描述性資訊。

引數:
  • name (str) – 要描述的叢集的名稱。

  • verbose (bool) – 如果設定為 True,則提供額外的日誌記錄。預設為 False。

返回:

返回有關特定 EKS 叢集的描述性資訊。

返回型別:

dict

describe_nodegroup(clusterName, nodegroupName, verbose=False)[source]

返回有關 Amazon EKS 託管節點組的描述性資訊。

引數:
  • clusterName (str) – 與該節點組關聯的 Amazon EKS 叢集的名稱。

  • nodegroupName (str) – 要描述的節點組的名稱。

  • verbose (bool) – 如果設定為 True,則提供額外的日誌記錄。預設為 False。

返回:

返回有關特定 EKS 節點組的描述性資訊。

返回型別:

dict

describe_fargate_profile(clusterName, fargateProfileName, verbose=False)[source]

返回有關 AWS Fargate 配置檔案的描述性資訊。

引數:
  • clusterName (str) – 與該 Fargate 配置檔案關聯的 Amazon EKS 叢集的名稱。

  • fargateProfileName (str) – 要描述的 Fargate 配置檔案的名稱。

  • verbose (bool) – 如果設定為 True,則提供額外的日誌記錄。預設為 False。

返回:

返回有關 AWS Fargate 配置檔案的描述性資訊。

返回型別:

dict

get_cluster_state(clusterName)[source]

返回給定 Amazon EKS 叢集的當前狀態。

引數:

clusterName (str) – 要檢查的叢集的名稱。

返回:

返回給定 Amazon EKS 叢集的當前狀態。

返回型別:

ClusterStates

get_fargate_profile_state(clusterName, fargateProfileName)[source]

返回給定 AWS Fargate 配置檔案的當前狀態。

引數:
  • clusterName (str) – 與該 Fargate 配置檔案關聯的 Amazon EKS 叢集的名稱。

  • fargateProfileName (str) – 要檢查的 Fargate 配置檔案的名稱。

返回:

返回給定 AWS Fargate 配置檔案的當前狀態。

返回型別:

FargateProfileStates

get_nodegroup_state(clusterName, nodegroupName)[source]

返回給定 Amazon EKS 託管節點組的當前狀態。

引數:
  • clusterName (str) – 與該節點組關聯的 Amazon EKS 叢集的名稱。

  • nodegroupName (str) – 要檢查的節點組的名稱。

返回:

返回給定 Amazon EKS 節點組的當前狀態。

返回型別:

NodegroupStates

list_clusters(verbose=False)[source]

列出您的 AWS 賬戶中的所有 Amazon EKS 叢集。

引數:

verbose (bool) – 如果設定為 True,則提供額外的日誌記錄。預設為 False。

返回:

包含叢集名稱的列表。

返回型別:

list

list_nodegroups(clusterName, verbose=False)[source]

列出與指定叢集關聯的所有 Amazon EKS 託管節點組。

引數:
  • clusterName (str) – 包含要列出的節點組的 Amazon EKS 叢集的名稱。

  • verbose (bool) – 如果設定為 True,則提供額外的日誌記錄。預設為 False。

返回:

給定叢集中節點組名稱的列表。

返回型別:

list

list_fargate_profiles(clusterName, verbose=False)[source]

列出與指定叢集關聯的所有 AWS Fargate 配置檔案。

引數:
  • clusterName (str) – 要列出 Fargate 配置檔案的 Amazon EKS 叢集的名稱。

  • verbose (bool) – 如果設定為 True,則提供額外的日誌記錄。預設為 False。

返回:

給定叢集中的 Fargate 配置檔名稱列表。

返回型別:

list

generate_config_file(eks_cluster_name, pod_namespace)[source]

根據 EKS 叢集寫入 kubeconfig 檔案。

引數:
  • eks_cluster_name (str) – 要為其生成 kubeconfig 檔案的叢集名稱。

  • pod_namespace (str | None) – 在 Kubernetes 中執行的名稱空間。

fetch_access_token_for_cluster(eks_cluster_name)[source]

此條目是否有幫助?