Exemple #1
0
        compute=None,
        cluster_name="{{ dag_run.conf['cluster_name'] }}",
        cluster_role_arn="{{ dag_run.conf['cluster_role_arn'] }}",
        resources_vpc_config="{{ dag_run.conf['resources_vpc_config'] }}",
    )

    await_create_cluster = EKSClusterStateSensor(
        task_id='wait_for_create_cluster',
        cluster_name="{{ dag_run.conf['cluster_name'] }}",
        target_state=ClusterStates.ACTIVE,
    )

    create_nodegroup = EKSCreateNodegroupOperator(
        task_id='create_eks_nodegroup',
        cluster_name="{{ dag_run.conf['cluster_name'] }}",
        nodegroup_name="{{ dag_run.conf['nodegroup_name'] }}",
        nodegroup_subnets="{{ dag_run.conf['nodegroup_subnets'] }}",
        nodegroup_role_arn="{{ dag_run.conf['nodegroup_role_arn'] }}",
    )

    await_create_nodegroup = EKSNodegroupStateSensor(
        task_id='wait_for_create_nodegroup',
        cluster_name="{{ dag_run.conf['cluster_name'] }}",
        nodegroup_name="{{ dag_run.conf['nodegroup_name'] }}",
        target_state=NodegroupStates.ACTIVE,
    )

    start_pod = EKSPodOperator(
        task_id="run_pod",
        cluster_name="{{ dag_run.conf['cluster_name'] }}",
        image="amazon/aws-cli:latest",
Exemple #2
0
        resources_vpc_config=VPC_CONFIG,
        compute=None,
    )
    # [END howto_operator_eks_create_cluster]

    await_create_cluster = EKSClusterStateSensor(
        task_id='wait_for_create_cluster',
        cluster_name=CLUSTER_NAME,
        target_state=ClusterStates.ACTIVE,
    )

    # [START howto_operator_eks_create_nodegroup]
    create_nodegroup = EKSCreateNodegroupOperator(
        task_id='create_eks_nodegroup',
        cluster_name=CLUSTER_NAME,
        nodegroup_name=NODEGROUP_NAME,
        nodegroup_subnets=SUBNETS,
        nodegroup_role_arn=ROLE_ARN,
    )
    # [END howto_operator_eks_create_nodegroup]

    await_create_nodegroup = EKSNodegroupStateSensor(
        task_id='wait_for_create_nodegroup',
        cluster_name=CLUSTER_NAME,
        nodegroup_name=NODEGROUP_NAME,
        target_state=NodegroupStates.ACTIVE,
    )

    # [START howto_operator_eks_pod_operator]
    start_pod = EKSPodOperator(
        task_id="run_pod",