mirror of
https://github.com/argoproj/argo-cd
synced 2026-04-21 17:07:16 +00:00
Merge 35e2298b58 into e0e827dab0
This commit is contained in:
commit
041207f056
1 changed files with 15 additions and 9 deletions
|
|
@ -12,7 +12,6 @@ import (
|
|||
"strings"
|
||||
"sync"
|
||||
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/client-go/util/retry"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
|
|
@ -26,6 +25,7 @@ import (
|
|||
"github.com/go-playground/webhooks/v6/github"
|
||||
"github.com/go-playground/webhooks/v6/gitlab"
|
||||
log "github.com/sirupsen/logrus"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/argoproj/argo-cd/v3/util/guard"
|
||||
)
|
||||
|
|
@ -611,14 +611,20 @@ func (h *WebhookHandler) shouldRefreshMergeGenerator(gen *v1alpha1.MergeGenerato
|
|||
func refreshApplicationSet(c client.Client, appSet *v1alpha1.ApplicationSet) error {
|
||||
// patch the ApplicationSet with the refresh annotation to reconcile
|
||||
return retry.RetryOnConflict(retry.DefaultBackoff, func() error {
|
||||
err := c.Get(context.Background(), types.NamespacedName{Name: appSet.Name, Namespace: appSet.Namespace}, appSet)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting ApplicationSet: %w", err)
|
||||
gvk := v1alpha1.ApplicationSetSchemaGroupVersionKind
|
||||
patchObj := &metav1.PartialObjectMetadata{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: gvk.Kind,
|
||||
APIVersion: gvk.GroupVersion().String(),
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: appSet.Name,
|
||||
Namespace: appSet.Namespace,
|
||||
Annotations: map[string]string{
|
||||
common.AnnotationApplicationSetRefresh: "true",
|
||||
},
|
||||
},
|
||||
}
|
||||
if appSet.Annotations == nil {
|
||||
appSet.Annotations = map[string]string{}
|
||||
}
|
||||
appSet.Annotations[common.AnnotationApplicationSetRefresh] = "true"
|
||||
return c.Patch(context.Background(), appSet, client.Merge)
|
||||
return c.Patch(context.Background(), patchObj, client.Merge)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue