Skip to content

Commit

Permalink
Fork helm-operator adjustments for CI and documentation (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonBaeumer authored and misberner committed Oct 3, 2022
1 parent 001e6c7 commit bbce802
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
upstream-triage:
- "./*"
area/main-binary:
- 'main.go'
- 'internal/**/*'
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
name: CI

on:
push:
branches:
- '**'
pull_request:
branches: [ main ]
- push

jobs:

Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: Deploy

on:
push:
branches:
- '**'
tags:
- 'v*'
pull_request:
branches: [ main ]
# Disabled as we don't need docker images to use the helm-operator as a library.
#on:
# push:
# branches:
# - '**'
# tags:
# - 'v*'
# pull_request:
# branches: [ main ]

jobs:
goreleaser:
Expand Down
44 changes: 42 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# helm-operator

![Build Status](https://github.com/operator-framework/helm-operator-plugins/workflows/CI/badge.svg?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/operator-framework/helm-operator-plugins/badge.svg?branch=master)](https://coveralls.io/github/operator-framework/helm-operator-plugins?branch=master)
[![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 @@ -41,3 +40,44 @@ if err := reconciler.SetupWithManager(mgr); err != nil {
panic(fmt.Sprintf("unable to create reconciler: %s", err))
}
```

## Why a fork?

Initially the Helm operator type was designed to automate 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).

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.

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.

### 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
```

Example:

```
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))
}
```

0 comments on commit bbce802

Please sign in to comment.