Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit reference causes import cycle error #96

Closed
donovanmuller opened this issue Aug 23, 2022 · 4 comments · Fixed by #331
Closed

Explicit reference causes import cycle error #96

donovanmuller opened this issue Aug 23, 2022 · 4 comments · Fixed by #331
Labels
bug Something isn't working impact:low is:blocker

Comments

@donovanmuller
Copy link

donovanmuller commented Aug 23, 2022

What happened?

With one specific GCP resource (google_service_networking_peered_dns_domain ) configured with an explicit Network reference, running make reviewable results in an error as described in this https://github.com/upbound/official-providers/pull/518#discussion_r943598464. Note that the Network reference is not automatically added via Upjet either.

https://github.com/upbound/official-providers/blob/7ac76a2a7d155838a7cc479b6dd8352357b1d79c/provider-gcp/config/cloudplatform/config.go#L93-L101

Removing the explicit reference allows for successful generation.

How can we reproduce it?

  • Checkout commit 93afafc9361dfdf96bd2aa91d20cd2bdc29bebf3
  • make && cd provider-gcp && make reviewable

What environment did it happen in?

@donovanmuller donovanmuller added the bug Something isn't working label Aug 23, 2022
@donovanmuller
Copy link
Author

Another example of this error can be found in the InstanceGroupNamedPort resource config https://github.com/upbound/official-providers/blob/cba2980241265105e38d027b79b7486a69abb31b/provider-gcp/config/compute/config.go#L408-L415 In this example, the only way to get a reference to the InstanceGroup for the group field https://github.com/upbound/official-providers/blob/cba2980241265105e38d027b79b7486a69abb31b/provider-gcp/examples/compute/instancegroupnamedport.yaml#L11-L14 is to get it via the GKE Cluster's implicitly created nodePool attribute https://github.com/upbound/official-providers/blob/cba2980241265105e38d027b79b7486a69abb31b/provider-gcp/config/compute/config.go#L445-L459

However, adding the v1beta1.Cluster reference type in config/compute/config.go results in an import cycle.

@muvaf muvaf changed the title gcp: Explicit reference causes import cycle error Explicit reference causes import cycle error Sep 20, 2022
@muvaf muvaf transferred this issue from another repository Sep 20, 2022
@muvaf
Copy link
Member

muvaf commented Sep 20, 2022

This is a general problem regarding references that we need to fix in upstream crossplane/crossplane-runtime#313 Though we may implement a proprietary reference resolver in Upjet to handle these cases.

@luebken
Copy link

luebken commented Dec 8, 2022

Severity:low as we currently don't encounter this often. Please add your use-case if you encounter this.

@haarchri
Copy link
Contributor

haarchri commented Jan 6, 2023

we have this case also for an zscaler provider

(⎈|kind-sop-local:N/A)➜  crossplane-provider-zpa git:(master) ✗ make run
19:34:31 [ .. ] go build linux_arm64
package github.com/xx/crossplane-provider-zpa/cmd/provider
        imports github.com/xx/crossplane-provider-zpa/apis
        imports github.com/xx/crossplane-provider-zpa/apis/zpaapplicationsegment/v1alpha1
        imports github.com/xx/crossplane-provider-zpa/apis/zpaservergroup/v1alpha1
        imports github.com/xx/crossplane-provider-zpa/apis/zpaapplicationserver/v1alpha1
        imports github.com/xx/crossplane-provider-zpa/apis/zpaservergroup/v1alpha1: import cycle not allowed
19:34:31 [FAIL]
make: *** [go.build] Error 1

ulucinar added a commit to ulucinar/upbound-provider-aws that referenced this issue Jan 19, 2024
- This effectively addresses the upjet issue:
  crossplane/upjet#96
  for upbound/provider-aws as long as we are
  careful for the cross-resource reference
  extractors.

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
ulucinar added a commit to ulucinar/upbound-provider-aws that referenced this issue Jan 22, 2024
- This effectively addresses the upjet issue:
  crossplane/upjet#96
  for upbound/provider-aws as long as we are
  careful for the cross-resource reference
  extractors.

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
ulucinar added a commit to ulucinar/upbound-provider-aws that referenced this issue Jan 28, 2024
- This effectively addresses the upjet issue:
  crossplane/upjet#96
  for upbound/provider-aws as long as we are
  careful for the cross-resource reference
  extractors.

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
ulucinar added a commit to ulucinar/upbound-provider-aws that referenced this issue Jan 30, 2024
- This effectively addresses the upjet issue:
  crossplane/upjet#96
  for upbound/provider-aws as long as we are
  careful for the cross-resource reference
  extractors.

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working impact:low is:blocker
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants