-
Notifications
You must be signed in to change notification settings - Fork 194
Combine all initializer commands with && to catch any failing commands #453
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
base: main
Are you sure you want to change the base?
Conversation
24e2177 to
a054bf7
Compare
|
@frittentheke, thank you for the PR! It seems like you have opened 2 PRs for the same issue? Could you please leave only one? Quickly skimming the code, the change seems reasonable on the first glance, but I need to look up the details there again. Additionally, this change requires testing. I'll be able to fully review this in a couple of weeks approx. Hope that's alright! |
I changed one to draft and shall remove the "fixes" reference to this issue. It is simply not "just" a bugfix. Thanks for looking into and testing #453 |
|
@frittentheke, sorry for the delay! I've finally managed to test this PR a bit. So there are 2 parts:
|
|
Hi @frittentheke, would you be able to modify the PR to leave only the first change, in |
@yorugac sorry for the delay ... Regarding 1) I created a new PR with just the var typo fixed: #465 As for 2) : I'd like to argue that the current flow actually only handles certain types of errors - those that go into that very output file To me any unexpected non-zero return code should be handled as an error (I know about grafana/k6#2804, #75, ...). A while back I started a bigger PR (#450) completely reworking the way the initializer works through the various tasks and then sends off it's verdict via termination log, the kubernetes-native way of handling this phase (https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/). But that PR / discussion is for another day I suppose. If you even like the idea to rework the whole thing to make it a lot more robust. |
By running two commands instead of one (the second being the cat | grep), any failures (non-zero exit code) of the first part (containing `k6 inspect`) will be lost and masked away. By chaining them all with `&&` the first non-zero RC will fail the whole command and return. Fixes: grafana#435
a054bf7 to
8008a90
Compare
|
Hi @frittentheke, apologies for this delay! I've got swamped with internal work. And thank you for your patience! 😂 You described this case:
AFAIR, when imports are off, there should be logs left in initializer which then should cause an error in k6-operator on JSON unmarshal. It sounds like it wasn't so for you, so no logs despite the import error? If so, could you please share a script how to repeat that situation? |
|
Sorry @yorugac for again getting back to you late on this one ... But I just remembered when we ran into yet another issue of this kind ;-)
Yes, that is indeed the case: but this requires someone to look at the logs and does not contain any real clues to what the issue (of the initializer run) is. I'd then really love to discuss a redesign the likes of #450 to give the user back the log output (STDOUT + STDERR) for the initializer. |
|
Hi @frittentheke, it's been a terrible delay; my apologies! I've finally found the time to get to reviewing all the open PRs. Looking at your use case with fresh eyes. Let's look at an invalid script with a faulty import: import { invalid } from 'non-existent';
export default function() {
...With the latest version of k6-operator, this script makes initializer pod exit with 1: State: Terminated
Reason: Error
Exit Code: 1Then in k6-operator logs I see this: And looking at initializer pod logs: So as you see, I don't get the behaviour you described. Perhaps, there was some change lately, though it doesn't seem so by git history... I'd like to be clear on what use case we're trying to improve or fix here. I.e. a repeatable scenario. The issue #435 does not have it either. Could you please provide a repeatable use case where current logic fails? |
|
I've tried the script with direct import of JS file too: import "./invalid.js";
...The same thing as in the above comment. |
By running two commands instead of one (the second being the cat | grep), any failures (non-zero exit code) of the first part (containing
k6 inspect) will be lost and masked away.By chaining them all with
&&the first non-zero RC will fail the whole command and return.Fixes: #435