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

[Enhancement] Package namespace that would let someone access any subpackage resource under it by fully qualifying the name. #1686

Open
dansrogers opened this issue Sep 6, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@dansrogers
Copy link

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

import crossplane

crossplane.v1.Provider {
  metadata.name = "provider-helm"
  spec: {
     package = "xpkg.upbound.io/crossplane-contrib/provider-helm:v0.19.0"
     runtimeConfigRef.name = "provider-helm"
    }
}

Then kcl run the above file

error[E2F04]: CannotFindModule
 --> /home/daniel/project-prodlab/homelab-controlplane/main.k:1:1
  |
1 | import crossplane
  | ^ Cannot find the module crossplane from /home/daniel/project-prodlab/homelab-controlplane/crossplane
  |


suggestion: try 'kcl mod add crossplane' to download the package not found


suggestion: find more package on 'https://artifacthub.io'


error[E2G22]: TypeError
 --> /home/daniel/project-prodlab/homelab-controlplane/main.k:3:1
  |
3 | crossplane.v1.Provider {
  | ^ attribute 'v1' not found in 'module 'crossplane''
  |


Instead of I have to:

import crossplane.v1 as crossplanev1

crossplanev1.Provider {
  metadata.name = "provider-helm"
  spec: {
     package = "xpkg.upbound.io/crossplane-contrib/provider-helm:v0.19.0"
     runtimeConfigRef.name = "provider-helm"
    }
}

This is a minor inconvenience since the workaround is clear.

2. What did you expect to see? (Required)

I expected the atom "crossplane" to function as a package namespace that would let me access any subpackage resource under it by fully qualifying the name.

3. What did you see instead (Required)

import crossplane appears not to cause an error, but effectively doesn't import anything, because it's not a package on it's own -- so what did I import?

4. What is your KCL components version? (Required)

I don't know how to get the version of my kcl components. here is my version of kcl:

$ kcl --version
kcl version 0.10.0-beta.3

and my kcl.mod file dependencies

[dependencies]
k8s = "1.31"
crossplane = "1.16.0"
@Peefy Peefy added the enhancement New feature or request label Sep 6, 2024
@Peefy Peefy changed the title import crossplane doesn't work as expected [Enhancement] Package namespace that would let someone access any subpackage resource under it by fully qualifying the name. Oct 12, 2024
@Peefy Peefy transferred this issue from kcl-lang/modules Oct 12, 2024
@Peefy Peefy added this to the v0.11.0 Release milestone Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants