https://github.com/dfarr/komponents
https://github.com/dfarr/komponents
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/dfarr/komponents
- Owner: dfarr
- Created: 2021-11-16T02:44:50.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-19T00:03:50.000Z (over 4 years ago)
- Last Synced: 2025-03-06T22:03:41.714Z (about 1 year ago)
- Language: Python
- Size: 42 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# komponents
[](https://github.com/dfarr/komponents/actions/workflows/workflow.yaml)
Generates Kubeflow Components from Kubernetes CRD specifications.
## Installation
```
pip install komponents
```
## Usage
First, generate components. Components are specifications that Kubeflow uses to define steps of a pipeline. To generate a component, pipe a CRD specification to `komponents generate`, you must provide a success and failure condition. By default, component specification are written to the `components` directory.
```
kubectl get -o yaml crd/my-crd | komponents generate --success-condition status.state==SUCCESS --failure-condition status.state==FAILURE
```
Once you have generated your components you can plug them into a Kubeflow pipeline. Each field under `spec` of the crd becomes a parameter to the component function. Nested fields are differentiated with an underscore in the parameter name.
```python
import kfp
crd_op = kfp.components.load_component('components/my-crd-group/my-crd-v1.yaml')
@kfp.dsl.pipeline()
def pipeline():
crd_op(foo='foo', bar='bar', baz_1='baz-1', baz_2='baz-2')
```
## Development
```
python3 -m venv venv
source venv/bin/activate
pip install .
komponents --help
```