-
Notifications
You must be signed in to change notification settings - Fork 609
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
Make flux logs
more lenient
#3945
Conversation
@makkes can you provide an example of the output? Mostly trying to see how the |
done |
Can we please accommodate flux-aio. It’s a single pod, with a container per controller, the container name matches the controller name. |
One way we could solve this is to print the logs of all containers of a matching pod. In #2844 @hiddeco deliberately chose to show only the logs from the |
We can’t print logs of random containers as we’ll end up with Envoy/Linkerd/ngnix sidecars if people run Flux in a service mesh for mTLS. What I suggest is to look beside |
Shouldn't we first put the project under the Flux umbrella before facilitating changes for an experimental and semi-official project? |
Ok fair point. I can document why Regarding Azure, I could say the same thing, they shouldn’t label something as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we fail to recognize any Deployment and/or Pod at all, I would expect this to still return an error (and error code). While at present on a freshly bootstrapped cluster (without a flux-system
namespace, nor any components installed), it returns:
$ flux logs
$ echo $?
0
Ok, let's settle on a way forward. The options we have:
If we opt for 2. then we still need to decide if we want to add extra code to handle flux-aio or not. I'm on the fence about this because I don't know how many users actually use flux-aio at this point. Given it's not part of the Flux project I'd personally prefer to only handle flux-aio when it has been made part of the Flux project (or at least fluxcd-community). |
As I understand it, both Stefan and I agree that it should be option 2. But without taking However, I would still in some way like to see #3945 (review) covered. |
@stefanprodan said
That's why I brought option 1 up to begin with. |
Think failing as hard as we do for misconfigurations, and thereby breaking the primary feature of what it tries to offer -- is bad from a UX perspective in any case. Which makes this change unarguably better in comparison to what's offered now. |
Ok good. I'll address the remaining comment and ask for another round of reviews. |
7735e7a
to
926a4ce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better overall UX, thanks a lot @makkes 💯
UX changes: - Only print an error when a pod doesn't have a matching container instead of exiting early. - Return a non-zero status code when no pod is found at all. Details: In certain situations there might be 3rd-party pods running in the Flux namespace that cause the command to fail streaming logs, e.g. when they have multiple containers but none of them is called `manager` (which all Flux-maintained pods do). An example of such a situation is when Flux is installed with the 3rd-party Flux extension on AKS. The `logs` command is now more forgiving and merely logs an error in these situations instead of completely bailing out. It still returns a non-zero exit code. For the parallel log streaming with `-f` the code is now a little more complex so that errors are now written to stderr in parallel with all other logs written to stdout. That's what `asyncCopy` is for. refs #3944 Signed-off-by: Max Jonas Werner <[email protected]>
6b8afc9
to
cbdd71e
Compare
UX changes:
instead of exiting early.
Details:
In certain situations there might be 3rd-party pods running in the
Flux namespace that cause the command to fail streaming logs, e.g.
when they have multiple containers but none of them is called
manager
(which all Flux-maintained pods do). An example of such asituation is when Flux is installed with the 3rd-party Flux extension
on AKS.
The
logs
command is now more forgiving and merely logs an error inthese situations instead of completely bailing out. It still returns a
non-zero exit code.
For the parallel log streaming with
-f
the code is now a little morecomplex so that errors are now written to stderr in parallel with all
other logs written to stdout. That's what
asyncCopy
is for.Before:
After:
Tests
I changed the testing of the
logs
command and split the tests into unit and e2e tests so that the tests running the actual command are now run as part of the e2e suite so that they run against an actual cluster and we can test more complex scenarios and also because the command now fails if no pod can be found to print logs from.refs #3944