-
Notifications
You must be signed in to change notification settings - Fork 43
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
Uniformity of kcl run and kcl mod add CLI, etc #289
Comments
Hi @Vanshikav123 😃 Welcome! You can begin with this task.
I provide some more detailed information. Currently, kpm supports OCI Registries with URLs beginning with either 'https' or 'http' protocols.
kpm requires the environment variable
The state of this switch variable restricts kpm to effect only one protocol at a time—either kpm utilizes the third-party library
Therefore, you could begin by research how the ORAS tool achieves this, and then try to implement the same functionality in kpm. If you can find the apis used by oras, using those apis directly in kpm to implement the same functionality will make it very easy to solve this problem. 😊😊😊 |
Thanks for providing me with the references will come up with a solution soon ! |
Can git://github.com be simplified to github.com and git://github.com is also allowed. Ref kubectl apply |
Uniformity of kcl mod add and kcl run CLI
1. This issue is created for
add/run/push/pull
commands to reduce user cognitive load.2. The command design
Taking the
kcl mod add
command as an example:2.1 Direct use of
https/http
We support the direct use of protocols starting with
http/https
, and other information can be identified using a suffix in the form of?<key>=<value>
.Taking https as an example:
kcl mod add https://ghcr.io/kcl-lang/k8s?version=0.0.1
However, with this syntax,
kpm
cannot determine whetherhttps://ghcr.io/kcl-lang/k8s?version=0.0.1
originates from an OCI Registry or a Git Repo. Therefore, kpm will attempt to fetch the content sequentially following the order of OCI -> Git. If the OCI fetch is successful, package from oci will be used; if a Git repo fetch is successful, package from git will be used. If both fail, an error will be raised.2.2 Specifying using the
oci/git
protocolkpm also supports the use of specific protocols to designate the source.
Specifying the source using the
oci://
protocol:Specifying the source using the
git://
protocol:For private git repo,
ssh://
protocol is supported.For more than one parameters,
&
is used to connect different parameters.3. The dependencies in
kcl.mod
For
kcl.mod
, kpm supports writing dependencies as below, takek8s
as example:3.1 The default source
The following show the KCL dependencies from default source, it can be oci registry or git repo.
If the default source is OCI registry, the configuration for kpm in
~/.kcl/kpm/config.json
as following:If the default source is Git registry, the configuration for kpm in
~/.kcl/kpm/config.json
as following:3.2 OCI Registry
Specify the KCL package source is OCI Registry
version it the oci tag
3.3 Git Registry
The design before:
#266
4. API
In
KpmClient
, we provide aVisit
method to simplify the package download process, which allows you to directly access the contents of aKclPkg
. You can access the KCL packages from different sources through this method, wheresource
refers to the various addresses of the KCL packages mentioned earlier, including local paths and the OCI or GIT addresses in URL format.To facilitate understanding, this
Visit
works similarly to the workflow of web browsers, providing it with a URL, it will return the specific webpage located at that address.For example:
Some examples of other tools are referenced
Considerations in Design
?version=0.0.1
rather than following the oci style of using:v0.0.1
?We aim to provide users with a uniform style, where one kind URL can deduce another.
:v0.0.1
corresponds toversion=v0.0.1
. If applied to other sources that do not have the concept ofversion
, e.g. git repo, this would add a cognitive burden. That is, would:v0.0.1
still be effective if the source lacks the concept ofversion
? Therefore, in the current version, we consider not adding this feature. If there is a strong demand for adding:v0.0.1
in the future, we will reconsider whether to add it.The Progress
[ ] - Remove the
http/https
switch and adjust oci access layer in kpm to supporthttp/https
non-awareness[ ] - Adjusting the cli to supports unified commands.
[ ] - Add default source to avoid overwriting by OCI source and Git source.
[ ] - Complete all documents about the new cli.
[ ] - Refer to how KCL-KRM requests resources
The text was updated successfully, but these errors were encountered: