|
3 | 3 | 
|
4 | 4 | [](https://coveralls.io/github/operator-framework/helm-operator-plugins?branch=master)
|
5 | 5 |
|
6 |
| -Experimental refactoring of the operator-framework's helm operator |
| 6 | +Reimplementation of the helm operator to enrich the Helm operator's reconciliation with custom Go code to create a |
| 7 | +hybrid operator. |
| 8 | + |
| 9 | +## Introduction |
| 10 | + |
| 11 | +The Helm operator type automates Helm chart operations |
| 12 | +by mapping the [values](https://helm.sh/docs/chart_template_guide/values_files/) of a Helm chart exactly to a |
| 13 | +`CustomResourceDefinition` and defining its watched resources in a `watches.yaml` |
| 14 | +[configuration](https://sdk.operatorframework.io/docs/building-operators/helm/tutorial/#watch-the-nginx-cr) file. |
| 15 | + |
| 16 | +For creating a [Level II+](https://sdk.operatorframework.io/docs/advanced-topics/operator-capabilities/operator-capabilities/) operator |
| 17 | +that reuses an already existing Helm chart, a [hybrid](https://github.com/operator-framework/operator-sdk/issues/670) |
| 18 | +between the Go and Helm operator types is necessary. |
| 19 | + |
| 20 | +The hybrid approach allows adding customizations to the Helm operator, such as: |
| 21 | +- value mapping based on cluster state, or |
| 22 | +- executing code in specific events. |
| 23 | + |
| 24 | +## Quick start |
| 25 | + |
| 26 | +### Creating a Helm reconciler |
| 27 | + |
| 28 | +```go |
| 29 | +// Operator's main.go |
| 30 | +chart, err := loader.Load("path/to/chart") |
| 31 | +if err != nil { |
| 32 | + panic(err) |
| 33 | +} |
| 34 | + |
| 35 | +reconciler := reconciler.New( |
| 36 | + reconciler.WithChart(*chart), |
| 37 | + reconciler.WithGroupVersionKind(gvk), |
| 38 | +) |
| 39 | + |
| 40 | +if err := reconciler.SetupWithManager(mgr); err != nil { |
| 41 | + panic(fmt.Sprintf("unable to create reconciler: %s", err)) |
| 42 | +} |
| 43 | +``` |
0 commit comments