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

🐛 Fixing vmtoolsd path for/on a flatcar image #2660

Merged
merged 12 commits into from
Jan 29, 2024

Conversation

PatrickLaabs
Copy link
Contributor

What this PR does / why we need it:
With this PR we do change the reference to the binary 'vmtoolsd'.
We removed the absolut path from

ExecStart=/usr/bin/bash -cv 'echo "COREOS_CUSTOM_HOSTNAME=$(/usr/share/oem/bin/vmtoolsd --cmd "info-get guestinfo.metadata" | base64 -d | grep local-hostname | awk {\'print $2\'} | tr -d \'"\')" > $${OUTPUT}'

to just use the vmtoolsd binary, which is already available inside the PATH:

ExecStart=/usr/bin/bash -cv 'echo "COREOS_CUSTOM_HOSTNAME=$(vmtoolsd --cmd "info-get guestinfo.metadata" | base64 -d | grep local-hostname | awk {\'print $2\'} | tr -d \'"\')" > $${OUTPUT}'

With this change, the kubeadm is able to do it thing and properly find the binary needed.
Without this change, the operation will fail, because the binary cannot be located at the specified path.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #2657

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 25, 2024
@k8s-ci-robot k8s-ci-robot requested review from srm09 and vrabbi January 25, 2024 21:47
@k8s-ci-robot
Copy link
Contributor

Hi @PatrickLaabs. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 25, 2024
@sbueringer
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 26, 2024
Copy link

codecov bot commented Jan 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (779f6ac) 64.62% compared to head (0c100d6) 64.70%.
Report is 14 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2660      +/-   ##
==========================================
+ Coverage   64.62%   64.70%   +0.08%     
==========================================
  Files         118      118              
  Lines        8580     8580              
==========================================
+ Hits         5545     5552       +7     
+ Misses       2602     2597       -5     
+ Partials      433      431       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sbueringer
Copy link
Member

sbueringer commented Jan 26, 2024

The change looks good to me.

I'm wondering why our ignition e2e test didn't catch this before (we're testing with flatcar-stable-3602.2.3-kube-v1.29.0)

Are you using image-builder or are you building your images a different way? (which is totally fine, just trying to understand the difference between our e2e tests and the error you got)

@sbueringer
Copy link
Member

Looking at the CI failure I wonder if the binary is in the PATH in the image-builder flatcar image

@PatrickLaabs
Copy link
Contributor Author

PatrickLaabs commented Jan 26, 2024

Mhh.. weird.
I used the official image builder in its latest state.
I will double check my image, and might change to the absolut path where the vmtoolsd binary actually exists.

Edit:
To clarify: I am using the image builder, and builded a flatcar image "flatcar-stable-3760.2.0-kube-v1.28.6"

Here is a screenshot from inside my flatcar image, with the above mentioned version:
Screenshot 2024-01-26 at 09 17 42

@PatrickLaabs
Copy link
Contributor Author

Ok, next try. I will build another flatcar image with the version you provided and double check.

@PatrickLaabs
Copy link
Contributor Author

PatrickLaabs commented Jan 26, 2024

Ok, now is see the problem.

On a flatcar image in version stable-3602.2.3 the binary can be found here:
Screenshot 2024-01-26 at 10 59 42

When using flatcar in version stable-3760.2.0 the binary can be found here:
Screenshot 2024-01-26 at 11 02 24

@sbueringer
Shall we consider to upgrade flatcar to the latest release, to ensure that CAPV works with the latest changes inside the image-builder?

Workaround:
If one might want to build their own custom image, the version has to be set to the correct/working flatcar version for CAPV.

export FLATCAR_VERSION=3602.2.3

@chrischdi
Copy link
Member

🤔 at best we would be compatible with both.

To summarise: we have flatcar versions where vmtoolsd is at :

  • /usr/share/oem/bin/vmtoolsd (<= 3602.2.3)
  • /usr/bin/vmtoolsd >= 3760.2.0

We could even pack the whole script here into a bash script and pass it via files 🤔

      ExecStart=/usr/bin/bash -cv 'echo "COREOS_CUSTOM_HOSTNAME=$(/usr/bin/vmtoolsd --cmd "info-get guestinfo.metadata" | base64 -d | grep local-hostname | awk {\'print $2\'} | tr -d \'"\')" > $${OUTPUT}'

Idea: a command like find /usr/share /usr/bin -iname "vmtoolsd" -type f | head -n 1 could maybe help to determine the binary path.

@PatrickLaabs
Copy link
Contributor Author

Ye, supporting both variants might be the better approach. I will do some testings.

@chrischdi
Copy link
Member

/retitle 🐛 Fixing vmtoolsd path for/on a flatcar image

@k8s-ci-robot k8s-ci-robot changed the title 🐛 2657 - Fixing vmtoolsd path for/on a flatcar image 🐛 Fixing vmtoolsd path for/on a flatcar image Jan 26, 2024
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 26, 2024
@PatrickLaabs
Copy link
Contributor Author

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 26, 2024
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 26, 2024
@@ -67,7 +67,7 @@ systemd:
RemainAfterExit=yes
Environment=OUTPUT=/run/metadata/coreos
ExecStart=/usr/bin/mkdir --parent /run/metadata
ExecStart=/usr/bin/bash -cv 'echo "COREOS_CUSTOM_HOSTNAME=$(/usr/share/oem/bin/vmtoolsd --cmd "info-get guestinfo.metadata" | base64 -d | grep local-hostname | awk {\'print $2\'} | tr -d \'"\')" > $${OUTPUT}'
ExecStart=/usr/bin/bash -cv 'VMTOOLSD_PATH=$(find /usr -iname 'vmtoolsd' -executable); if [[ -n "$vmtoolsd_path" ]]; then echo "COREOS_CUSTOM_HOSTNAME=$("$VMTOOLSD_PATH" --cmd "info-get guestinfo.metadata" | base64 -d | grep local-hostname | awk {\'print $2\'} | tr -d \'"\')" > $${OUTPUT}; else echo "vmtoolsd not found in /usr/share/oem/bin/ or /usr/bin/"; fi'
Copy link
Member

Choose a reason for hiding this comment

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

Let's add a comment on why we are doing this :-) (at place X for version Y and place a for version B).

What do you think about only using if / else? The path should not change too much right?

Suggested change
ExecStart=/usr/bin/bash -cv 'VMTOOLSD_PATH=$(find /usr -iname 'vmtoolsd' -executable); if [[ -n "$vmtoolsd_path" ]]; then echo "COREOS_CUSTOM_HOSTNAME=$("$VMTOOLSD_PATH" --cmd "info-get guestinfo.metadata" | base64 -d | grep local-hostname | awk {\'print $2\'} | tr -d \'"\')" > $${OUTPUT}; else echo "vmtoolsd not found in /usr/share/oem/bin/ or /usr/bin/"; fi'
ExecStart=/usr/bin/bash -cv 'echo "COREOS_CUSTOM_HOSTNAME=$("$(find /usr/bin /usr/share/oem -name vmtoolsd -type f -executable 2>/dev/null | head -n 1)" --cmd "info-get guestinfo.metadata" | base64 -d | grep local-hostname | awk {\'print $2\'} | tr -d \'"\')" > $${OUTPUT}'

Copy link
Member

Choose a reason for hiding this comment

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

Maybe only use find to gather the command and let it fail if it fails?

we need -type f because directories can also be executable.

Also I think we don't have to search through the whole /usr directory. better to have some well-known paths to search in.

Copy link
Member

Choose a reason for hiding this comment

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

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion!
I will try this one out. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @chrischdi ,
i tried your suggestion on flatcar version 3602 and 3760.
I was able to successfully spawn the control plane and the worker nodes.

@sbueringer
Copy link
Member

/retest

@PatrickLaabs
Copy link
Contributor Author

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 27, 2024
@PatrickLaabs
Copy link
Contributor Author

The latest change on finding the vmtoolsd binary on the different pathes has been tested on my vsphere instance with CAPV v1.9.0 on the flatcar version '3602' and '3760'.

I was able successfully spawn the controlplane and worker nodes.
CNI has also successfully been deployed to make each node become ready.

Lets see, what the CI has to say about it 😄

@PatrickLaabs
Copy link
Contributor Author

/retest

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Jan 27, 2024

@PatrickLaabs: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cluster-api-provider-vsphere-e2e-main ffefecb link true /test pull-cluster-api-provider-vsphere-e2e-main
pull-cluster-api-provider-vsphere-apidiff-main 0c100d6 link false /test pull-cluster-api-provider-vsphere-apidiff-main

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@chrischdi
Copy link
Member

Note: failure of pull-cluster-api-provider-vsphere-e2e-blocking-main is unrelated. Its an CI env issue...

@sbueringer
Copy link
Member

/test pull-cluster-api-provider-vsphere-e2e-blocking-main

@PatrickLaabs
Copy link
Contributor Author

The failing test "pull-cluster-api-provider-vsphere-apidiff-main" gets me curious. Did i missed something? 😱

@chrischdi
Copy link
Member

chrischdi commented Jan 29, 2024

Nope, that one is fine. It just notices us that a function signature changes. Which is fine in this case, because its only flavorgen code.

(Edit: it does not impact merging / tide)

@chrischdi
Copy link
Member

/test help

@k8s-ci-robot
Copy link
Contributor

@chrischdi: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test pull-cluster-api-provider-vsphere-e2e-blocking-main
  • /test pull-cluster-api-provider-vsphere-e2e-conformance-ci-latest-main
  • /test pull-cluster-api-provider-vsphere-e2e-conformance-main
  • /test pull-cluster-api-provider-vsphere-e2e-main
  • /test pull-cluster-api-provider-vsphere-e2e-upgrade-1-29-1-30-main
  • /test pull-cluster-api-provider-vsphere-test-integration-main
  • /test pull-cluster-api-provider-vsphere-test-main
  • /test pull-cluster-api-provider-vsphere-verify-main

The following commands are available to trigger optional jobs:

  • /test pull-cluster-api-provider-vsphere-apidiff-main

Use /test all to run the following jobs that were automatically triggered:

  • pull-cluster-api-provider-vsphere-apidiff-main
  • pull-cluster-api-provider-vsphere-e2e-blocking-main
  • pull-cluster-api-provider-vsphere-test-integration-main
  • pull-cluster-api-provider-vsphere-test-main
  • pull-cluster-api-provider-vsphere-verify-main

In response to this:

/test help

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@chrischdi
Copy link
Member

/approve

/assign sbueringer

For lgtm

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chrischdi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 29, 2024
@PatrickLaabs
Copy link
Contributor Author

Nope, that one is fine. It just notices us that a function signature changes. Which is fine in this case, because its only flavorgen code.

(Edit: it does not impact merging / tide)

Thanks for the clearification 👍

@sbueringer
Copy link
Member

Looks good, thx!

@sbueringer
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 29, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 38dd85ac1cb1898d281448bcc8a6c2577e268ddd

@k8s-ci-robot k8s-ci-robot merged commit 205be7e into kubernetes-sigs:main Jan 29, 2024
17 of 18 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.9 milestone Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Flatcar on vSphere (ova) - vmtoolsd. Path is not correct.
4 participants