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

Day1 KMM solution should support V2 with scratch images #939

Conversation

yevgeny-shnaidman
Copy link
Member

Currently day1 solution relies on the fact that images kernel module images used are DTK-based image, and therefore contain modprobe command. Since KMM V2 we now support basic scratch images. This PR adds support for scratch images by running worker image with supplied config

Copy link

netlify bot commented Dec 21, 2023

Deploy Preview for openshift-kmm ready!

Name Link
🔨 Latest commit 77e4566
🔍 Latest deploy log https://app.netlify.com/sites/openshift-kmm/deploys/65af719c3174ee00085fe5f0
😎 Deploy Preview https://deploy-preview-939--openshift-kmm.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@openshift-ci openshift-ci bot requested review from chr15p and ybettan December 21, 2023 13:55
Copy link

openshift-ci bot commented Dec 21, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: yevgeny-shnaidman

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

@codecov-commenter
Copy link

codecov-commenter commented Dec 21, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (412785c) 76.13% compared to head (217eba0) 76.14%.

Files Patch % Lines
pkg/mcproducer/mcproducer.go 76.92% 2 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #939   +/-   ##
=======================================
  Coverage   76.13%   76.14%           
=======================================
  Files          63       63           
  Lines        5728     5730    +2     
=======================================
+ Hits         4361     4363    +2     
  Misses       1145     1145           
  Partials      222      222           

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

@@ -2,14 +2,14 @@
echo "before checking podman images"
if podman image exists {{.Image}}; then
echo "Image {{.Image}} found in the local registry, removing in-tree kernel module"
podman run --privileged --entrypoint modprobe {{.Image}} -rd /opt {{.KernelModule}}
podman run --user=root --privileged -v /etc/kmm-worker-day1/config.yaml:/etc/kmm-worker/config.yaml {{.Image}} kmod unload /etc/kmm-worker/config.yaml
Copy link
Collaborator

@ybettan ybettan Dec 24, 2023

Choose a reason for hiding this comment

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

What is the benefits of using kmod rather than modprobe? Looks like modprobe is just a link to kmod

Copy link
Member Author

Choose a reason for hiding this comment

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

this code actually runs worker pod, and kmod is part d the arguments to the worker app in the pod. modporbe will be called by the worker pod

Copy link
Collaborator

@ybettan ybettan Dec 24, 2023

Choose a reason for hiding this comment

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

Ohh OK. I was confused since there is a kmod binary loading kernel modules in Linux.

@qbarrand
Copy link
Contributor

qbarrand commented Jan 3, 2024

/hold
Until the worker pod can load from a tarfile instead of pulling an image.

@yevgeny-shnaidman yevgeny-shnaidman force-pushed the yevgeny/day1-scratch branch 2 times, most recently from cc7b81b to 217eba0 Compare January 22, 2024 13:40
pkg/mcproducer/mcproducer.go Outdated Show resolved Hide resolved
}
return fmt.Errorf("invalid image %s, input should be either in tag or digest format. Digest error %v, Tag error %v", image, digestErr, tagErr)

return "/var/lib/image_file_day1.tar", nil
Copy link
Contributor

Choose a reason for hiding this comment

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

This restricts the day1 solution to one image only. Should we make that path unique? See #920.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that a better solution would be to use soft dependencies: saves loading different MCOs, creating new additional services and pulling different images

Comment on lines +39 to +42
if string(expectedRes) != res {
fmt.Printf("<%s>\n", res)
fmt.Printf("<%s>\n", expectedRes)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like debugging to me 🙂

Copy link
Member Author

Choose a reason for hiding this comment

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

It was done intentionally: in case test fails, it would be easier to debug seeing the whole ouput of both MCO

@@ -1,13 +1,22 @@
#!/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe it is systemd calling those scripts, right? If yes, I think it would be cleaner if the variables were either environment variables or arguments configured in the unit file.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure i agree: those are one-shot services. We don not expect to configure/change them once they have been run. In addition having all the parameters defined in the scripts allows for easier testing of scripts as standalone

Currently day1 solution relies on the fact that images
kernel module images used are DTK-based image, and therefore
contain modprobe command. Since KMM V2 we now support basic scratch
images. This PR adds support for scratch images by running worker image
with supplied config
@qbarrand
Copy link
Contributor

qbarrand commented Jan 23, 2024

MGMT-16281

@qbarrand
Copy link
Contributor

/lgtm

@yevgeny-shnaidman
Copy link
Member Author

/unhold

@qbarrand qbarrand linked an issue Jan 23, 2024 that may be closed by this pull request
@yevgeny-shnaidman
Copy link
Member Author

/test lint

@openshift-merge-bot openshift-merge-bot bot merged commit bdb58f8 into rh-ecosystem-edge:main Jan 23, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KMM Day1 should support scratch images
4 participants