cilium-cli icon indicating copy to clipboard operation
cilium-cli copied to clipboard

Begin warning on use of "--config" flag

Open ldelossa opened this issue 4 years ago • 4 comments

I ran into an interesting scenario the other night:

I was using the "--config" flag to set IPAM mode.

When using this flag the cilium CLI cannot known to fix-up any stale entries in the cilium-config config-map. Subsequently it left cluster-pool flags in the config even tho the kubernetes IPAM mode was configured.

In this instance, it was benign and no harm was done. However it's not a large stretch of the imagination to think where bugs could creep in from this.

In this case the Cilium CLI had a flag specifically for setting the ipam mode, which does all the correct things w/r/t updating the config map.

We should begin issuing warnings to users when we see a "--config=XYZ" settings which we have explicity created a smarter native cli flag.

In my case when I specified the "--config 'ipam.mode=kubernetes'" flag, we should spit out a warning saying something to the effect of "you probably want to use the --ipam flag instead".

ldelossa avatar Nov 05 '21 19:11 ldelossa

Subsequently it left cluster-pool flags in the config even tho the kubernetes IPAM mode was configured.

Shouldn't we also fatal in the agent if we have conflicting flags like this?

pchaigno avatar Nov 08 '21 09:11 pchaigno

@pchaigno - not exactly sure, we probably setup the code in a "feature flag" fashion where extraneous flags are ignored if some top level flag is not defined (like x.mode = ).

ldelossa avatar Nov 08 '21 16:11 ldelossa

Yep, but if this config. results in a broken cluster, we should check the options and fatal if they're not compatible.

pchaigno avatar Nov 08 '21 16:11 pchaigno

@pchaigno agreed, it did not wind up creating a broken cluster (just for full context), but I agree with your sentiment regardless.

ldelossa avatar Nov 08 '21 20:11 ldelossa