Skip to content

[WIP] Initial PR for consuming gvproxy/macadam/cloud-init for crc-ng - #5025

Open
praveenkumar wants to merge 28 commits into
crc-org:crc-ngfrom
praveenkumar:crc-ng
Open

[WIP] Initial PR for consuming gvproxy/macadam/cloud-init for crc-ng#5025
praveenkumar wants to merge 28 commits into
crc-org:crc-ngfrom
praveenkumar:crc-ng

Conversation

@praveenkumar

Copy link
Copy Markdown
Member

No description provided.

@coderabbitai

coderabbitai Bot commented Nov 28, 2025

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 797da8c7-ca7b-49ff-b4f0-18d77540fed0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@praveenkumar

Copy link
Copy Markdown
Member Author

/retest

Comment thread pkg/crc/cache/cache.go
return newCache(constants.GvproxyPath(),
url,
version,
func(executable string) (string, error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NewAdminHelperCache uses exactly the same function, might be desirable to share that code.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, we can share the code for getting the version info. May be a followup or new commit.

Comment thread pkg/crc/preflight/preflight_checks_common.go Outdated
Comment thread pkg/crc/cache/cache.go
}
// macadam version output format: "macadam version v0.2.0"
split := strings.Split(out, " ")
return strings.TrimSpace(split[len(split)-1]), nil

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same comment as for NewAdminHelperCache and NewGvproxyCache

Comment thread pkg/crc/constants/constants.go Outdated
return errors.New("macadam executable is not cached")
}
if err := macadam.CheckVersion(); err != nil {
return errors.Wrap(err, "unexpected version of the macadam executable")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let’s not add new uses of errors.Wrap in new code.
https://github.com/pkg/errors

This repository was archived by the owner on Dec 1, 2021. It is now read-only.

Comment thread pkg/crc/machine/vsock.go Outdated
{Name: "api-int", IP: "192.168.127.2"},
{Name: "crc", IP: "192.168.126.11"},
Records: []types.Record{
{Name: "host", IP: net.ParseIP("192.168.127.254"), Regexp: nil},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it required to set Regexp: nil?

Comment thread pkg/crc/machine/vsock.go Outdated
{Name: "api-int", IP: net.ParseIP("192.168.127.2"), Regexp: nil},
{Name: "crc", IP: net.ParseIP("192.168.126.11"), Regexp: nil},
},
DefaultIP: net.ParseIP("192.168.127.2"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

DefaultIP was not there before.

Comment thread pkg/crc/machine/vsock.go
Comment thread pkg/crc/machine/vsock.go
Comment thread pkg/crc/machine/start.go Outdated
}
if err := cluster.EnsureGeneratedClientCAPresentInTheCluster(ctx, ocConfig, sshRunner, selfSignedCACert, adminClientCA); err != nil {
return errors.Wrap(err, "Failed to update user CA to cluster")
if err := sshRunner.CopyFileFromVM("/opt/kubeconfig", kubeconfigFilePath, 0644); err != nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

0600?

@praveenkumar praveenkumar left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Tried to update as per some suggestions and commented to some of the suggestions.


const userDataTemplate = `#cloud-config
runcmd:
- systemctl enable --now kubelet

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@cfergeau why? this is required because our bundle have kubelet service disabled by default.

content: '%s'
owner: core
permissions: '0600'
- path: /opt/crc/id_rsa.pub

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

no, /opt/crc/id_rsa.pub is the file which is required by mco ssh service https://github.com/crc-org/snc/blob/release-4.20/systemd/ocp-mco-sshkey.service here.

- path: /opt/crc/pass_developer
content: '%s'
permissions: '0644'
- path: /opt/crc/ocp-custom-domain.service.done

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Otherwise https://github.com/crc-org/snc/blob/release-4.20/systemd/ocp-custom-domain.service will fails and since it is Restart=on-failure so it is going to continue fail :( so better to have it as this magic file.


// ExecMainExitTimestamp returns the exit timestamp of a service's main process.
// Returns empty string if the service has never run, otherwise returns the exit timestamp.
func (c Commander) ExecMainExitTimestamp(name string) (string, error) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It return value is something which can be parsed as time but our aim is if there is timestamp which means the service is ready run and exited

$ systemctl show --property "ExecMainExitTimestamp" --value systemd-binfmt.service
Wed 2026-01-21 11:02:24 IST

Comment thread pkg/crc/machine/vsock.go
@openshift-ci

openshift-ci Bot commented Feb 25, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from praveenkumar. For more information see the Code Review Process.

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

Details 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

praveenkumar and others added 26 commits July 30, 2026 13:18
Co-authored-by: Cursor <cursoragent@cursor.com>
Made-with: Cursor
This will help to use gvproxy as filename instead gvproxy-linux-amd64
Fix a misleading error and make sure parent directory exist before
generating new keypair otherwise error occur when try to write the
keypair on a non exist path.
Since with self sufficient bundle and cloud-init metadata pull secret
should be applied automatic so just verify it instead apply. If it is
not there that means something wrong with pull secret service in the
bundle.
This commit have following
- macadam helper to provide value based on macadam command run
- cloud init helper to create user metadata
- remove of libmachine api
- updating vsock to work with gvproxy socket
- Some todo which need to be improved
This will help to check if the service if run and finished successfully
or not before checking the details in the cluster.

Co-authored-by: Cursor <cursoragent@cursor.com>
With self sufficient bundle all the ca changes happen as part of service
run in the VM so once that service finish successfully it is easy to
just copy that kubeconfig file from VM to host.

Co-authored-by: Cursor <cursoragent@cursor.com>
Introduce a new file containing the cursor commit rules for the project.
This document outlines the guidelines for generating git commit messages,
including the format, allowed commit types, and footer conventions.
This addition aims to standardize commit practices across the codebase.

Co-authored-by: Cursor <cursoragent@cursor.com>
Change the method of sourcing Go files in the Makefile to use the
`find` command, excluding the vendor directories. Without this if
we want to compile an uncommit source (mostly deleting a go file)
the git ls-files still have that file reference and build fails very early.

```
 $ git status
On branch crc-ng
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   cmd/crc-embedder/cmd/embed.go
        deleted:    pkg/crc/machine/libvirt/constants.go
        deleted:    pkg/crc/machine/libvirt/driver_linux.go
        deleted:    pkg/crc/machine/libvirt/templates_linux.go
        modified:   pkg/crc/preflight/preflight_checks_linux.go
        modified:   pkg/crc/preflight/preflight_linux.go
        modified:   pkg/crc/preflight/preflight_linux_test.go

no changes added to commit (use "git add" and/or "git commit -a")
✔ ~/work/github/crc [crc-ng L|● 3✚ 4⚑ 17]
12:31 $ make cross
make: *** No rule to make target 'pkg/crc/machine/libvirt/constants.go', needed by 'out/macos-arm64/crc'.  Stop.
```
Eliminate the libvirt package and its related files from the codebase,
shifting the focus to qemu-kvm for virtualization checks as per macadam
requirement. Update preflight checks to reflect this change, ensuring
that the system verifies the presence of qemu-kvm instead of libvirt components.

This refactor simplifies the code and aligns with the current macadam
strategy.

Co-authored-by: Cursor <cursoragent@cursor.com>
…d services

Implement the WasSkippedDueToConditions  method in the systemd Commander to check
if service conditions are met. Update the WaitForServiceSuccessfullyFinished
function to handle cases where services are skipped due to unmet conditions,
indicating that their work was already completed in a previous run. This
enhancement improves service management and logging clarity.
Since now macadam is used which by default using gvproxy so better to
remove the virtual network implementation from the codebase.
Looks like our bundle now have service which automatic run growpart as
part of cloud-init but then xfs_growfs is still required to grow xfs
filesystem so we shouldn't return just after growpart and run
xfs_growfs.
Update the removeCrcVM function to utilize macadam for VM status
checks and removal. This change eliminates the previous libvirt
dependency, streamlining the VM management process and improving
error handling when removing the 'crc' VM.
As of now route-controller not able to expose the nodeport to host.
We need to find a way for gvproxy side or route-conroller side to
enable it.
It was initially added as part of ed9342 but since now we are moving
to consume gvproxy and there is no virtual network running as part
of crc daemon so this is no more required.
Since macadam right now not support resource resize as part of
start => stop => resize resource => start so the test case is failing

- crc-org/macadam#291
Since now openshift related changes shifted as part of the bundle which
pass using cloud init file so changes to openshift side not going to
work as part of stop => start. Test about developer user password change
is moved to openshift feature where fresh crc instance is created.
Update EnsureVMPartitionSizeCorrect to use lsblk --bytes flag and parse
sizes as byte values instead of relying on formatted strings with "G"
suffix which fails because crc-ng create a disk for cloud init with
size of 43K and parsing fails. This makes the parsing more reliable and consistent.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
It was added before since there was no vsock support for 9p in windows,
but since it is added so better to remove tcp fallback.
Generate and persist a hosts API token when the daemon starts and during
preflight setup. Require the token as an `Authorization: Bearer` header
on the `/hosts/add` and `/hosts/remove` admin-helper endpoints. Sync the
same token into an OpenShift Secret so routes-controller can
authenticate when updating the hosts file. Add unit tests for token
creation and authorization checks.
@openshift-ci

openshift-ci Bot commented Aug 6, 2026

Copy link
Copy Markdown

@praveenkumar: 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
ci/prow/security 174cdf3 link false /test security
ci/prow/e2e-microshift-crc 174cdf3 link true /test e2e-microshift-crc
ci/prow/e2e-crc 174cdf3 link true /test e2e-crc

Full PR test history. Your PR dashboard.

Details

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-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Work In Progress

Development

Successfully merging this pull request may close these issues.

4 participants