Repository navigation
feat: support pkg meta file in dependency commands #393
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,16 @@ dependencies. Use the `--api-only` flag to add a build-time xpkg dependency. | |
|
|
||
| Non-xpkg dependencies are always build-time dependencies. | ||
|
|
||
| ## Package metadata files | ||
|
|
||
| The command can also add a dependency to `Configuration` package metadata (`crossplane.yaml`). | ||
| When `-f` isn't set, it uses `crossplane-project.yaml` in the current directory if present, | ||
| otherwise `crossplane.yaml`. | ||
| Package metadata only supports runtime xpkg dependencies, which are added to `spec.dependsOn`. | ||
| Kubernetes, CRD, and `--api-only` dependencies require a project file. | ||
| Use `--schemas-dir` to choose where schemas are generated (default `schemas`), and | ||
| `--schema-languages` to generate only some languages (default all). | ||
|
Comment on lines
+29
to
+30
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the use-case for having schemas outside of a project? I'd be inclined to simplify (for now, at least) by making the dep commands skip schema generation/management when called in a non-project package. That said, if you have a use-case in mind here I'm interested :-).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For example, here we didn't adopt projects because we still (and will) use templated compositions such as gotpl/python in a "one pod renders all" way, in order to reduce the footprint (N compositions rendered by 1 function). In our case, it's still interesting to get the binding models for |
||
|
|
||
| ## Examples | ||
|
|
||
| Retrieve the latest available semantic version of `provider-aws-eks`, generate | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| The `clean-cache` command removes all cached package images from the local cache | ||
| directory and removes generated schemas. This can help free up disk space, force | ||
| re-generation of schemas, or resolve issues with corrupted cache entries. | ||
|
|
||
| Like `update-cache`, the command accepts a project file or a `Configuration` | ||
| package metadata file (`crossplane.yaml`). | ||
| Use `--schemas-dir` to select the schemas directory to remove when it differs from the default. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,3 +2,44 @@ The `dependency update-cache` command updates the local dependency cache for the | |
| current project. It re-resolves semantic version constraints to specific | ||
| versions (fetching newer versions if available), caches all dependencies, and | ||
| re-generates language bindings (schemas) for them if needed. | ||
|
|
||
| ## Project and package metadata files | ||
|
|
||
| The command reads dependencies from a project file (`crossplane-project.yaml`) | ||
| or from Configuration package metadata (`crossplane.yaml`). | ||
| When `-f` isn't set, it uses `crossplane-project.yaml` in the current directory if present, | ||
| otherwise `crossplane.yaml`. | ||
|
|
||
| For package metadata, the xpkg dependencies listed in `spec.dependsOn` are cached. | ||
| Schemas are written to the directory given by `--schemas-dir`, relative | ||
| to the file (default `schemas`). | ||
| For a project file, `--schemas-dir` overrides `paths.schemas`. | ||
|
|
||
| Schemas are generated for all supported languages unless `--schema-languages` | ||
| lists a subset (`go`, `json`, `kcl`, `python`). | ||
| For a project file, the flag overrides `spec.schemas.languages`. | ||
|
|
||
| Package metadata can't declare Kubernetes core API dependencies. | ||
| Use `--k8s-version` to generate schemas for them (for example `ServiceAccount` or `ConfigMap`). | ||
| For a project file, the flag replaces its `k8s` dependency. The file is never changed. | ||
|
Comment on lines
+22
to
+24
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I'd rather put this kind of functionality under a new
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree, but I didn't want to change any command we've today |
||
|
|
||
| ## Examples | ||
|
|
||
| Update the cache and generate schemas for the dependencies of a Configuration | ||
| package, writing schemas to `gen/schemas`: | ||
|
|
||
| ```shell | ||
| crossplane dependency update-cache -f crossplane.yaml --schemas-dir gen/schemas | ||
| ``` | ||
|
|
||
| Generate only Python schemas: | ||
|
|
||
| ```shell | ||
| crossplane dependency update-cache -f crossplane.yaml --schema-languages python | ||
| ``` | ||
|
|
||
| Also generate Python schemas for the Kubernetes v1.37.0 core APIs: | ||
|
|
||
| ```shell | ||
| crossplane dependency update-cache -f crossplane.yaml --schema-languages python --k8s-version v1.37.0 | ||
| ``` | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I don't think this is specific to
Configuration, right? All package types can have deps.