-
Notifications
You must be signed in to change notification settings - Fork 670
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(propeller): Support multiple namespaces for limit-namespace #5342
base: master
Are you sure you want to change the base?
feat(propeller): Support multiple namespaces for limit-namespace #5342
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To help the reviewer to review my code, here are some comments.
propellerScope := promutils.NewScope(propellerConfig.GetConfig().MetricsPrefix).NewSubScope("propeller").NewSubScope(propellerCfg.LimitNamespace) | ||
limitNamespace := "" | ||
var namespaceConfigs map[string]cache.Config | ||
propellerScope := promutils.NewScope(propellerConfig.GetConfig().MetricsPrefix).NewSubScope("propeller").NewSubScope(strings.Replace(propellerCfg.LimitNamespace, ",", "-", -1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ,
character is invalid in prometheus. Therefore I replace it with -
here.
propellerScope := promutils.NewScope(cfg.MetricsPrefix).NewSubScope("propeller").NewSubScope(cfg.LimitNamespace) | ||
limitNamespace := "" | ||
var namespaceConfigs map[string]cache.Config | ||
propellerScope := promutils.NewScope(cfg.MetricsPrefix).NewSubScope("propeller").NewSubScope(strings.Replace(cfg.LimitNamespace, ",", "-", -1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
if strings.Contains(g.namespace, ",") { | ||
namespaces = strings.Split(g.namespace, ",") | ||
} else { | ||
namespaces = make([]string, 0) | ||
for _, n := range namespaceList.Items { | ||
namespaces = append(namespaces, n.GetName()) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Treat all
and comma-separated namespaces as the same case. Transform them into a slice of string and then loop over it.
if strings.Contains(g.namespace, ",") { | ||
namespaces = strings.Split(g.namespace, ",") | ||
} else { | ||
namespaces = make([]string, 0) | ||
for _, n := range namespaceList.Items { | ||
namespaces = append(namespaces, n.GetName()) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5342 +/- ##
==========================================
- Coverage 60.23% 60.22% -0.01%
==========================================
Files 646 646
Lines 45664 45680 +16
==========================================
+ Hits 27505 27513 +8
- Misses 15569 15573 +4
- Partials 2590 2594 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
fcb0598
to
a3e2cfc
Compare
Resolves: flyteorg#5181 Signed-off-by: Chi-Sheng Liu <[email protected]>
a3e2cfc
to
217288f
Compare
Tracking issue
Resolves: #5181
Why are the changes needed?
The
limit-namespace
config only accepts a single namespace. It should accept multiple namespaces instead of only a single namespace.What changes were proposed in this pull request?
To ensure backward compatibility, this PR makes
limit-namespace
option to be able to accept comma-separated string.How was this patch tested?
Setup process
Screenshots
Check all the applicable boxes
Related PRs
Docs link