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 24, 2024
1 parent a712a44 commit bdea4a5
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 @@ -466,7 +466,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 @@ -475,6 +474,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 bdea4a5

Please sign in to comment.