-
Notifications
You must be signed in to change notification settings - Fork 256
[WIP] Initial PR for consuming gvproxy/macadam/cloud-init for crc-ng #5025
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
base: crc-ng
Are you sure you want to change the base?
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
49de216 to
2cf49bb
Compare
|
/retest |
| return newCache(constants.GvproxyPath(), | ||
| url, | ||
| version, | ||
| func(executable string) (string, error) { |
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.
NewAdminHelperCache uses exactly the same function, might be desirable to share that code.
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.
Yes, we can share the code for getting the version info. May be a followup or new commit.
| return errors.Wrap(err, "unexpected version of the gvproxy executable") | ||
| } | ||
| logging.Debug("gvproxy executable already cached") | ||
| // SUID is only required on Linux (checkSuid is a no-op on Windows/macOS) |
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.
Are you sure it’s not also needed on macOS? Could be better to split this check in 2, with the SUID check being linux-specific. We would get 2 separate skip- options, which would allow to skip one without skipping the other (eg skip the suid check, but keep the gvproxy download).
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 is removed in later commits
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.
we only needed the capability instead of SUID
| } | ||
| // macadam version output format: "macadam version v0.2.0" | ||
| split := strings.Split(out, " ") | ||
| return strings.TrimSpace(split[len(split)-1]), nil |
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.
Same comment as for NewAdminHelperCache and NewGvproxyCache
pkg/crc/constants/constants.go
Outdated
| CrcLandingPageURL = "https://console.redhat.com/openshift/create/local" // #nosec G101 | ||
| DefaultAdminHelperURLBase = "https://github.com/crc-org/admin-helper/releases/download/v%s/%s" | ||
| DefaultGvproxyURLBase = "https://github.com/containers/gvisor-tap-vsock/releases/download/%s/%s" | ||
| DefaultMacadamURLBase = "https://github.com/praveenkumar/macadam/releases/download/%s/%s" |
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 can be changed now that there is a 0.3.0 release.
| return errors.New("macadam executable is not cached") | ||
| } | ||
| if err := macadam.CheckVersion(); err != nil { | ||
| return errors.Wrap(err, "unexpected version of the macadam executable") |
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.
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.
| {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}, |
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.
Is it required to set Regexp: nil?
| {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"), |
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.
DefaultIP was not there before.
| } | ||
| for i := range missingPorts { | ||
| port := &missingPorts[i] | ||
| if err := daemonClient.NetworkClient.Expose(port); err != nil { |
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.
Shouldn’t this logic be kept?
| return false | ||
| } | ||
|
|
||
| func unexposePorts() error { |
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.
It’s used in Stop and Delete
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.
since now it is manage by gvproxy process which get killed and release ports when crc stop/delete happen.
| } | ||
| 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 { |
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.
0600?
This will help to use gvproxy as filename instead gvproxy-linux-amd64
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 helper can use to check if net cap is part of a binary or not for linux and implement no-ops for win and darwin
This will help to bind ports which are <1024 in Linux.
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.
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.
|
@praveenkumar: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
No description provided.