Skip to content

Commit

Permalink
fix: always update folder permissions after resync period has elapsed
Browse files Browse the repository at this point in the history
  • Loading branch information
JameelB committed Jul 19, 2023
1 parent 105912d commit f83704f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion controllers/grafanafolder_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,11 @@ func (r *GrafanaFolderReconciler) onFolderCreated(ctx context.Context, grafana *
return err
}

// always update after resync period has elapsed even if cr is unchanged.
if exists && cr.Unchanged() && !cr.ResyncPeriodHasElapsed() {
return nil
}

if exists {
// Add to status to cover cases:
// - operator have previously failed to update status
Expand Down Expand Up @@ -333,7 +338,7 @@ func (r *GrafanaFolderReconciler) onFolderCreated(ctx context.Context, grafana *
}

// NOTE: it's up to a user to reset permissions with correct json
if !cr.Unchanged() && cr.Spec.Permissions != "" {
if cr.Spec.Permissions != "" {
permissions := grapi.PermissionItems{}
err = json.Unmarshal([]byte(cr.Spec.Permissions), &permissions)
if err != nil {
Expand Down

0 comments on commit f83704f

Please sign in to comment.