feat: support project importURLSecretRef#276
feat: support project importURLSecretRef#276BoxBoxJason wants to merge 8 commits intocrossplane-contrib:masterfrom
Conversation
05867fc to
6c5ed50
Compare
e6c39e2 to
a8da766
Compare
|
@BoxBoxJason would you be so kind and merge master into your branch so the pipeline hopefully succeeds? |
c3d0d19 to
9bfa74a
Compare
|
can you fix the lint error please? @BoxBoxJason |
Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
9bfa74a to
566c61d
Compare
Hey there, I have rebased the branch and the CI now passes without issues, I was waiting for #284 to reduce the cyclomatic complexity introduced in #281 Things are functionnal now 😄 |
henrysachs
left a comment
There was a problem hiding this comment.
Hey, nice work on the DeepCopy approach in Observe — that makes sense to me!
I have a question about Create though: the comment says "this is only required for observation, as this is the only method where spec can be updated" — but could you double-check whether UpdateCriticalAnnotations after Create() returns does a full client.Update(ctx, managed) to persist the external-name annotation? If so, I think the mutated ImportURL (with the resolved secret value) would end up in the Custom Resource's spec.forProvider.importUrl field — visible to anyone with read access to the CR.
A second thing I noticed in Observe: the secret gets resolved into current (the DeepCopy), but isProjectUpToDate at line 183 reads &cr.Spec.ForProvider where ImportURL is still nil. Doesn't that mean drift on the import URL would never be detected when using ImportURLSecretRef? And wouldn't ResourceLateInitialized (!cmp.Equal(current, &cr.Spec.ForProvider)) always be true since current.ImportURL differs from the original?
Would be great if you could verify — might be that I'm missing something here!
Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
6d16a34 to
400a820
Compare
|
Hey there @henrysachs, sorry about that PR, I clearly did not test it properly. Good catch about the two infinite update loops caused by the improper comparisons in late initialization / up to date tests. The creation was successful but the drift was not detected. This time I also tested with an authenticated repository to import and found out that the You are also correct about the deep copy mechanism needed to be used in all methods, as the sensitive url with credentials did end up in the CR (Although I cannot confirm if it was due to "Create" and / or "Update" call). Tell me what you think about this revised version. |
Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
7435436 to
aa95871
Compare
Description of your changes
After a long time lost in the abyss, Closes #48
This PR makes it possible to use importUrl from a secret reference in the Project CRD !
There was also a small refactor to put the
UpdateStringFromSecretin a common section to be reusable (and already reused) in multiple packages.I have:
make reviewable testto ensure this PR is ready for review.How has this code been tested
kind create cluster --name gitlabhelm repo add crossplane-stable https://charts.crossplane.io/stablehelm install crossplane --namespace crossplane-system --create-namespace crossplane-stable/crossplanemake go.buildand then run it./_output/bin/linux_amd64/provider --debugk create secret generic gitlab-credentials -n crossplane-system --from-literal=token=EXAMPLE_VALUE(This requires having the source authorized on the gitlab instance)
examples/instance/project.yaml(with a tweak to use importUrlSecretRef)