MatrixAI / Emergence

Distributed Infrastructure Orchestration
Apache License 2.0
1 stars 0 forks source link

Produce a list of structs that needs to be serialised for the binding #25

Closed mokuki082 closed 6 years ago

mokuki082 commented 6 years ago

I'll list out the structs that are needed for Matrix to create/run/delete containers via runC.

mokuki082 commented 6 years ago

The OCI runtime spec needs to be serialized.

27 Mentions that due to the use of the underlying filesystem, it is not really worth going through the hassle to serialise the config just to avoid reading from filesystem.

mokuki082 commented 6 years ago

https://github.com/opencontainers/runc/blob/b517076907b7c18d7a1f296ec390cf3f275e2375/state.go#L43-L52

The state of the container needs to be serialised.

CMCDragonkai commented 6 years ago

Are you able to list out the structs here in this issue, so I can review? Specifically a list with names and optionally links to their definition/declaration. Also what they do (or what you think they are used for).

mokuki082 commented 6 years ago

Here are a few that I've already serialised:

// All commands should inherit from this struct
// and it should not be used on its own.
struct BaseCommand {
  char* statePath; // path to container state information (in json format)
  char* criu; // criu binary path, default to "criu"
  bool systemdCgroup; // whether to enable systemd cgroup 
  int rootless; // 0: auto, 1: true, 2: false
};

// Shared information between CREATE, RUN, and RESTORE
struct RunnableCommand {
  BaseCommand* base; // Inherits from BaseCommand
  char* id; // container ID
  bool noPivot; // do not use pivot root to jail process inside rootfs.
  bool noNewKeyring; // do not create a new session keyring for the container
  char* notifySocket; // hostname for notifySocket
};

// Create the container environment without executing the entrypoint just yet.
// Any changes to the bundle after this will not effect this container instance.
struct CreateCommand {
  RunnableCommand* runnable; // inherits from RunnableCommand
  char* bundle; // bundle path (where rootfs and config.json are stored)
  char* consoleSocket; // path to a unix socket that handles tty interaction
  char* pidFile; // a file to store the process id
  int preserveFds; // Pass N additional file descriptors to the container (stdio + $LISTEN_FDS + N in total)
};
mokuki082 commented 6 years ago

Closing this as we are no longer serialising structs, rather we are utliising RunC as a whole. #35 has a discussion on why.