cilium-cli
cilium-cli copied to clipboard
ux: improve `cilium install`'s `wait` and `restart-unmanaged-pods` interaction
Context
For cilium install
:
-
wait
defaults totrue
-
restart-unmanaged-pods
totrue
- But
--restart-unmanaged-pods=true
"implies"--wait=true
behavior (this is expected because unmanaged pods can only be restarted after Cilium is ready):
https://github.com/cilium/cilium-cli/blob/c6ec394061fe01eeaef27d2d061d8b7b3db0626a/install/install.go#L1685-L1690
Issue
Manually specifying --wait=false
has no effect on its own from a code logic standpoint, since restart-unmanaged-pods=true
by default. In practice, this means that we always wait for Cilium pods to be ready even if --wait=false
is specified, except if also specifying --restart-unmanaged-pods=false
.
This is a bit surprising from a UX standpoint, because one could expect manually specifying --wait=false
to be "stronger" than the default value of restart-unmanaged-pods
.
Proposal
- If specifying
--wait=false
, implyrestart-unmanaged-pods=false
and add a warning to the user that unmanaged pods will not be restarted and need to be restarted manually. - If specifying
--restart-unmanaged-pods=false
, leave defaultwait=true
and add a warning to the user that unmanaged pods will not be restarted and need to be restarted manually. - If specifying
--wait=false
and--restart-unmanaged-pods=true
, fail due to flag incompatibility.
I think we can check for these scenarios using https://pkg.go.dev/github.com/spf13/pflag#FlagSet.Changed to know if a flag was changed from the CLI.
Further improvements
- Add a dedicated
cilium restart-unmanaged-pods
command (find a better name :D) to restart unmanaged pods at will if this was skipped atcilium install
time.