Skip to content
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ require (
github.com/fluxcd/pkg/auth v0.33.0
github.com/fluxcd/pkg/cache v0.12.0
github.com/fluxcd/pkg/chartutil v1.17.0
github.com/fluxcd/pkg/runtime v0.90.0
github.com/fluxcd/pkg/runtime v0.91.0
github.com/fluxcd/pkg/ssa v0.61.0
github.com/fluxcd/pkg/testserver v0.13.0
github.com/fluxcd/source-controller/api v1.7.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ github.com/fluxcd/pkg/cache v0.12.0 h1:mabABT3jIfuo84VbIW+qvfqMZ7PbM5tXQgQvA2uo2
github.com/fluxcd/pkg/cache v0.12.0/go.mod h1:HL/9cgBmwCdKIr3JH57rxrGdb7rOgX5Z1eJlHsaV1vE=
github.com/fluxcd/pkg/chartutil v1.17.0 h1:UiSBRujE2/Qo8qrv8F3XGEMI5YANS0PpbG/r+CxKUW0=
github.com/fluxcd/pkg/chartutil v1.17.0/go.mod h1:Zt8EolwLyYj0689Ivk9cL4mYZlR3BBi/XVGyeGmPVlE=
github.com/fluxcd/pkg/runtime v0.90.0 h1:IONDsN9npJdWqbSAfsI8j10sXpgaLd6ywycKwp35Wwo=
github.com/fluxcd/pkg/runtime v0.90.0/go.mod h1:D/gUsaSpyw6Od2QEL7MELi5m+oUmwokuxUVZ+vKQxdo=
github.com/fluxcd/pkg/runtime v0.91.0 h1:Z92sOLsJXa+0RIi/vNl87zF5qnsBUdOb60d2a0b4Ulo=
github.com/fluxcd/pkg/runtime v0.91.0/go.mod h1:D/gUsaSpyw6Od2QEL7MELi5m+oUmwokuxUVZ+vKQxdo=
github.com/fluxcd/pkg/ssa v0.61.0 h1:GeueQfZVrjPLEzmEkq6gpFTBr1MDcqUihCQDf6AaIo8=
github.com/fluxcd/pkg/ssa v0.61.0/go.mod h1:PNRlgihYbmlQU5gzsB14nrsNMbtACNanBnKhLCWmeX8=
github.com/fluxcd/pkg/testserver v0.13.0 h1:xEpBcEYtD7bwvZ+i0ZmChxKkDo/wfQEV3xmnzVybSSg=
Expand Down
27 changes: 16 additions & 11 deletions internal/controller/helmrelease_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ import (

type HelmReleaseReconcilerOptions struct {
RateLimiter workqueue.TypedRateLimiter[reconcile.Request]
WatchExternalArtifacts bool
WatchConfigs bool
WatchConfigsPredicate predicate.Predicate
WatchExternalArtifacts bool
}

func (r *HelmReleaseReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opts HelmReleaseReconcilerOptions) error {
Expand Down Expand Up @@ -127,18 +128,22 @@ func (r *HelmReleaseReconciler) SetupWithManager(ctx context.Context, mgr ctrl.M
&sourcev1.OCIRepository{},
handler.EnqueueRequestsFromMapFunc(r.requestsForOCIRepositoryChange),
builder.WithPredicates(intpredicates.SourceRevisionChangePredicate{}),
).
WatchesMetadata(
&corev1.ConfigMap{},
handler.EnqueueRequestsFromMapFunc(r.requestsForConfigDependency(indexConfigMap)),
builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}, opts.WatchConfigsPredicate),
).
WatchesMetadata(
&corev1.Secret{},
handler.EnqueueRequestsFromMapFunc(r.requestsForConfigDependency(indexSecret)),
builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}, opts.WatchConfigsPredicate),
)

if opts.WatchConfigs {
ctrlBuilder = ctrlBuilder.
WatchesMetadata(
&corev1.ConfigMap{},
handler.EnqueueRequestsFromMapFunc(r.requestsForConfigDependency(indexConfigMap)),
builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}, opts.WatchConfigsPredicate),
).
WatchesMetadata(
&corev1.Secret{},
handler.EnqueueRequestsFromMapFunc(r.requestsForConfigDependency(indexSecret)),
builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}, opts.WatchConfigsPredicate),
)
}

if opts.WatchExternalArtifacts {
ctrlBuilder = ctrlBuilder.Watches(
&sourcev1.ExternalArtifact{},
Expand Down
4 changes: 4 additions & 0 deletions internal/features/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package features

import (
"github.com/fluxcd/pkg/auth"
"github.com/fluxcd/pkg/runtime/controller"
feathelper "github.com/fluxcd/pkg/runtime/features"
)

Expand Down Expand Up @@ -106,6 +107,9 @@ var features = map[string]bool{
// ExternalArtifact
// opt-in from v1.4.0
ExternalArtifact: false,
// DisableConfigWatchers
// opt-in from v1.4.4
controller.FeatureGateDisableConfigWatchers: false,
}

func init() {
Expand Down
10 changes: 9 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,13 @@ func main() {
os.Exit(1)
}

disableConfigWatchers, err := features.Enabled(helper.FeatureGateDisableConfigWatchers)
if err != nil {
setupLog.Error(err, "unable to check feature gate "+helper.FeatureGateDisableConfigWatchers)
os.Exit(1)
}
watchConfigs := !disableConfigWatchers

if err = (&controller.HelmReleaseReconciler{
Client: mgr.GetClient(),
APIReader: mgr.GetAPIReader(),
Expand All @@ -349,8 +356,9 @@ func main() {
AllowExternalArtifact: allowExternalArtifact,
}).SetupWithManager(ctx, mgr, controller.HelmReleaseReconcilerOptions{
RateLimiter: helper.GetRateLimiter(rateLimiterOptions),
WatchExternalArtifacts: allowExternalArtifact,
WatchConfigs: watchConfigs,
WatchConfigsPredicate: watchConfigsPredicate,
WatchExternalArtifacts: allowExternalArtifact,
}); err != nil {
setupLog.Error(err, "unable to create controller", "controller", v2.HelmReleaseKind)
os.Exit(1)
Expand Down