We are observing that an AccessPolicy using StackRefSelector has realm.identifier match the slug of a stack while the realm.identifier always expects the id to be extracted.
It's not clear why this happens to me as by default the Extractor field should get populated with the 'external-name':
And in this particular case, the external-name on the stack does seem to match the id BUT in the composition/claim we do set the value of external-name to match the slug as that is what Crossplane initially needs to find the matching stack, this depends on the import using stackSlugOrID. This means it works for the stack resource. Now it is crossplane constantly racing to update the external-name field, when it comes from the claim it'll be the slug, if it comes from the Grafana API it will be the id. Depending on order of reconcilation, the realm.identifier flips values too, explaining why it works 'sometimes'.
Big thanks to @julienduchesne for finding this last bit.
The change in this PR makes the extraction of id explicit now.
We are observing that an AccessPolicy using StackRefSelector has
realm.identifier
match theslug
of a stack while therealm.identifier
always expects theid
to be extracted.It's not clear why this happens to me as by default the Extractor field should get populated with the 'external-name':
https://github.com/crossplane/upjet/blob/a18bd41b7ac62be1a6058512a13f8a001c8087d9/pkg/config/resource.go#L191-L194
And in this particular case, the external-name on the stack does seem to match the
id
BUT in the composition/claim we do set the value of external-name to match theslug
as that is what Crossplane initially needs to find the matching stack, this depends on the import usingstackSlugOrID
. This means it works for the stack resource. Now it is crossplane constantly racing to update the external-name field, when it comes from the claim it'll be theslug,
if it comes from the Grafana API it will be theid
. Depending on order of reconcilation, therealm.identifier
flips values too, explaining why it works 'sometimes'.Big thanks to @julienduchesne for finding this last bit.
The change in this PR makes the extraction of
id
explicit now.