https://github.com/stackrox/helm-operator
Helm operator fork of https://github.com/operator-framework/helm-operator-plugins
https://github.com/stackrox/helm-operator
Last synced: 9 months ago
JSON representation
Helm operator fork of https://github.com/operator-framework/helm-operator-plugins
- Host: GitHub
- URL: https://github.com/stackrox/helm-operator
- Owner: stackrox
- License: apache-2.0
- Created: 2021-05-18T07:44:02.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-09-17T06:28:25.000Z (over 1 year ago)
- Last Synced: 2024-09-17T09:03:38.735Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 1.82 MB
- Stars: 3
- Watchers: 5
- Forks: 2
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# helm-operator

Reimplementation of the helm operator to enrich the Helm operator's reconciliation with custom Go code to create a
hybrid operator.
## Introduction
The Helm operator type automates Helm chart operations
by mapping the [values](https://helm.sh/docs/chart_template_guide/values_files/) of a Helm chart exactly to a
`CustomResourceDefinition` and defining its watched resources in a `watches.yaml`
[configuration](https://sdk.operatorframework.io/docs/building-operators/helm/tutorial/#watch-the-nginx-cr) file.
For creating a [Level II+](https://sdk.operatorframework.io/docs/advanced-topics/operator-capabilities/operator-capabilities/) operator
that reuses an already existing Helm chart, a [hybrid](https://github.com/operator-framework/operator-sdk/issues/670)
between the Go and Helm operator types is necessary.
The hybrid approach allows adding customizations to the Helm operator, such as:
- value mapping based on cluster state, or
- executing code in specific events.
## Quick start
### Creating a Helm reconciler
```go
// Operator's main.go
chart, err := loader.Load("path/to/chart")
if err != nil {
panic(err)
}
reconciler := reconciler.New(
reconciler.WithChart(*chart),
reconciler.WithGroupVersionKind(gvk),
)
if err := reconciler.SetupWithManager(mgr); err != nil {
panic(fmt.Sprintf("unable to create reconciler: %s", err))
}
```
## Why a fork?
The Helm operator type automates Helm chart operations
by mapping the [values](https://helm.sh/docs/chart_template_guide/values_files/) of a Helm chart exactly to a
`CustomResourceDefinition` and defining its watched resources in a `watches.yaml`
[configuration](https://sdk.operatorframework.io/docs/building-operators/helm/tutorial/#watch-the-nginx-cr) file.
For creating a [Level II+](https://sdk.operatorframework.io/docs/advanced-topics/operator-capabilities/operator-capabilities/) operator
that reuses an already existing Helm chart, we need a [hybrid](https://github.com/operator-framework/operator-sdk/issues/670)
between the Go and Helm operator types.
The hybrid approach allows adding customizations to the Helm operator, such as:
- value mapping based on cluster state, or
- executing code in specific events.
### Quickstart
- Add this module as a replace directive to your `go.mod`:
```
go mod edit -replace=github.com/joelanford/helm-operator=github.com/stackrox/helm-operator@main
```
For example:
```go
chart, err := loader.Load("path/to/chart")
if err != nil {
panic(err)
}
reconciler := reconciler.New(
reconciler.WithChart(*chart),
reconciler.WithGroupVersionKind(gvk),
)
if err := reconciler.SetupWithManager(mgr); err != nil {
panic(fmt.Sprintf("unable to create reconciler: %s", err))
}
```