mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
aws_eks_cluster: Add wait functionality (#42259)
* aws_eks_cluster: Improve output documentation This data is already returned by the module, it just wasn't documented. These fields are required for accessing the created Kubernetes API with e.g. the k8s_raw module. * aws_eks_cluster: Add wait functionality This enables further cluster configuration once it's created and active. 20 minutes was chosen as an arbitrary default, so that if it takes longer than the documented "usually less than 10 minutes" it's still likely to succeed. * Correct security group name in aws_eks tests * Improve teardown of aws_eks tests Fix minor teardown issues. The `pause` step is a placeholder until a waiter for `state: absent`
This commit is contained in:
committed by
Will Thames
parent
8590465d96
commit
6412cbf84b
@@ -179,6 +179,30 @@ waf_data = {
|
||||
}
|
||||
}
|
||||
|
||||
eks_data = {
|
||||
"version": 2,
|
||||
"waiters": {
|
||||
"ClusterActive": {
|
||||
"delay": 20,
|
||||
"maxAttempts": 60,
|
||||
"operation": "DescribeCluster",
|
||||
"acceptors": [
|
||||
{
|
||||
"state": "success",
|
||||
"matcher": "path",
|
||||
"argument": "cluster.status",
|
||||
"expected": "ACTIVE"
|
||||
},
|
||||
{
|
||||
"state": "retry",
|
||||
"matcher": "error",
|
||||
"expected": "ResourceNotFoundException"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def ec2_model(name):
|
||||
ec2_models = core_waiter.WaiterModel(waiter_config=ec2_data)
|
||||
@@ -190,6 +214,11 @@ def waf_model(name):
|
||||
return waf_models.get_waiter(name)
|
||||
|
||||
|
||||
def eks_model(name):
|
||||
eks_models = core_waiter.WaiterModel(waiter_config=eks_data)
|
||||
return eks_models.get_waiter(name)
|
||||
|
||||
|
||||
waiters_by_name = {
|
||||
('EC2', 'route_table_exists'): lambda ec2: core_waiter.Waiter(
|
||||
'route_table_exists',
|
||||
@@ -251,6 +280,12 @@ waiters_by_name = {
|
||||
core_waiter.NormalizedOperationMethod(
|
||||
waf.get_change_token_status
|
||||
)),
|
||||
('EKS', 'cluster_active'): lambda eks: core_waiter.Waiter(
|
||||
'cluster_active',
|
||||
eks_model('ClusterActive'),
|
||||
core_waiter.NormalizedOperationMethod(
|
||||
eks.describe_cluster
|
||||
)),
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user