Skip to content

cmd: subnet-tags-filter: k=v (and other options) silently fail when provided via ConfigMap #18328

@gandro

Description

@gandro

When providing the flags like subnet-tags-filter via ConfigMap, we have assumed and documented that these flags (relying on GetStringMapString) can be populated via a k=v syntax. However, it turns out that when specified via ConfigMap, it needs to be JSON syntax ({"k":"v"}), and not the k=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 as nil and not use any subnet filters at all

Affected flags:

pkg/option/config.go
2771:	if m := viper.GetStringMapString(FixedIdentityMapping); len(m) != 0 {
2777:	if m := viper.GetStringMapString(KVStoreOpt); len(m) != 0 {
2781:	if m := viper.GetStringMapString(LogOpt); len(m) != 0 {
2785:	if m := viper.GetStringMapString(APIRateLimitName); len(m) != 0 {

operator/option/config.go
449:	if m := viper.GetStringMapString(IPAMSubnetsTags); len(m) != 0 {
453:	if m := viper.GetStringMapString(AWSInstanceLimitMapping); len(m) != 0 {
457:	if m := viper.GetStringMapString(ENITags); len(m) != 0 {

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.

Metadata

Metadata

Assignees

Labels

area/cliImpacts the command line interface of any command in the repository.kind/bugThis is a bug in the Cilium logic.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions