-
Notifications
You must be signed in to change notification settings - Fork 243
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
Use win32-background-launcher
to start the daemon task
#3901
Conversation
/hold till required tasks are finished as mentioned in #3901 (comment) and #3879 (comment) |
2de34a4
to
bd749ff
Compare
/test e2e-microshift-crc |
da98ad6
to
985ebe3
Compare
can we rename the application on Windows to |
Tested on windows 11 https://crcqe-asia.s3.amazonaws.com/nightly/ocp/4.14.3/20231123/11-pro/qe-results/e2e-non-ux.xml cluster behaves as expected |
yes, can do, first have to first change the name of the executable in crc-org/win32-background-launcher edit: created crc-org/win32-background-launcher#3 |
Well the launcher is generic and has nothing crc specific. Dunno if there's a way to provide a description to indicate which process it launched? |
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.
overall looks fine, a few comments here and there.
pkg/crc/constants/constants.go
Outdated
DaemonLogFile = "crcd.log" | ||
CrcLandingPageURL = "https://console.redhat.com/openshift/create/local" // #nosec G101 | ||
DefaultAdminHelperURLBase = "https://github.com/crc-org/admin-helper/releases/download/v%s/%s" | ||
CRCWin32BackgroundLauncherURL = "https://github.com/crc-org/win32-background-launcher/releases/download/v%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.
I don't think the CRC
prefix is really useful here, and I'd also drop "win32". This does not need to be exported.
pkg/crc/constants/constants.go
Outdated
@@ -47,6 +48,8 @@ const ( | |||
|
|||
OpenShiftIngressHTTPPort = 80 | |||
OpenShiftIngressHTTPSPort = 443 | |||
|
|||
Win32BackgroundLauncherExeName = "win32-background-launcher.exe" |
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.
For admin-helper, we call it Executable
, not ExeName
985ebe3
to
89aeb34
Compare
pkg/crc/constants/constants.go
Outdated
@@ -187,6 +194,11 @@ func GetKubeAdminPasswordPath() string { | |||
return filepath.Join(MachineInstanceDir, DefaultName, "kubeadmin-password") | |||
} | |||
|
|||
func GetCRCWindowsBackgroundLauncherDownloadURL() string { |
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.
GetWin32BackgroundLauncher...?
87484bc
to
f6b64de
Compare
pkg/crc/cache/cache.go
Outdated
@@ -20,6 +20,7 @@ type Cache struct { | |||
executablePath string | |||
archiveURL string | |||
version string | |||
nameMismatch bool |
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.
ignoreNameMismatch
would be more explicit.
pkg/crc/cache/cache.go
Outdated
@@ -33,8 +34,8 @@ func (e *VersionMismatchError) Error() string { | |||
return fmt.Sprintf("%s version mismatch: %s expected but %s found in the cache", e.ExecutableName, e.ExpectedVersion, e.CurrentVersion) | |||
} | |||
|
|||
func newCache(executablePath string, archiveURL string, version string, getVersion func(string) (string, error)) *Cache { | |||
return &Cache{executablePath: executablePath, archiveURL: archiveURL, version: version, getVersion: getVersion} | |||
func newCache(executablePath string, archiveURL string, version string, nameMismatch bool, getVersion func(string) (string, error)) *Cache { |
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.
Not sure I'd add this arg by default, might be better to explicitly set it for the background launcher after creating the cache with the default values (cache.IgnoreNameMismatch()
or cache.ignoreNameMismatch = true
)
f6b64de
to
ed08a91
Compare
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.
2 minor comments, but fine with me with or without changes
/lgtm
/approve
return fmt.Errorf("Missing background launcher binary at: %s", constants.Win32BackgroundLauncherPath()) | ||
} | ||
|
||
binPathWithArgs := fmt.Sprintf(`"%s" daemon`, crcBinPath) |
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 used to be daemonCmdArgs :=
daemon --log-level debug`, is it intentional that you removed the debug logs?
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 have no way to look at the stdout of the process, and logs to the log file crcd.log
is always at debug/trace level, so this flag was not useful
@@ -23,4 +23,6 @@ func NewWin32BackgroundLauncherCache() *Cache { | |||
return strings.TrimSpace(stdOut), nil | |||
}, | |||
) | |||
cache.ignoreNameMismatch = true |
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.
Might be worth an explanatory comment? upstream binary is win32-..., we want to name it crc-...
?
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cfergeau 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 |
ed08a91
to
b74d3a2
Compare
New changes are detected. LGTM label has been removed. |
b74d3a2
to
363d501
Compare
crc-embedder is updated to download win32-background-launcher.exe from its github release at crc-org/win32-backgroun-launcher so that it is available while building the msi it'll be used to start the crc daemon as a background process
this removes the powershell script we used earlier to start the daemon task as a hidden process and uses the background launcher executable installed by the msi to start the daemon task updates the preflight checks that installs the daemon task to use the background launcher executable
on a released crc version the win32-background-laucher will be installed in the install location of crc by the msi, but while using a non installer version this'll help to download the win32-background-launcher binary by running `crc setup` this is also helpful for testing different versions of the background launcher during development
the background-launcher upstream is released as win32-background-launcher.exe since its function is generic and does nothing crc specific however when we install it and use it to launch the daemon process in background on windows it is useful to name it as crc-background-launcher.exe to make it easy for users to identify it with crc
363d501
to
ce335c0
Compare
@anjannath: The following tests failed, say
Full PR test history. Your PR dashboard. 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. |
Needs:
v0.0.0.1
ofwin32-background-launcher