Skip to content

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

@dansrogers

Description

@dansrogers

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"

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions