Skip to content

Commit

Permalink
Initialize appProject variable inside loop
Browse files Browse the repository at this point in the history
Signed-off-by: Philippe Da Costa <pdacosta@gmail.com>
  • Loading branch information
dacofr committed Sep 11, 2024
1 parent 0cc6e21 commit 3096e13
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion applicationset/controllers/applicationset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,6 @@ func (r *ApplicationSetReconciler) setApplicationSetStatusCondition(ctx context.
func (r *ApplicationSetReconciler) validateGeneratedApplications(ctx context.Context, desiredApplications []argov1alpha1.Application, applicationSetInfo argov1alpha1.ApplicationSet) (map[int]error, error) {
errorsByIndex := map[int]error{}
namesSet := map[string]bool{}
appProject := &argov1alpha1.AppProject{}
for i, app := range desiredApplications {
if !namesSet[app.Name] {
namesSet[app.Name] = true
Expand All @@ -474,6 +473,7 @@ func (r *ApplicationSetReconciler) validateGeneratedApplications(ctx context.Con
continue
}

appProject := &argov1alpha1.AppProject{}
err := r.Client.Get(ctx, types.NamespacedName{Name: app.Spec.Project, Namespace: r.ArgoCDNamespace}, appProject)
if err != nil {
if apierr.IsNotFound(err) {
Expand Down

0 comments on commit 3096e13

Please sign in to comment.