-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Migrate elasticsearch rollover to go #3242
Migrate elasticsearch rollover to go #3242
Conversation
75894e5
to
00ace9f
Compare
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.
Good progress.
We should fix the PR to pass the CI and add tests.
} | ||
|
||
// InitFromViper initializes config from viper.Viper. | ||
func (c *Config) InitFromViper(v *viper.Viper) { |
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.
how are the common flags initialized?
292f897
to
deaa39b
Compare
Codecov Report
@@ Coverage Diff @@
## master #3242 +/- ##
==========================================
- Coverage 95.99% 95.85% -0.15%
==========================================
Files 242 259 +17
Lines 14815 15398 +583
==========================================
+ Hits 14221 14759 +538
- Misses 514 550 +36
- Partials 80 89 +9
Continue to review full report at Codecov.
|
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.
Looks good to me, now we should increase the test coverage.
5d43322
to
8795973
Compare
8795973
to
c48c9c7
Compare
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
…onality Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
fc02ef4
to
f1cbc10
Compare
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
f1cbc10
to
31c5a4e
Compare
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
eb290d8
to
e97f621
Compare
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
cmd/es-rollover/main.go
Outdated
) | ||
} | ||
|
||
func addRootFlags(v *viper.Viper, tlsFlags *tlscfg.ClientFlagsConfig, rootCmd *cobra.Command) { |
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.
nit: I would rename this to align with cobra terminology - persistent flags and the function could have the same signature as config.AddFlags
.
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 it would be better if the action config structs called added flags on the genetric config and do the same for the init viper.
// AddFlags adds flags for TLS to the FlagSet.
func (c *Config) AddFlags(flags *flag.FlagSet) {
flags.String(unit, defaultUnit, "used with lookback to remove indices from read alias e.g, days, weeks, months, years")
flags.Int(unitCount, defaultUnitCount, "count of UNITs")
c.Config.AddFlags(flags)
}
// InitFromViper initializes config from viper.Viper.
func (c *Config) InitFromViper(v *viper.Viper) {
c.Unit = v.GetString(unit)
c.UnitCount = v.GetInt(unitCount)
c.InitFromViper(v)
}
this way caller can be sure that the object is initalized property.
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 tried in this way and for some reason the repeated flags binds to different commands are not recognized, I was able to pass the flag, but wasn't able to recovery the value. So I leave as it is, using root persistent flags.
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 renamed the function and changed a little bit the signature, but still use persistent flags, so I add global flags to root, and call AddFlags for other subcommands config.
64999f6
to
9638822
Compare
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
9638822
to
ff0cc79
Compare
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Part of the work for migrate away from curator #3179
Which problem is this PR solving?
Short description of the changes
Future PRs: