Skip to content
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: Introduce HUBBLE_COMPAT=legacy-json-output #865

Merged
merged 1 commit into from
Jan 24, 2023

Conversation

gandro
Copy link
Member

@gandro gandro commented Jan 24, 2023

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/runtime

The 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 if HUBBLE_COMPAT is set to legacy-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

@gandro gandro added ⌨️ area/cli Impacts the command line interface of any command in the repository. release-note/misc This PR makes changes that have no direct user impact. needs-backport/0.11 This PR needs backporting to the v0.11 branch labels Jan 24, 2023
@gandro gandro requested a review from a team as a code owner January 24, 2023 15:21
@gandro gandro requested review from chancez and rolinh and removed request for a team January 24, 2023 15:21
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/runtime

The 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 if `HUBBLE_COMPAT` is set to `legacy-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>
Copy link
Member

@rolinh rolinh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The approach and implementation look good to me, thanks!

Related to breaking changes, I was wondering whether we shouldn't document somewhere that we don't guarantee backwards compatible changes on the compact output or any format other than json. What do you think?

@gandro
Copy link
Member Author

gandro commented Jan 24, 2023

Related to breaking changes, I was wondering whether we shouldn't document somewhere that we don't guarantee backwards compatible changes on the compact output or any format other than json. What do you think?

Yes, I think that's reasonable. Let's do that in a separate PR by adding it e.g. to the README.

@gandro gandro merged commit 221b8ea into master Jan 24, 2023
@gandro gandro deleted the pr/gandro/hubble-compat branch January 24, 2023 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⌨️ area/cli Impacts the command line interface of any command in the repository. needs-backport/0.11 This PR needs backporting to the v0.11 branch release-note/misc This PR makes changes that have no direct user impact.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants