-
Notifications
You must be signed in to change notification settings - Fork 950
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
feature: add runtime config #1366
feature: add runtime config #1366
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1366 +/- ##
==========================================
+ Coverage 40.45% 40.55% +0.09%
==========================================
Files 253 254 +1
Lines 16466 16500 +34
==========================================
+ Hits 6662 6692 +30
- Misses 8948 8949 +1
- Partials 856 859 +3
|
main.go
Outdated
@@ -106,21 +102,17 @@ func setupFlags(cmd *cobra.Command) { | |||
flagSet.BoolVar(&cfg.EnableProfiler, "enable-profiler", false, "Set if pouchd setup profiler") | |||
flagSet.StringVar(&cfg.Pidfile, "pidfile", "/var/run/pouch.pid", "Save daemon pid") | |||
flagSet.IntVar(&cfg.OOMScoreAdjust, "oom-score-adj", -500, "Set the oom_score_adj for the daemon") | |||
} | |||
cfg.Runtimes = make(map[string]types.Runtime) |
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.
Why do alloc memory at here, NewRuntime will alloc memory
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.
Since we want get pointer of cfg.Runtime
and cfg.Runtime should have been initialized, or use secondary pointer is ok, but seems also need one more line xx = &cfg.Runtimes
, NewRuntime(&xx)
daemon/config/config.go
Outdated
func iterateConfig(origin map[string]interface{}, config map[string]interface{}) { | ||
for k, v := range origin { | ||
if k == "add-runtime" { |
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.
It looks so strange.
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.
Yes, for the history reason, TLS config is a map type.
return rt | ||
} | ||
|
||
// Set implement Runtime as pflag.Value interface |
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.
I think we should add unit test for this function.
@rudyfly @allencloud , I have update as the comment said, PTAL. |
CI fail because of
and
As already know fail test. |
1. support add-runtime in daemon 2. fix parse daemon flags twice, which make flags be set for twice 3. add runtime info in pouch info 4. fix slice-type flags merge not take effect, move merge flags operation in runDaemon, since(*cobra.Command).Execute() will do flags parse. Signed-off-by: Ace-Tang <aceapril@126.com>
LGTM |
Signed-off-by: Ace-Tang aceapril@126.com
Ⅰ. Describe what this PR did
operation in runDaemon, since(*cobra.Command).Execute() will do flags
parse.
Ⅱ. Does this pull request fix one issue?
Ⅲ. Describe how you did it
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews