I have a cluster composition that uses EKS as the underlying managed resource. The auth tokens given out by EKS have a TTL of 15 min, so the connection secret for the EKS managed resources gets updated often.
It appears that updates to the connection secret do not get propagated back up the composition hierarchy and to the claim's namespace. So when trying to use the claim's connection secret, it is stale and results in error: You must be logged in to the server (Unauthorized).
The AWS reference platform is an example of this behavior. The composition hierarchy is:
eks.aws.platformref.crossplane.io (composite resource)cluster.eks.aws.crossplane.io (managed resource)When examining the connection secrets at those 4 levels, the only diff is between the claim and the CompositeCluster, so it appears the managed resource secret update is getting propagated through the compositions, but not the final hop to the namespaced claim.
Crossplane version: v0.14.0-rc.102.g6e1b4ce2
As you point out, the propagation from the actual credentials in AWS to the claim secret works as follows:
I believe the culprit here is the fact that we don't queue claim reconciles every 30-60 seconds, because the controller watches both the claim and composite and thus assumes a reconcile will be queued if anything changes about those resources. Unfortunately we don't watch the composite's connection secret.
There's a few fixes here:
I'm inclined to compromise and go with option 2 for the time being.
Annotate the composite resource's connection secret with a reference to the composite resource, and have the claim reconciler watch for secrets with such an annotation. This would reduce the pathological propagation delay to 2 minutes, because we'd instantly propagate changes to the composite resource secret.
@negz are we able to use the existing OwnerReference to know that what this Secret belongs to? Annotation works, too, but it seems the information is already there.
@muvaf I misspoke in that comment; what we actually need is to resolve the composite connection secret to a claim that should have a reconcile queued when it changes. So we either need to annotate composite resource secrets with their claim's details (at least namespace and name, maybe GVK for informational purposes) or use an EventHandler that uses a client to get the secret's composite resource via its controller ref, then enqueues a request for the composite's claim. Neither approach feels super elegant to me, but I'm leaning toward using a controller ref approach close to what you suggest.
I think I confused what's available in the owner ref. I thought it's what you were going to annotate, i.e. claim name/namespace, but it doesn't seem to be the case. It's the composite name, which is only indirectly useful to us as you mentioned. So, I don't really think what I proposed is a simpler/better approach than annotation.
Most helpful comment
As you point out, the propagation from the actual credentials in AWS to the claim secret works as follows:
I believe the culprit here is the fact that we don't queue claim reconciles every 30-60 seconds, because the controller watches both the claim and composite and thus assumes a reconcile will be queued if anything changes about those resources. Unfortunately we don't watch the composite's connection secret.
There's a few fixes here:
I'm inclined to compromise and go with option 2 for the time being.