-
Notifications
You must be signed in to change notification settings - Fork 593
proto: initial protobuf for config #179
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
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
81441ac
proto: initial protobuf for config
vbatts 866f789
proto: Platform type for User, and misc
vbatts beabf64
proto: runtime and linux runtime done
vbatts 113bfe7
proto/config: Explicit linux user message
vbatts 32e3ec9
proto/config: style guide and indentation
vbatts c68fac1
proto/config: indentation
vbatts eb48ef2
proto: changes per style guide
vbatts fa1ae38
proto: remove default values
vbatts 9adb993
proto: default expanded enum to unknown
vbatts e8d8934
proto/config: User as extensions
vbatts File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
|
|
||
| DESTDIR ?= . | ||
| PROTO_FILES := $(wildcard *.proto) | ||
| GO_FILES := $(patsubst %.proto,%.pb.go,$(PROTO_FILES)) | ||
| C_FILES := $(patsubst %.proto,%.pb-c.c,$(PROTO_FILES)) | ||
| C_HDR_FILES := $(patsubst %.proto,%.pb-c.h,$(PROTO_FILES)) | ||
| PY_FILES := $(patsubst %.proto,%_pb2.py,$(PROTO_FILES)) | ||
|
|
||
| default: go | ||
|
|
||
| all: go py c | ||
|
|
||
| go: $(GO_FILES) | ||
|
|
||
| %.pb.go: %.proto | ||
| protoc --go_out=$(DESTDIR) $^ | ||
|
|
||
| c: $(C_FILES) | ||
|
|
||
| %.pb-c.c: %.proto | ||
| protoc-c --c_out=$(DESTDIR) $^ | ||
|
|
||
| py: $(PY_FILES) | ||
|
|
||
| %_pb2.py: %.proto | ||
| protoc --python_out=$(DESTDIR) $^ | ||
|
|
||
|
|
||
| clean: | ||
| rm -rf *~ $(GO_FILES) $(C_FILES) $(C_HDR_FILES) $(PY_FILES) | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| //package oci.config.bundle; | ||
| package oci; | ||
|
|
||
| // Spec is the base configuration for the container. It specifies platform | ||
| // independent configuration. | ||
| message Spec { | ||
| // Version is the version of the specification that is supported. | ||
| optional string version = 1; | ||
| // Platform is the host information for OS and Arch. | ||
| optional Platform platform = 2; | ||
| // Process is the container's main process. | ||
| optional Process process = 3; | ||
| // Root is the root information for the container's filesystem. | ||
| optional Root root = 4; | ||
| // Hostname is the container's host name. | ||
| optional string hostname = 5; | ||
| // Mounts profile configuration for adding mounts to the container's | ||
| // filesystem. | ||
| repeated MountPoint mounts = 6; | ||
| } | ||
|
|
||
|
|
||
| // LinuxSpec is the full specification for linux containers. | ||
| message LinuxSpec { | ||
| optional Spec spec = 1; | ||
| // LinuxConfig is platform specific configuration for linux based | ||
| // containers. | ||
| optional LinuxConfig linux_config = 2; | ||
| } | ||
|
|
||
| // LinuxConfig contains platform specific configuration for linux based | ||
| // containers. | ||
| message LinuxConfig { | ||
| // Capabilities are linux capabilities that are kept for the container. | ||
| repeated string capabilities = 1; | ||
| } | ||
|
|
||
| // Platform specifies OS and arch information for the host system that the | ||
| // container is created for. | ||
| message Platform { | ||
| // OS is the operating system. | ||
| optional string os = 1; | ||
| // Arch is the architecture | ||
| optional string arch = 2; | ||
| } | ||
|
|
||
| // Process contains information to start a specific application inside the | ||
| // container. | ||
| message Process { | ||
| // Terminal creates an interactive terminal for the container. | ||
| optional bool terminal = 1; | ||
| // User specifies user information for the process. | ||
| optional User user = 2; | ||
| // Args specifies the binary and arguments for the application to | ||
| // execute. | ||
| repeated string args = 3; | ||
| // Env populates the process environment for the process. | ||
| repeated string env = 4; | ||
| // Cwd is the current working directory for the process and must be | ||
| // relative to the container's root. | ||
| optional string cwd = 5; | ||
| } | ||
|
|
||
| enum PlatformType { | ||
| UNKNOWN = 0; | ||
| LINUX = 1; | ||
| } | ||
|
|
||
| // User specifies user information for the process. | ||
| message User { | ||
| // Type so that receivers of this message can `switch` for the fields | ||
| // expected | ||
| optional PlatformType type = 1; | ||
|
|
||
| //optional LinuxUser linux_type = 2; | ||
| extensions 100 to 499; | ||
| } | ||
|
|
||
| // Root contains information about the container's root filesystem on the host. | ||
| message Root { | ||
| // Path is the absolute path to the container's root filesystem. | ||
| optional string path = 1; | ||
| // Readonly makes the root filesystem for the container readonly before | ||
| // the process is executed. | ||
| optional bool readonly = 2; | ||
| } | ||
|
|
||
| // MountPoint describes a directory that may be fullfilled by a mount in the | ||
| // runtime.json. | ||
| message MountPoint { | ||
| // Name is a unique descriptive identifier for this mount point. | ||
| optional string name = 1; | ||
| // Path specifies the path of the mount. The path and child directories | ||
| // MUST exist, a runtime MUST NOT create directories automatically to a | ||
| // mount point. | ||
| optional string path = 2; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package oci; | ||
|
|
||
| import "config.proto"; | ||
|
|
||
| // LinuxUser specifies linux specific user and group information for the | ||
| // container's main process. | ||
| extend oci.User { | ||
| // Uid is the user id. | ||
| optional int32 uid = 101; | ||
| // Gid is the group id. | ||
| optional int32 gid = 102; | ||
| repeated int32 additional_gids = 103; | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| //package oci.config.runtime; | ||
| package oci; | ||
|
|
||
| import "runtime_config_linux.proto"; | ||
|
|
||
| // RuntimeSpec is the generic runtime state information on a running container | ||
| message RuntimeSpec { | ||
| // Mounts is a mapping of names to mount configurations. | ||
| // Which mounts will be mounted and where should be chosen with MountPoints | ||
| // in Spec. | ||
| repeated MountFieldEntry mounts = 1; | ||
| // Hooks are the commands run at various lifecycle events of the container. | ||
| optional Hooks hooks = 2; | ||
| } | ||
|
|
||
| // LinuxRuntimeSpec is the full specification for linux containers. | ||
| message LinuxRuntimeSpec { | ||
| optional RuntimeSpec runtime_spec = 1; | ||
| // LinuxRuntime is platform specific configuration for linux based containers. | ||
| optional oci.LinuxRuntime linux = 2; | ||
| } | ||
|
|
||
| // MountFieldEntry is more backwards compatible protobuf associative map (than map<string, Mount>) | ||
| message MountFieldEntry { | ||
| required string key = 1; | ||
| required Mount value = 2; | ||
| } | ||
|
|
||
| // Mount specifies a mount for a container | ||
| message Mount { | ||
| // Type specifies the mount kind. | ||
| optional string type = 1; | ||
| // Source specifies the source path of the mount. In the case of bind mounts on | ||
| // linux based systems this would be the file on the host. | ||
| optional string source = 2; | ||
| // Options are fstab style mount options. | ||
| repeated string options = 3; | ||
| } | ||
|
|
||
| // Hook specifies a command that is run at a particular event in the lifecycle of a container | ||
| message Hook { | ||
| optional string path = 1; | ||
| repeated string args = 2; | ||
| repeated string env = 3; | ||
| } | ||
|
|
||
| // Hooks for container setup and teardown | ||
| message Hooks { | ||
| // Prestart is a list of hooks to be run before the container process is executed. | ||
| // On Linux, they are run after the container namespaces are created. | ||
| repeated Hook prestart = 1; | ||
| // Poststop is a list of hooks to be run after the container process exits. | ||
| repeated Hook poststop = 2; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nit: This can be defined as part of the
UsermessageThere 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 started to do that, but left it out as there may be uses in other messages as we go along.