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

fix: Correctly call kubectl to get all known images of the node #9408

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ComaVN
Copy link

@ComaVN ComaVN commented May 2, 2024

Fixes: #4955

Description

When checking if images are already present on the k8s node, os.exec is used, which doesn't go through any shell expansion, so it doesn't require quoting any arguments (quotes are passed through as-is).
This means the first image returned had a ' prepended to the name, and the last image had a ' appended, which causes issue #4955

User facing changes (remove if N/A)

A few less unnecessary image reloads :)

Follow-up Work (remove if N/A)

There are a few more places where jsonpath='(...)' shows up in an os.exec call, someone might want to check those. I noticed at least some of them were "fixed" by trimming the quotes from the output.

Copy link

google-cla bot commented May 2, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

The single quotes around the `jsonpath` expression are incorrect: they are only needed when called in a shell, not when using `os.exec`
The result was that the first image returned had a `'` prepended to the name, and the last image had a `'` appended, meaning that those images would never be considered already loaded.

issue GoogleContainerTools#4955
@ericzzzzzzz
Copy link
Contributor

Hi @ComaVN Thanks for the fix!!

@ComaVN ComaVN force-pushed the fix-4955-dont-reload-unchanged-images branch from 909cc0a to 939a520 Compare June 3, 2024 12:29
@ComaVN
Copy link
Author

ComaVN commented Jun 3, 2024

rebased to fix unrelated unit test failures

@ericzzzzzzz ericzzzzzzz added the kokoro:force-run forces a kokoro re-run on a PR label Jun 3, 2024
@kokoro-team kokoro-team removed the kokoro:force-run forces a kokoro re-run on a PR label Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Skaffold reloads unchanged, existing image again into the cluster
3 participants