Skip to content

Commit

Permalink
Use UniqueApplyForResourceVersion in Bundle and GitRepo GeneratingHan…
Browse files Browse the repository at this point in the history
…dlers
  • Loading branch information
aruiz14 committed Jan 12, 2024
1 parent 3eefdcc commit b4a5b24
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion internal/cmd/controller/controllers/bundle/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ func Register(ctx context.Context,
"bundle",
h.OnBundleChange,
&generic.GeneratingHandlerOptions{
AllowClusterScoped: true,
AllowClusterScoped: true,
UniqueApplyForResourceVersion: true,
})

relatedresource.Watch(ctx, "app", h.resolveBundle, bundles, bundleDeployments)
Expand Down
11 changes: 10 additions & 1 deletion internal/cmd/controller/controllers/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
v1 "github.com/rancher/gitjob/pkg/generated/controllers/gitjob.cattle.io/v1"
"github.com/rancher/wrangler/v2/pkg/apply"
corev1controller "github.com/rancher/wrangler/v2/pkg/generated/controllers/core/v1"
"github.com/rancher/wrangler/v2/pkg/generic"
"github.com/rancher/wrangler/v2/pkg/genericcondition"
"github.com/rancher/wrangler/v2/pkg/kv"
"github.com/rancher/wrangler/v2/pkg/name"
Expand Down Expand Up @@ -66,7 +67,15 @@ func Register(ctx context.Context,

gitRepos.OnChange(ctx, "gitjob-purge", h.DeleteOnChange)
// this will update the lastUpdateTime of the Accepted condition
fleetcontrollers.RegisterGitRepoGeneratingHandler(ctx, gitRepos, apply, "Accepted", "gitjobs", h.OnChange, nil)
fleetcontrollers.RegisterGitRepoGeneratingHandler(
ctx,
gitRepos,
apply,
"Accepted",
"gitjobs",
h.OnChange,
&generic.GeneratingHandlerOptions{UniqueApplyForResourceVersion: true},
)
// enqueue gitrepo when gitjob changes
relatedresource.Watch(ctx, "gitjobs",
relatedresource.OwnerResolver(true, fleet.SchemeGroupVersion.String(), "GitRepo"), gitRepos, gitJobs)
Expand Down

0 comments on commit b4a5b24

Please sign in to comment.