Skip to content

stackrox/helm-operator

Folders and files

NameName
Last commit message
Last commit date
Jan 13, 2025
Jan 22, 2024
Feb 6, 2025
May 10, 2023
Aug 26, 2024
Feb 11, 2025
Sep 3, 2021
Sep 4, 2024
Aug 26, 2024
Oct 13, 2023
May 13, 2020
Jan 14, 2025
Jun 28, 2022
Feb 6, 2025
Jan 14, 2025
Jan 14, 2025
Aug 26, 2024

Repository files navigation

helm-operator

Build Status

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 of a Helm chart exactly to a CustomResourceDefinition and defining its watched resources in a watches.yaml configuration file.

For creating a Level II+ operator that reuses an already existing Helm chart, a hybrid 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

// 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 of a Helm chart exactly to a CustomResourceDefinition and defining its watched resources in a watches.yaml configuration file.

For creating a Level II+ operator that reuses an already existing Helm chart, we need a hybrid 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:

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