Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/restart apps button applications list v2.12.3 #21306

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
fe60670
Bump version to 2.12.0-rc1 (#18716)
github-actions[bot] Jun 18, 2024
2a9a62e
fix(ui): set project to empty string if undefined (#18732) (#18733)
gcp-cherry-pick-bot[bot] Jun 20, 2024
16c20a8
fix(server): could not find source for metadata revision (#18744) (#1…
gcp-cherry-pick-bot[bot] Jun 24, 2024
00fc93b
fix: Bug in edit support in Sources tab; Input to loader (#17588) (#1…
gcp-cherry-pick-bot[bot] Jun 24, 2024
bbfa79a
Bump version to 2.12.0-rc2 (#18802)
github-actions[bot] Jun 24, 2024
e36e19d
chore(deps): bump github.com/hashicorp/go-retryablehttp (#18805) (#18…
gcp-cherry-pick-bot[bot] Jun 25, 2024
e616dff
fix(appset): revert "keep reconciling even when params error occurre…
crenshaw-dev Jun 25, 2024
573c771
fix(webhook): bitbucket and azure not triggering refresh (#18289) (#1…
gcp-cherry-pick-bot[bot] Jun 26, 2024
444d332
fix: Handle nil health check in post-delete hooks (#18270) (#18767) (…
gcp-cherry-pick-bot[bot] Jun 26, 2024
50c32b5
docs: Fix .path to .path.segments go template (#18872) (#18873)
gcp-cherry-pick-bot[bot] Jul 1, 2024
b211d3e
chore: bump gitops-engine (#18871)
crenshaw-dev Jul 1, 2024
1237d4e
Bump version to 2.12.0-rc3 (#18893)
github-actions[bot] Jul 2, 2024
81d4542
remove unwanted updating of source-position in app set command (#1888…
gcp-cherry-pick-bot[bot] Jul 2, 2024
beacacc
fix(appset): missing permissions (#18829) (#18943) (#18944)
gcp-cherry-pick-bot[bot] Jul 4, 2024
065f849
fix(cli): Get Redis password from secret in `loadClusters()` (#18951)…
gcp-cherry-pick-bot[bot] Jul 5, 2024
511d6e3
chore: bump gitops-engine (#19056)
agaudreault Jul 15, 2024
0704aa6
Bump version to 2.12.0-rc4 (#19060)
github-actions[bot] Jul 15, 2024
cec8504
fix: cherry-pick #18761 (v2.12) (#19109)
blakepettersson Jul 19, 2024
d926310
chore: revert "feat: removed legacy app tracking label (#13203)" (che…
gcp-cherry-pick-bot[bot] Jul 24, 2024
004cabb
fix(applicationset): ensure that older applicationStatus is updated w…
gcp-cherry-pick-bot[bot] Jul 25, 2024
eaa1972
feat: webhook ddos -2.12 (#19329)
pasha-codefresh Jul 31, 2024
d6c37aa
Merge commit from fork (#19330)
pasha-codefresh Jul 31, 2024
dee59f3
feat(rbac): allow validation of fine-grained policy in project (#1933…
gcp-cherry-pick-bot[bot] Aug 1, 2024
3e31ce9
fix: ArgoCD 2.11 - Loop of PATCH calls to Application objects (#19340…
gcp-cherry-pick-bot[bot] Aug 1, 2024
6f2ae0d
Bump version to 2.12.0-rc5 (#19349)
github-actions[bot] Aug 1, 2024
57e61b2
feat: Add custom health check for cluster-api AWSManagedControlPlane …
gcp-cherry-pick-bot[bot] Aug 2, 2024
ec30a48
Bump version to 2.12.0 (#19383)
github-actions[bot] Aug 5, 2024
fd47845
fix: docs version regex changed (#18756) (#19352)
ft-jasong Aug 8, 2024
b156b61
fix(appset): missing permissions for cluster install (#19059) (#19430…
gcp-cherry-pick-bot[bot] Aug 8, 2024
7af4526
fix: appset gpg limitation for templated project fields (#19492) (#19…
gcp-cherry-pick-bot[bot] Aug 14, 2024
952838c
fix(appset): cherry-pick - fix appset-in-any-namespace issue with git…
ishitasequeira Aug 15, 2024
26b2039
Bump version to 2.12.1 (#19568)
github-actions[bot] Aug 16, 2024
88f85da
fix: Parse hostname correctly from repoURL to fetch correct CA cert (…
gcp-cherry-pick-bot[bot] Aug 21, 2024
c873d5c
fix: Floating title content incorrect for multi-sources (#17274) (#19…
gcp-cherry-pick-bot[bot] Aug 21, 2024
b068220
fix(appset): informer is not a kubernetes informer (#18905) (#19618) …
gcp-cherry-pick-bot[bot] Aug 22, 2024
7244c2d
fix(appset): remove cache references (#19652)
rumstead Aug 22, 2024
560953c
Bump version to 2.12.2 (#19657)
github-actions[bot] Aug 23, 2024
343dec0
feat(sourceNamespace): Regex Support (#19016) (#19017) (#19664)
gcp-cherry-pick-bot[bot] Aug 23, 2024
cafd35c
fix(AnyNameSpaceRegex): Additional Functions Glob to Regexexp (#19516…
gcp-cherry-pick-bot[bot] Aug 23, 2024
6b9cd82
Bump version to 2.12.3 (#19694)
github-actions[bot] Aug 27, 2024
bebbbd5
feat: Add restart apps button on applications list page
audip Dec 24, 2024
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 VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.12.0
2.12.3
71 changes: 39 additions & 32 deletions applicationset/controllers/applicationset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/client-go/kubernetes"
k8scache "k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/record"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/builder"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
Expand Down Expand Up @@ -88,7 +86,6 @@ type ApplicationSetReconciler struct {
SCMRootCAPath string
GlobalPreservedAnnotations []string
GlobalPreservedLabels []string
Cache cache.Cache
}

// +kubebuilder:rbac:groups=argoproj.io,resources=applicationsets,verbs=get;list;watch;create;update;patch;delete
Expand Down Expand Up @@ -126,23 +123,26 @@ func (r *ApplicationSetReconciler) Reconcile(ctx context.Context, req ctrl.Reque
return ctrl.Result{}, nil
}

if err := r.migrateStatus(ctx, &applicationSetInfo); err != nil {
logCtx.Errorf("failed to migrate status subresource %v", err)
return ctrl.Result{}, err
}

// Log a warning if there are unrecognized generators
_ = utils.CheckInvalidGenerators(&applicationSetInfo)
// desiredApplications is the main list of all expected Applications from all generators in this appset.
desiredApplications, applicationSetReason, generatorsErr := r.generateApplications(logCtx, applicationSetInfo)
if generatorsErr != nil {
desiredApplications, applicationSetReason, err := r.generateApplications(logCtx, applicationSetInfo)
if err != nil {
_ = r.setApplicationSetStatusCondition(ctx,
&applicationSetInfo,
argov1alpha1.ApplicationSetCondition{
Type: argov1alpha1.ApplicationSetConditionErrorOccurred,
Message: generatorsErr.Error(),
Message: err.Error(),
Reason: string(applicationSetReason),
Status: argov1alpha1.ApplicationSetConditionStatusTrue,
}, parametersGenerated,
)
if len(desiredApplications) < 1 {
return ctrl.Result{}, generatorsErr
}
return ctrl.Result{RequeueAfter: ReconcileRequeueOnValidationError}, err
}

parametersGenerated = true
Expand Down Expand Up @@ -320,7 +320,7 @@ func (r *ApplicationSetReconciler) Reconcile(ctx context.Context, req ctrl.Reque

requeueAfter := r.getMinRequeueAfter(&applicationSetInfo)

if len(validateErrors) == 0 && generatorsErr == nil {
if len(validateErrors) == 0 {
if err := r.setApplicationSetStatusCondition(ctx,
&applicationSetInfo,
argov1alpha1.ApplicationSetCondition{
Expand Down Expand Up @@ -580,7 +580,7 @@ func (r *ApplicationSetReconciler) applyTemplatePatch(app *argov1alpha1.Applicat
func ignoreNotAllowedNamespaces(namespaces []string) predicate.Predicate {
return predicate.Funcs{
CreateFunc: func(e event.CreateEvent) bool {
return glob.MatchStringInList(namespaces, e.Object.GetNamespace(), false)
return glob.MatchStringInList(namespaces, e.Object.GetNamespace(), glob.REGEXP)
},
}
}
Expand Down Expand Up @@ -623,25 +623,6 @@ func (r *ApplicationSetReconciler) SetupWithManager(mgr ctrl.Manager, enableProg
Complete(r)
}

func (r *ApplicationSetReconciler) updateCache(ctx context.Context, obj client.Object, logger *log.Entry) {
informer, err := r.Cache.GetInformer(ctx, obj)
if err != nil {
logger.Errorf("failed to get informer: %v", err)
return
}
// The controller runtime abstract away informers creation
// so unfortunately could not find any other way to access informer store.
k8sInformer, ok := informer.(k8scache.SharedInformer)
if !ok {
logger.Error("informer is not a kubernetes informer")
return
}
if err := k8sInformer.GetStore().Update(obj); err != nil {
logger.Errorf("failed to update cache: %v", err)
return
}
}

// createOrUpdateInCluster will create / update application resources in the cluster.
// - For new applications, it will call create
// - For existing application, it will call update
Expand Down Expand Up @@ -743,7 +724,6 @@ func (r *ApplicationSetReconciler) createOrUpdateInCluster(ctx context.Context,
}
continue
}
r.updateCache(ctx, found, appLog)

if action != controllerutil.OperationResultNone {
// Don't pollute etcd with "unchanged Application" events
Expand Down Expand Up @@ -910,7 +890,6 @@ func (r *ApplicationSetReconciler) removeFinalizerOnInvalidDestination(ctx conte
if err := r.Client.Patch(ctx, updated, patch); err != nil {
return fmt.Errorf("error updating finalizers: %w", err)
}
r.updateCache(ctx, updated, appLog)
// Application must have updated list of finalizers
updated.DeepCopyInto(app)

Expand Down Expand Up @@ -1153,6 +1132,13 @@ func (r *ApplicationSetReconciler) updateApplicationSetApplicationStatus(ctx con
} else {
// we have an existing AppStatus
currentAppStatus = applicationSet.Status.ApplicationStatus[idx]

// upgrade any existing AppStatus that might have been set by an older argo-cd version
// note: currentAppStatus.TargetRevisions may be set to empty list earlier during migrations,
// to prevent other usage of r.Client.Status().Update to fail before reaching here.
if currentAppStatus.TargetRevisions == nil || len(currentAppStatus.TargetRevisions) == 0 {
currentAppStatus.TargetRevisions = app.Status.GetRevisions()
}
}

appOutdated := false
Expand Down Expand Up @@ -1350,6 +1336,27 @@ func findApplicationStatusIndex(appStatuses []argov1alpha1.ApplicationSetApplica
return -1
}

// migrateStatus run migrations on the status subresource of ApplicationSet early during the run of ApplicationSetReconciler.Reconcile
// this handles any defaulting of values - which would otherwise cause the references to r.Client.Status().Update to fail given missing required fields.
func (r *ApplicationSetReconciler) migrateStatus(ctx context.Context, appset *argov1alpha1.ApplicationSet) error {
update := false
if statusList := appset.Status.ApplicationStatus; statusList != nil {
for idx := range statusList {
if statusList[idx].TargetRevisions == nil {
statusList[idx].TargetRevisions = []string{}
update = true
}
}
}

if update {
if err := r.Client.Status().Update(ctx, appset); err != nil {
return fmt.Errorf("unable to set application set status: %w", err)
}
}
return nil
}

func (r *ApplicationSetReconciler) updateResourcesStatus(ctx context.Context, logCtx *log.Entry, appset *argov1alpha1.ApplicationSet, apps []argov1alpha1.Application) error {
statusMap := getResourceStatusMap(appset)
statusMap = buildResourceStatus(statusMap, apps)
Expand Down
Loading
Loading