-
Notifications
You must be signed in to change notification settings - Fork 345
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
Get rid of Linux specific scripts as much as possible #1072
Conversation
@@ -152,7 +152,7 @@ func (p *Plugin) createDaemonSetDefinition(hostname string, cert *tls.Certificat | |||
|
|||
podSpec.Containers = append(podSpec.Containers, | |||
p.Definition.Spec.Container, | |||
p.CreateWorkerContainerDefintion(hostname, cert, []string{"/run_single_node_worker.sh"}, []string{}, progressPort), | |||
p.CreateWorkerContainerDefintion(hostname, cert, []string{"/sonobuoy", "worker", "single-node", "-v=5", "--logtostderr", "--sleep=3600"}, []string{}, progressPort), |
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.
3600 is hardcoded but it is currently hardcoded in the script; no loss of flexibility. Though a constant would probably be a good idea.
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.
This command will be something that needs to work across OSs
In my POC this works fine on Windows nodes; the /
doesnt bother things and it finds the right executable.
We can't rely on the Dockerfile since it defaults to running the aggregator
and we wont know which OS to target unless we query and pass that around (and it would be very annoying to do so at first consideration)
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.
Yay for getting rid of those scripts and making the plugin drivers consistent 🎉
I approved this, but want to try out/check some things locally. I think the code changes look good though. I'm don't think there are any compatibility issues but I will do some testing then re-approve. |
Uh, I feel like this is another day when I'm forgetting about the order of when things are created. You mentioned that:
but I don't think I understand what you mean by that. Which command are you referring to? If you mean the call to the bash script, I don't see any uses of the script in the YAML (assuming you mean the output from |
I'm getting myself mixed up here 🙃 We want to rely on the Dockerfile to have the correct invocation so that it doesn't matter whether we're targetting Linux or Windows because the image will have the correct command. Although we were previously calling |
Yes; so previously the docker image So when running the aggregator we don't need to specify a command at all; the default value will be correct. When running as a sidecar to a job we were already setting the command to be `sonobuoy worker..; no change needed there. When running as a sidecar to a daemonset we were running a bash script (so it wasnt portable to Windows). Since that script was just Does that clarify the situations in which things are set or not and which things got modified in this PR? |
If you look at the master branch and run
So I removed that part of the yaml and rely on the default from the image (the Dockerfile |
Yep, I'm totally on board with those changes - that all makes sense.
I ran this locally, and they are pretty much the same as there are no changes to |
Apparently, it is missing! I didn't manually run gen again once I put up this PR and was mixing it up with my original, tinkering PR here: https://github.com/vmware-tanzu/sonobuoy/pull/1071/files#diff-ba4a4ef0b81ee6b7942cecf10da19388L124-L128 I'll add that change too and get tests green again. Thanks for the catch. |
So the one compatibility "issue" is just that a custom build of the master branch wont work properly since:
You just have to target a custom image or override the cmd in the gen output. Once we release v0.17.2 this won't be an issue though. |
If we are to support Windows nodes, we want to avoid using bash scripts so that we don't have to duplicate the logic and translate it into a powershell script. Changes include: - remove the run_master.sh script and instead rely on the Dockerfile to have the proper aggregator invocation. This way, regardless of the underlying OS, the image knows the right command to use. - remove the script for running the worker in single-node mode. This only served to run Sonobuoy and then sleep for some amount of time to avoid restarting the container. Instead, a flag was added to the single-node command and golang handles the sleep functionality now. By default it sleeps 0 seconds, consistent with the existing logic. - Slight modifications to command structure so that the subcommands can use the cobra RunE method and logging can be done at the top level only. This helps avoid using `os.Exit` which hinders testability. xref #732 Signed-off-by: John Schnake <[email protected]>
Clearly forgot to update the manifest.go since all those unit tests were green; now that I updated the template the "golden file" tests were incorrect. Updated those and rerunning. |
My hope is that this is something that should only affect those working on the project which might be a bit annoying in the meantime but we can try to target a release for later this week and get this change out. |
You also mentioned this in the PR description:
Given that the script doesn't specify |
What this PR does / why we need it:
If we are to support Windows nodes, we want to avoid using bash scripts
so that we don't have to duplicate the logic and translate it into a
powershell script.
Changes include:
to have the proper aggregator invocation. This way, regardless of the
underlying OS, the image knows the right command to use.
only served to run Sonobuoy and then sleep for some amount of time to
avoid restarting the container. Instead, a flag was added to the
single-node command and golang handles the sleep functionality now. By
default, it sleeps 0 seconds, consistent with the existing logic.
can use the cobra RunE method and logging can be done at the top level
only. This helps avoid using
os.Exit
which hinders testability.Which issue(s) this PR fixes
xref #732
Special notes for your reviewer:
We need to pause before merging this to make sure we recognize the compatibility issues this may cause (if any).
The CLI will not be specifying the command in the YAML anymore so:
Am I missing a compatibility case of concern?
Release note: