[v0.11] cmd: Introduce HUBBLE_COMPAT=legacy-json-output
#866
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[ upstream commit 221b8ea ]
This commit introduces a new environment variable,
HUBBLE_COMPAT
, which can be used to restore old behavior in the presence of breaking changes. It's inspired by Golang's GODEBUG variable documented here: https://pkg.go.dev/runtimeThe intent of this flag is to allow us introduce breaking changes in the CLI, while still preserving backwards-compatibility with older versions where needed. As an example, this commit also bring back the legacy
-o json
flow schema ifHUBBLE_COMPAT
is set tolegacy-json-output
. This allows older Cilium stable versions to pull in a newer version of the Hubble CLI as part of security updates, while preserving the behavior of the Hubble CLI that originally shipped with that Cilium version.HUBBLE_COMPAT options are not intended to be supported indefinitely. Rather, compat options may be removed once the ecosystem (such as downstream users like the Cilium-Agent image) has caught up.
We use an environment variable instead of a viper flag to ensure that we could also use it to modify the behavior of viper or pflags if needed in the future.
Signed-off-by: Sebastian Wicki sebastian@isovalent.com