Skip to content

Commit

Permalink
Updated README (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaurav Nelson authored and ludydoo committed Jun 27, 2023
1 parent cf03133 commit 3f3fbd1
Showing 1 changed file with 27 additions and 26 deletions.
53 changes: 27 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# helm-operator

[![Build Status](https://github.com/stackrox/helm-operator/workflows/CI/badge.svg?branch=main)
![Build Status](https://github.com/stackrox/helm-operator/workflows/CI/badge.svg?branch=main)

Reimplementation of the helm operator to enrich the Helm operator's reconciliation with custom Go code to create a
hybrid operator.
Expand Down Expand Up @@ -43,41 +43,42 @@ if err := reconciler.SetupWithManager(mgr); err != nil {

## Why a fork?

Initially the Helm operator type was designed to automate Helm chart operations
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).
[configuration](https://sdk.operatorframework.io/docs/building-operators/helm/tutorial/#watch-the-nginx-cr) file.

To write a [Level II+](https://sdk.operatorframework.io/docs/advanced-topics/operator-capabilities/operator-capabilities/) operator
which reuses an already existing Helm chart a [hybrid](https://github.com/operator-framework/operator-sdk/issues/670)
between the Go and Helm operator type is necessary.
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 is.

The hybrid approach allows to add customizations to the Helm operator like value mapping based on cluster state or
executing code in on specific events.
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`:
- 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
```
```
go mod edit -replace=github.com/joelanford/helm-operator=github.com/stackrox/helm-operator@main
```

Example:
For example:

```
chart, err := loader.Load("path/to/chart")
if err != nil {
panic(err)
}
```go
chart, err := loader.Load("path/to/chart")
if err != nil {
panic(err)
}

reconciler := reconciler.New(
reconciler.WithChart(*chart),
reconciler.WithGroupVersionKind(gvk),
)
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))
}
```
if err := reconciler.SetupWithManager(mgr); err != nil {
panic(fmt.Sprintf("unable to create reconciler: %s", err))
}
```

0 comments on commit 3f3fbd1

Please sign in to comment.