CRC has a daemon, which can be used to do some basic CRC operations, to start the daemon run crc daemon or with debug logging crc daemon --log-level debug
In case of macOS and Windows, crc setup --enable-experimental-features will start the daemon but it'll also start the tray.
The daemon when started, listens on a Unix socket at $CRC_HOME/crc.sock, (~/.crc/crc.sock in linux and macOS) for commands/requests.. After connecting to the socket, it accepts commands as a JSON.
It understands a subset of the crc CLI commands:
| CLI commands | Daemon api | Response |
|---|---|---|
crc start |
{"command":"start"} |
{"Name":"crc","Status":"","Error":"open /Users/anjan/.crc/cache/crc_hyperkit_4.4.3.crcbundle: no such file or directory","ClusterConfig":{"KubeConfig":"","KubeAdminPass":"","ClusterAPI":"","WebConsoleURL":"","ProxyConfig":null},"KubeletStarted":false} |
crc stop |
{"command":"stop"} |
{"Name":"crc","Success":false,"State":0,"Error":"Machine \"crc\" does not exist. Use \"crc start\" to add a new one."} |
crc status |
{"command":"status"} |
{"Name":"crc","CrcStatus":"","OpenshiftStatus":"","DiskUse":0,"DiskSize":0,"Error":"Machine \"crc\" does not exist. Use \"crc start\" to add a new one.","Success":false} |
crc delete |
{"command":"delete"} |
|
crc version |
{"command":"version"} |
{"CrcVersion":"1.10.0","CommitSha":"4f5f223","OpenshiftVersion":"4.4.3","Success":true} |
When you send to the daemon a command which is not implemented yet, it won't send back a reply and close the connection.
If an accepted command creates an error, the responses always has an Error and Success key which should be checked to determine.
This api is not stable, we will change it to also be able to send args to the daemon.. e.g {"command":"<crc_command>", "args":{"arg1":"<arg1>", "args2":"<arg2>"}}