https://github.com/duologic/crossplane-namespaced-libsonnet
https://github.com/duologic/crossplane-namespaced-libsonnet
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/duologic/crossplane-namespaced-libsonnet
- Owner: Duologic
- Created: 2023-01-15T20:43:27.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-03-13T22:30:09.000Z (about 1 year ago)
- Last Synced: 2025-03-13T23:27:47.982Z (about 1 year ago)
- Language: Jsonnet
- Size: 287 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# crossplane-namespaced-libsonnet
A POC that turns a Crossplane CRD resource into a Composition/CompositeResourceDefinition
pair. This directly maps a non-namespaced provider resource to a namespaced XRD.
Rationale: Often I find myself adding a bunch of parameters from a provider resource to
the XRD, eventually all parameters end up being synced almost entirely to make sure that
the namespaced object can modify them. With this library, I can avoid a lot of boilerplate
code and provide a consistent base Composition/XRD to build upon at different abstraction
layers.
## Usage
```jsonnet
local namespaced = import 'github.com/Duologic/crossplane-namespaced-libsonnet/main.libsonnet';
namespaced.fromCRD(import 'crd.json')
```
This returns a `Composition` and `CompositeResourceDefinition` for this CRD:
```json
{
"composition": {
"apiVersion": "apiextensions.crossplane.io/v1",
"kind": "Composition",
...
},
"definition": {
"apiVersion": "apiextensions.crossplane.io/v1",
"kind": "CompositeResourceDefinition",
...
}
}
```