Closed nmvk closed 4 years ago
We can provide a field called precondition, In this we can specify the the resource attribute and list of allowed values.
resources:
CacheSubnetGroup:
exceptions:
codes:
404: CacheSubnetGroupNotFoundFault
operations:
ModifyReplicationGroup:
override_values:
ApplyImmediately: true
precondition:
status:
- Available
- Snapshotting
In generated code before invoking the specified API, we would Describe
and check if precondition is satisfied, if not we would return sdkFind
. Though reconciler would still invoke the Modify
API, we would not invoke ElastiCache API.
Elasticache wait link - https://docs.aws.amazon.com/cli/latest/reference/elasticache/wait/index.html
This might be useful for other services like EC2 which also have a wait logic https://docs.aws.amazon.com/cli/latest/reference/ec2/wait/index.html
Hmm, yeah, this is indeed an interesting idea @nmvk. A couple thoughts in response, though...
1) Instead of precondition
, though, how about we call it assert
? In other words, you would read the generator.yaml
contents like this "for ModifyReplicationGroup operation, assert that Status field value is 'Available' or 'Snapshotting'".
2) Instead of returning the result of sdkFind
if the assertions fail, we should add a Condition
object to the CR's Status.Conditions
collection that indicates the CR has a pending modification to its actual state that is waiting for a field assertion to assert truthfully. That way, Kubernetes users can query the Status.Conditions
field and see what the status of any desired state changes are.
Thoughts?
Thanks! @jaypipes for the suggestion. I liked the idea that K8 users can query the Status.Condition
s field and see if resource is in pending modifying
state. Will use assert
in generator.yaml
instead of precondition
Describe the bug Elasticache uses status to determine if a ReplicationGroup is created. Once we create ReplicationGroup, status of RG is
creating
and it can few minutes to move toactive
status. During this time we do not allowModifyReplicationGroup
call to be invoked as status is notactive
.Upon creation, ModifyReplication group gets invoked continuously and results in error.
Steps to reproduce
Expected outcome No invocation of
ModifyReplicationGroup
if status is notactive
Environment