-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
cmd: subnet-tags-filter: k=v
(and other options) silently fail when provided via ConfigMap
#18328
Comments
Let me give it a crack |
Just want to confirm the current behaviour. We are having below validation, which basically will check the flag value. And for the flag, only k=v format is accepted. So is either format not working at all right now ?
Line 3351 in d05dcb5
json format
kv format
|
@sayboras Yes, that looks consistent with my observations. Note that in Cilium v1.10 the former (JSON in ConfigMap) seems to be accepted, but this changed in v1.11. |
As mentioned in below upstream issue, there is a discrepancy in viper while reading string map string data type i.e. kv pair format was not supported, only `{"k":"v"}` format is allowed. This commit is to wrap GetStringMapString implementation to handle such case. Also, during the bootstrap, if there is any flag having invalid value, fatal log will be printed for early detection and awareness. Relates spf13/viper#911 Fixes cilium#18328 Signed-off-by: Tam Mach <tam.mach@isovalent.com>
As mentioned in below upstream issue, there is a discrepancy in viper while reading string map string data type i.e. kv pair format was not supported, only `{"k":"v"}` format is allowed. This commit is to wrap GetStringMapString implementation to handle such case. Also, during the bootstrap, if there is any flag having invalid value, fatal log will be printed for early detection and awareness. Relates spf13/viper#911 Fixes #18328 Signed-off-by: Tam Mach <tam.mach@isovalent.com>
[ upstream commit 768659f ] As mentioned in below upstream issue, there is a discrepancy in viper while reading string map string data type i.e. kv pair format was not supported, only `{"k":"v"}` format is allowed. This commit is to wrap GetStringMapString implementation to handle such case. Also, during the bootstrap, if there is any flag having invalid value, fatal log will be printed for early detection and awareness. Relates spf13/viper#911 Fixes cilium#18328 Signed-off-by: Tam Mach <tam.mach@isovalent.com> Signed-off-by: Jussi Maki <jussi@isovalent.com>
[ upstream commit 768659f ] As mentioned in below upstream issue, there is a discrepancy in viper while reading string map string data type i.e. kv pair format was not supported, only `{"k":"v"}` format is allowed. This commit is to wrap GetStringMapString implementation to handle such case. Also, during the bootstrap, if there is any flag having invalid value, fatal log will be printed for early detection and awareness. Relates spf13/viper#911 Fixes cilium#18328 Signed-off-by: Tam Mach <tam.mach@isovalent.com> Signed-off-by: Jussi Maki <jussi@isovalent.com>
[ upstream commit 768659f ] As mentioned in below upstream issue, there is a discrepancy in viper while reading string map string data type i.e. kv pair format was not supported, only `{"k":"v"}` format is allowed. This commit is to wrap GetStringMapString implementation to handle such case. Also, during the bootstrap, if there is any flag having invalid value, fatal log will be printed for early detection and awareness. Relates spf13/viper#911 Fixes #18328 Signed-off-by: Tam Mach <tam.mach@isovalent.com> Signed-off-by: Jussi Maki <jussi@isovalent.com>
[ upstream commit 768659f ] As mentioned in below upstream issue, there is a discrepancy in viper while reading string map string data type i.e. kv pair format was not supported, only `{"k":"v"}` format is allowed. This commit is to wrap GetStringMapString implementation to handle such case. Also, during the bootstrap, if there is any flag having invalid value, fatal log will be printed for early detection and awareness. Relates spf13/viper#911 Fixes #18328 Signed-off-by: Tam Mach <tam.mach@isovalent.com> Signed-off-by: Jussi Maki <jussi@isovalent.com>
Because string map options are configured `flags.Var`, they are assigned twice: Once in `flags.Var`, and then again in `option.Config.Populate()` with `GetStringMapString`. The latter is needed because it works around a viper bug where ConfigMap options were not properly parsed (cilium#18328). This commit ensures we're always using the result of the fallback parser, which fixes a bug where a ConfigMap value of `{}` was parsed as `map["{}":""]`. Fixes: 768659f ("cmd: Fix issue reading string map type via config map") Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
Because string map options are configured `flags.Var`, they are assigned twice: Once in `flags.Var`, and then again in `option.Config.Populate()` with `GetStringMapString`. The latter is needed because it works around a viper bug where ConfigMap options were not properly parsed (#18328). This commit ensures we're always using the result of the fallback parser, which fixes a bug where a ConfigMap value of `{}` was parsed as `map["{}":""]`. Fixes: 768659f ("cmd: Fix issue reading string map type via config map") Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
[ upstream commit 96e7fa6 ] Because string map options are configured `flags.Var`, they are assigned twice: Once in `flags.Var`, and then again in `option.Config.Populate()` with `GetStringMapString`. The latter is needed because it works around a viper bug where ConfigMap options were not properly parsed (#18328). This commit ensures we're always using the result of the fallback parser, which fixes a bug where a ConfigMap value of `{}` was parsed as `map["{}":""]`. Fixes: 768659f ("cmd: Fix issue reading string map type via config map") Signed-off-by: Sebastian Wicki <sebastian@isovalent.com> Signed-off-by: Quentin Monnet <quentin@isovalent.com>
[ upstream commit 96e7fa6 ] Because string map options are configured `flags.Var`, they are assigned twice: Once in `flags.Var`, and then again in `option.Config.Populate()` with `GetStringMapString`. The latter is needed because it works around a viper bug where ConfigMap options were not properly parsed (#18328). This commit ensures we're always using the result of the fallback parser, which fixes a bug where a ConfigMap value of `{}` was parsed as `map["{}":""]`. Fixes: 768659f ("cmd: Fix issue reading string map type via config map") Signed-off-by: Sebastian Wicki <sebastian@isovalent.com> Signed-off-by: Quentin Monnet <quentin@isovalent.com>
[ upstream commit 96e7fa6 ] Because string map options are configured `flags.Var`, they are assigned twice: Once in `flags.Var`, and then again in `option.Config.Populate()` with `GetStringMapString`. The latter is needed because it works around a viper bug where ConfigMap options were not properly parsed (#18328). This commit ensures we're always using the result of the fallback parser, which fixes a bug where a ConfigMap value of `{}` was parsed as `map["{}":""]`. Fixes: 768659f ("cmd: Fix issue reading string map type via config map") Signed-off-by: Sebastian Wicki <sebastian@isovalent.com> Signed-off-by: Quentin Monnet <quentin@isovalent.com>
[ upstream commit 96e7fa6 ] Because string map options are configured `flags.Var`, they are assigned twice: Once in `flags.Var`, and then again in `option.Config.Populate()` with `GetStringMapString`. The latter is needed because it works around a viper bug where ConfigMap options were not properly parsed (#18328). This commit ensures we're always using the result of the fallback parser, which fixes a bug where a ConfigMap value of `{}` was parsed as `map["{}":""]`. Fixes: 768659f ("cmd: Fix issue reading string map type via config map") Signed-off-by: Sebastian Wicki <sebastian@isovalent.com> Signed-off-by: Quentin Monnet <quentin@isovalent.com>
[ upstream commit 96e7fa6 ] Because string map options are configured `flags.Var`, they are assigned twice: Once in `flags.Var`, and then again in `option.Config.Populate()` with `GetStringMapString`. The latter is needed because it works around a viper bug where ConfigMap options were not properly parsed (#18328). This commit ensures we're always using the result of the fallback parser, which fixes a bug where a ConfigMap value of `{}` was parsed as `map["{}":""]`. Fixes: 768659f ("cmd: Fix issue reading string map type via config map") Signed-off-by: Sebastian Wicki <sebastian@isovalent.com> Signed-off-by: Quentin Monnet <quentin@isovalent.com>
When providing the flags like
subnet-tags-filter
via ConfigMap, we have assumed and documented that these flags (relying onGetStringMapString
) can be populated via ak=v
syntax. However, it turns out that when specified via ConfigMap, it needs to be JSON syntax ({"k":"v"}
), and not thek=v
syntax as documented. The latter syntax only works if directly passed via command-line argument.As a result, using
subnet-tags-filter: foo=bar
in the ConfigMap will cause cilium-operator to read the flag asnil
and not use any subnet filters at allAffected flags:
Upstream issue: spf13/viper#911
We should replace
viper.GetStringMapString
by something which behaves the same regardless of wheater the flag has been provided via command-line argument or config-dir (i.e. ConfigMap) entry.The text was updated successfully, but these errors were encountered: