You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added option to ignore regexp-matching users by scheduler. (#3477)
* Added option to ignore regexp-matching users by scheduler.
Signed-off-by: Peter Štibraný <[email protected]>
* CHANGELOG.md
Signed-off-by: Peter Štibraný <[email protected]>
* Fix config.
Signed-off-by: Peter Štibraný <[email protected]>
* Remove check if allowed users are set, when processing ignored user pattern.
User check logic is unchanged ... if user is not allowed, it is skipped.
If user is allowed, but ignored, it is skipped.
Signed-off-by: Peter Štibraný <[email protected]>
f.BoolVar(&cfg.KeepFiles, "scanner.keep-files", false, "Keep plan files locally after uploading.")
57
57
f.IntVar(&cfg.TablesLimit, "scanner.tables-limit", 0, "Number of tables to convert. 0 = all.")
58
58
f.StringVar(&cfg.AllowedUsers, "scanner.allowed-users", "", "Allowed users that can be converted, comma-separated. If set, only these users have plan files generated.")
59
-
f.StringVar(&cfg.IgnoredUserPattern, "scanner.ignore-users-regex", "", "If set and user ID matches this regex pattern, it will be ignored. Only used if all -scanner.allowed-users is not set (i.e. all users are allowed by default).")
59
+
f.StringVar(&cfg.IgnoredUserPattern, "scanner.ignore-users-regex", "", "If set and user ID matches this regex pattern, it will be ignored. Checked after applying -scanner.allowed-users, if set.")
60
60
f.BoolVar(&cfg.VerifyPlans, "scanner.verify-plans", true, "Verify plans before uploading to bucket. Enabled by default for extra check. Requires extra memory for large plans.")
61
61
f.Var(&cfg.PeriodStart, "scanner.scan-period-start", "If specified, this is lower end of time period to scan. Specified date is included in the range. (format: \"2006-01-02\")")
62
62
f.Var(&cfg.PeriodEnd, "scanner.scan-period-end", "If specified, this is upper end of time period to scan. Specified date is not included in the range. (format: \"2006-01-02\")")
@@ -115,7 +115,7 @@ func NewScanner(cfg Config, scfg blocksconvert.SharedConfig, l log.Logger, reg p
Copy file name to clipboardExpand all lines: tools/blocksconvert/scheduler/scheduler.go
+31-2Lines changed: 31 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@ import (
6
6
"html/template"
7
7
"net/http"
8
8
"path"
9
+
"regexp"
9
10
"sort"
10
11
"strconv"
11
12
"strings"
@@ -31,13 +32,15 @@ type Config struct {
31
32
PlanScanConcurrencyint
32
33
MaxProgressFileAge time.Duration
33
34
AllowedUsersstring
35
+
IgnoredUserPatternstring
34
36
}
35
37
36
38
func (cfg*Config) RegisterFlags(f*flag.FlagSet) {
37
39
f.DurationVar(&cfg.ScanInterval, "scheduler.scan-interval", 5*time.Minute, "How often to scan for plans and their status.")
38
40
f.IntVar(&cfg.PlanScanConcurrency, "scheduler.plan-scan-concurrency", 5, "Limit of concurrent plan scans.")
39
41
f.DurationVar(&cfg.MaxProgressFileAge, "scheduler.max-progress-file-age", 30*time.Minute, "Progress files older than this duration are deleted.")
40
42
f.StringVar(&cfg.AllowedUsers, "scheduler.allowed-users", "", "Allowed users that can be converted, comma-separated")
43
+
f.StringVar(&cfg.IgnoredUserPattern, "scheduler.ignore-users-regex", "", "If set and user ID matches this regex pattern, it will be ignored. Checked after applying -scheduler.allowed-users, if set.")
0 commit comments