Skip to content
This repository was archived by the owner on Aug 13, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package main

import (
"context"
"crypto/tls"
"flag"
"os"
Expand All @@ -32,6 +33,7 @@ import (
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/certwatcher"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/metrics/filters"
Expand Down Expand Up @@ -310,6 +312,25 @@ func main() {
}

if config.enableHRAutodiscovery {
ctx := context.Background()

// Index HelmRelease by ConfigMaps or Secret used in ValuesFrom
if err := mgr.GetFieldIndexer().IndexField(
ctx, &helmv2.HelmRelease{}, "spec.valuesFrom", func(rawObj client.Object) []string {
hr := rawObj.(*helmv2.HelmRelease)
var helmReleaseNames []string

for _, valuesRef := range hr.Spec.ValuesFrom {
if valuesRef.Kind == "ConfigMap" || valuesRef.Kind == "Secret" {
helmReleaseNames = append(helmReleaseNames, valuesRef.Name)
}
}
return helmReleaseNames
}); err != nil {
setupLog.Error(err, "unable to setup ConfigMap index field for HelmRelease")
os.Exit(1)
}

if err = controller.NewHRAutodicoverReconciler(
mgr.GetClient(),
mgr.GetScheme(),
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/fluxcd/helm-controller/api v1.3.0
github.com/onsi/ginkgo/v2 v2.22.0
github.com/onsi/gomega v1.36.1
github.com/stretchr/testify v1.10.0
go.uber.org/zap v1.27.0
k8s.io/api v0.33.0
k8s.io/apimachinery v0.33.0
Expand Down Expand Up @@ -54,6 +55,7 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.22.0 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.62.0 // indirect
Expand Down
Loading