Fixes #25804
The upstream repo changed the import paths.
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
| ... | ... |
@@ -25,7 +25,7 @@ import ( |
| 25 | 25 |
"github.com/opencontainers/runc/libcontainer/configs" |
| 26 | 26 |
"github.com/opencontainers/runc/libcontainer/devices" |
| 27 | 27 |
"github.com/opencontainers/runc/libcontainer/label" |
| 28 |
- "github.com/opencontainers/specs/specs-go" |
|
| 28 |
+ "github.com/opencontainers/runtime-spec/specs-go" |
|
| 29 | 29 |
) |
| 30 | 30 |
|
| 31 | 31 |
func u32Ptr(i int64) *uint32 { u := uint32(i); return &u }
|
| ... | ... |
@@ -38,7 +38,7 @@ import ( |
| 38 | 38 |
"github.com/golang/protobuf/ptypes" |
| 39 | 39 |
"github.com/opencontainers/runc/libcontainer/label" |
| 40 | 40 |
"github.com/opencontainers/runc/libcontainer/user" |
| 41 |
- "github.com/opencontainers/specs/specs-go" |
|
| 41 |
+ "github.com/opencontainers/runtime-spec/specs-go" |
|
| 42 | 42 |
) |
| 43 | 43 |
|
| 44 | 44 |
const ( |
| ... | ... |
@@ -23,7 +23,7 @@ import ( |
| 23 | 23 |
"github.com/opencontainers/runc/libcontainer/apparmor" |
| 24 | 24 |
"github.com/opencontainers/runc/libcontainer/devices" |
| 25 | 25 |
"github.com/opencontainers/runc/libcontainer/user" |
| 26 |
- "github.com/opencontainers/specs/specs-go" |
|
| 26 |
+ "github.com/opencontainers/runtime-spec/specs-go" |
|
| 27 | 27 |
) |
| 28 | 28 |
|
| 29 | 29 |
func setResources(s *specs.Spec, r containertypes.Resources) error {
|
| ... | ... |
@@ -8,7 +8,7 @@ import ( |
| 8 | 8 |
"github.com/Sirupsen/logrus" |
| 9 | 9 |
"github.com/docker/docker/container" |
| 10 | 10 |
"github.com/docker/docker/profiles/seccomp" |
| 11 |
- "github.com/opencontainers/specs/specs-go" |
|
| 11 |
+ "github.com/opencontainers/runtime-spec/specs-go" |
|
| 12 | 12 |
) |
| 13 | 13 |
|
| 14 | 14 |
var supportsSeccomp = true |
| ... | ... |
@@ -590,7 +590,7 @@ options for `zfs` start with `zfs` and options for `btrfs` start with `btrfs`. |
| 590 | 590 |
## Docker runtime execution options |
| 591 | 591 |
|
| 592 | 592 |
The Docker daemon relies on a |
| 593 |
-[OCI](https://github.com/opencontainers/specs) compliant runtime |
|
| 593 |
+[OCI](https://github.com/opencontainers/runtime-spec) compliant runtime |
|
| 594 | 594 |
(invoked via the `containerd` daemon) as its interface to the Linux |
| 595 | 595 |
kernel `namespaces`, `cgroups`, and `SELinux`. |
| 596 | 596 |
|
| ... | ... |
@@ -103,7 +103,7 @@ clone git github.com/docker/go v1.5.1-1-1-gbaf439e |
| 103 | 103 |
clone git github.com/agl/ed25519 d2b94fd789ea21d12fac1a4443dd3a3f79cda72c |
| 104 | 104 |
|
| 105 | 105 |
clone git github.com/opencontainers/runc cc29e3dded8e27ba8f65738f40d251c885030a28 # libcontainer |
| 106 |
-clone git github.com/opencontainers/specs v1.0.0-rc1 # specs |
|
| 106 |
+clone git github.com/opencontainers/runtime-spec v1.0.0-rc1 # specs |
|
| 107 | 107 |
clone git github.com/seccomp/libseccomp-golang 32f571b70023028bd57d9288c20efbcb237f3ce0 |
| 108 | 108 |
# libcontainer deps (see src/github.com/opencontainers/runc/Godeps/Godeps.json) |
| 109 | 109 |
clone git github.com/coreos/go-systemd v4 |
| ... | ... |
@@ -16,7 +16,7 @@ import ( |
| 16 | 16 |
"github.com/docker/docker/pkg/mount" |
| 17 | 17 |
"github.com/golang/protobuf/ptypes" |
| 18 | 18 |
"github.com/golang/protobuf/ptypes/timestamp" |
| 19 |
- specs "github.com/opencontainers/specs/specs-go" |
|
| 19 |
+ specs "github.com/opencontainers/runtime-spec/specs-go" |
|
| 20 | 20 |
"golang.org/x/net/context" |
| 21 | 21 |
) |
| 22 | 22 |
|
| ... | ... |
@@ -12,7 +12,7 @@ import ( |
| 12 | 12 |
"github.com/Sirupsen/logrus" |
| 13 | 13 |
containerd "github.com/docker/containerd/api/grpc/types" |
| 14 | 14 |
"github.com/docker/docker/restartmanager" |
| 15 |
- "github.com/opencontainers/specs/specs-go" |
|
| 15 |
+ "github.com/opencontainers/runtime-spec/specs-go" |
|
| 16 | 16 |
"golang.org/x/net/context" |
| 17 | 17 |
) |
| 18 | 18 |
|
| ... | ... |
@@ -2,7 +2,7 @@ package libcontainerd |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 | 4 |
containerd "github.com/docker/containerd/api/grpc/types" |
| 5 |
- "github.com/opencontainers/specs/specs-go" |
|
| 5 |
+ "github.com/opencontainers/runtime-spec/specs-go" |
|
| 6 | 6 |
) |
| 7 | 7 |
|
| 8 | 8 |
// Spec is the base configuration for the container. It specifies platform |
| ... | ... |
@@ -17,7 +17,7 @@ import ( |
| 17 | 17 |
"github.com/docker/docker/restartmanager" |
| 18 | 18 |
"github.com/docker/engine-api/types" |
| 19 | 19 |
"github.com/docker/engine-api/types/container" |
| 20 |
- "github.com/opencontainers/specs/specs-go" |
|
| 20 |
+ "github.com/opencontainers/runtime-spec/specs-go" |
|
| 21 | 21 |
) |
| 22 | 22 |
|
| 23 | 23 |
func (pm *Manager) enable(p *plugin, force bool) error {
|
| 11 | 11 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,191 @@ |
| 0 |
+ |
|
| 1 |
+ Apache License |
|
| 2 |
+ Version 2.0, January 2004 |
|
| 3 |
+ http://www.apache.org/licenses/ |
|
| 4 |
+ |
|
| 5 |
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION |
|
| 6 |
+ |
|
| 7 |
+ 1. Definitions. |
|
| 8 |
+ |
|
| 9 |
+ "License" shall mean the terms and conditions for use, reproduction, |
|
| 10 |
+ and distribution as defined by Sections 1 through 9 of this document. |
|
| 11 |
+ |
|
| 12 |
+ "Licensor" shall mean the copyright owner or entity authorized by |
|
| 13 |
+ the copyright owner that is granting the License. |
|
| 14 |
+ |
|
| 15 |
+ "Legal Entity" shall mean the union of the acting entity and all |
|
| 16 |
+ other entities that control, are controlled by, or are under common |
|
| 17 |
+ control with that entity. For the purposes of this definition, |
|
| 18 |
+ "control" means (i) the power, direct or indirect, to cause the |
|
| 19 |
+ direction or management of such entity, whether by contract or |
|
| 20 |
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the |
|
| 21 |
+ outstanding shares, or (iii) beneficial ownership of such entity. |
|
| 22 |
+ |
|
| 23 |
+ "You" (or "Your") shall mean an individual or Legal Entity |
|
| 24 |
+ exercising permissions granted by this License. |
|
| 25 |
+ |
|
| 26 |
+ "Source" form shall mean the preferred form for making modifications, |
|
| 27 |
+ including but not limited to software source code, documentation |
|
| 28 |
+ source, and configuration files. |
|
| 29 |
+ |
|
| 30 |
+ "Object" form shall mean any form resulting from mechanical |
|
| 31 |
+ transformation or translation of a Source form, including but |
|
| 32 |
+ not limited to compiled object code, generated documentation, |
|
| 33 |
+ and conversions to other media types. |
|
| 34 |
+ |
|
| 35 |
+ "Work" shall mean the work of authorship, whether in Source or |
|
| 36 |
+ Object form, made available under the License, as indicated by a |
|
| 37 |
+ copyright notice that is included in or attached to the work |
|
| 38 |
+ (an example is provided in the Appendix below). |
|
| 39 |
+ |
|
| 40 |
+ "Derivative Works" shall mean any work, whether in Source or Object |
|
| 41 |
+ form, that is based on (or derived from) the Work and for which the |
|
| 42 |
+ editorial revisions, annotations, elaborations, or other modifications |
|
| 43 |
+ represent, as a whole, an original work of authorship. For the purposes |
|
| 44 |
+ of this License, Derivative Works shall not include works that remain |
|
| 45 |
+ separable from, or merely link (or bind by name) to the interfaces of, |
|
| 46 |
+ the Work and Derivative Works thereof. |
|
| 47 |
+ |
|
| 48 |
+ "Contribution" shall mean any work of authorship, including |
|
| 49 |
+ the original version of the Work and any modifications or additions |
|
| 50 |
+ to that Work or Derivative Works thereof, that is intentionally |
|
| 51 |
+ submitted to Licensor for inclusion in the Work by the copyright owner |
|
| 52 |
+ or by an individual or Legal Entity authorized to submit on behalf of |
|
| 53 |
+ the copyright owner. For the purposes of this definition, "submitted" |
|
| 54 |
+ means any form of electronic, verbal, or written communication sent |
|
| 55 |
+ to the Licensor or its representatives, including but not limited to |
|
| 56 |
+ communication on electronic mailing lists, source code control systems, |
|
| 57 |
+ and issue tracking systems that are managed by, or on behalf of, the |
|
| 58 |
+ Licensor for the purpose of discussing and improving the Work, but |
|
| 59 |
+ excluding communication that is conspicuously marked or otherwise |
|
| 60 |
+ designated in writing by the copyright owner as "Not a Contribution." |
|
| 61 |
+ |
|
| 62 |
+ "Contributor" shall mean Licensor and any individual or Legal Entity |
|
| 63 |
+ on behalf of whom a Contribution has been received by Licensor and |
|
| 64 |
+ subsequently incorporated within the Work. |
|
| 65 |
+ |
|
| 66 |
+ 2. Grant of Copyright License. Subject to the terms and conditions of |
|
| 67 |
+ this License, each Contributor hereby grants to You a perpetual, |
|
| 68 |
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
|
| 69 |
+ copyright license to reproduce, prepare Derivative Works of, |
|
| 70 |
+ publicly display, publicly perform, sublicense, and distribute the |
|
| 71 |
+ Work and such Derivative Works in Source or Object form. |
|
| 72 |
+ |
|
| 73 |
+ 3. Grant of Patent License. Subject to the terms and conditions of |
|
| 74 |
+ this License, each Contributor hereby grants to You a perpetual, |
|
| 75 |
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
|
| 76 |
+ (except as stated in this section) patent license to make, have made, |
|
| 77 |
+ use, offer to sell, sell, import, and otherwise transfer the Work, |
|
| 78 |
+ where such license applies only to those patent claims licensable |
|
| 79 |
+ by such Contributor that are necessarily infringed by their |
|
| 80 |
+ Contribution(s) alone or by combination of their Contribution(s) |
|
| 81 |
+ with the Work to which such Contribution(s) was submitted. If You |
|
| 82 |
+ institute patent litigation against any entity (including a |
|
| 83 |
+ cross-claim or counterclaim in a lawsuit) alleging that the Work |
|
| 84 |
+ or a Contribution incorporated within the Work constitutes direct |
|
| 85 |
+ or contributory patent infringement, then any patent licenses |
|
| 86 |
+ granted to You under this License for that Work shall terminate |
|
| 87 |
+ as of the date such litigation is filed. |
|
| 88 |
+ |
|
| 89 |
+ 4. Redistribution. You may reproduce and distribute copies of the |
|
| 90 |
+ Work or Derivative Works thereof in any medium, with or without |
|
| 91 |
+ modifications, and in Source or Object form, provided that You |
|
| 92 |
+ meet the following conditions: |
|
| 93 |
+ |
|
| 94 |
+ (a) You must give any other recipients of the Work or |
|
| 95 |
+ Derivative Works a copy of this License; and |
|
| 96 |
+ |
|
| 97 |
+ (b) You must cause any modified files to carry prominent notices |
|
| 98 |
+ stating that You changed the files; and |
|
| 99 |
+ |
|
| 100 |
+ (c) You must retain, in the Source form of any Derivative Works |
|
| 101 |
+ that You distribute, all copyright, patent, trademark, and |
|
| 102 |
+ attribution notices from the Source form of the Work, |
|
| 103 |
+ excluding those notices that do not pertain to any part of |
|
| 104 |
+ the Derivative Works; and |
|
| 105 |
+ |
|
| 106 |
+ (d) If the Work includes a "NOTICE" text file as part of its |
|
| 107 |
+ distribution, then any Derivative Works that You distribute must |
|
| 108 |
+ include a readable copy of the attribution notices contained |
|
| 109 |
+ within such NOTICE file, excluding those notices that do not |
|
| 110 |
+ pertain to any part of the Derivative Works, in at least one |
|
| 111 |
+ of the following places: within a NOTICE text file distributed |
|
| 112 |
+ as part of the Derivative Works; within the Source form or |
|
| 113 |
+ documentation, if provided along with the Derivative Works; or, |
|
| 114 |
+ within a display generated by the Derivative Works, if and |
|
| 115 |
+ wherever such third-party notices normally appear. The contents |
|
| 116 |
+ of the NOTICE file are for informational purposes only and |
|
| 117 |
+ do not modify the License. You may add Your own attribution |
|
| 118 |
+ notices within Derivative Works that You distribute, alongside |
|
| 119 |
+ or as an addendum to the NOTICE text from the Work, provided |
|
| 120 |
+ that such additional attribution notices cannot be construed |
|
| 121 |
+ as modifying the License. |
|
| 122 |
+ |
|
| 123 |
+ You may add Your own copyright statement to Your modifications and |
|
| 124 |
+ may provide additional or different license terms and conditions |
|
| 125 |
+ for use, reproduction, or distribution of Your modifications, or |
|
| 126 |
+ for any such Derivative Works as a whole, provided Your use, |
|
| 127 |
+ reproduction, and distribution of the Work otherwise complies with |
|
| 128 |
+ the conditions stated in this License. |
|
| 129 |
+ |
|
| 130 |
+ 5. Submission of Contributions. Unless You explicitly state otherwise, |
|
| 131 |
+ any Contribution intentionally submitted for inclusion in the Work |
|
| 132 |
+ by You to the Licensor shall be under the terms and conditions of |
|
| 133 |
+ this License, without any additional terms or conditions. |
|
| 134 |
+ Notwithstanding the above, nothing herein shall supersede or modify |
|
| 135 |
+ the terms of any separate license agreement you may have executed |
|
| 136 |
+ with Licensor regarding such Contributions. |
|
| 137 |
+ |
|
| 138 |
+ 6. Trademarks. This License does not grant permission to use the trade |
|
| 139 |
+ names, trademarks, service marks, or product names of the Licensor, |
|
| 140 |
+ except as required for reasonable and customary use in describing the |
|
| 141 |
+ origin of the Work and reproducing the content of the NOTICE file. |
|
| 142 |
+ |
|
| 143 |
+ 7. Disclaimer of Warranty. Unless required by applicable law or |
|
| 144 |
+ agreed to in writing, Licensor provides the Work (and each |
|
| 145 |
+ Contributor provides its Contributions) on an "AS IS" BASIS, |
|
| 146 |
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
|
| 147 |
+ implied, including, without limitation, any warranties or conditions |
|
| 148 |
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A |
|
| 149 |
+ PARTICULAR PURPOSE. You are solely responsible for determining the |
|
| 150 |
+ appropriateness of using or redistributing the Work and assume any |
|
| 151 |
+ risks associated with Your exercise of permissions under this License. |
|
| 152 |
+ |
|
| 153 |
+ 8. Limitation of Liability. In no event and under no legal theory, |
|
| 154 |
+ whether in tort (including negligence), contract, or otherwise, |
|
| 155 |
+ unless required by applicable law (such as deliberate and grossly |
|
| 156 |
+ negligent acts) or agreed to in writing, shall any Contributor be |
|
| 157 |
+ liable to You for damages, including any direct, indirect, special, |
|
| 158 |
+ incidental, or consequential damages of any character arising as a |
|
| 159 |
+ result of this License or out of the use or inability to use the |
|
| 160 |
+ Work (including but not limited to damages for loss of goodwill, |
|
| 161 |
+ work stoppage, computer failure or malfunction, or any and all |
|
| 162 |
+ other commercial damages or losses), even if such Contributor |
|
| 163 |
+ has been advised of the possibility of such damages. |
|
| 164 |
+ |
|
| 165 |
+ 9. Accepting Warranty or Additional Liability. While redistributing |
|
| 166 |
+ the Work or Derivative Works thereof, You may choose to offer, |
|
| 167 |
+ and charge a fee for, acceptance of support, warranty, indemnity, |
|
| 168 |
+ or other liability obligations and/or rights consistent with this |
|
| 169 |
+ License. However, in accepting such obligations, You may act only |
|
| 170 |
+ on Your own behalf and on Your sole responsibility, not on behalf |
|
| 171 |
+ of any other Contributor, and only if You agree to indemnify, |
|
| 172 |
+ defend, and hold each Contributor harmless for any liability |
|
| 173 |
+ incurred by, or claims asserted against, such Contributor by reason |
|
| 174 |
+ of your accepting any such warranty or additional liability. |
|
| 175 |
+ |
|
| 176 |
+ END OF TERMS AND CONDITIONS |
|
| 177 |
+ |
|
| 178 |
+ Copyright 2015 The Linux Foundation. |
|
| 179 |
+ |
|
| 180 |
+ Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 181 |
+ you may not use this file except in compliance with the License. |
|
| 182 |
+ You may obtain a copy of the License at |
|
| 183 |
+ |
|
| 184 |
+ http://www.apache.org/licenses/LICENSE-2.0 |
|
| 185 |
+ |
|
| 186 |
+ Unless required by applicable law or agreed to in writing, software |
|
| 187 |
+ distributed under the License is distributed on an "AS IS" BASIS, |
|
| 188 |
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 189 |
+ See the License for the specific language governing permissions and |
|
| 190 |
+ limitations under the License. |
| 0 | 191 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,471 @@ |
| 0 |
+package specs |
|
| 1 |
+ |
|
| 2 |
+import "os" |
|
| 3 |
+ |
|
| 4 |
+// Spec is the base configuration for the container. |
|
| 5 |
+type Spec struct {
|
|
| 6 |
+ // Version is the version of the specification that is supported. |
|
| 7 |
+ Version string `json:"ociVersion"` |
|
| 8 |
+ // Platform is the host information for OS and Arch. |
|
| 9 |
+ Platform Platform `json:"platform"` |
|
| 10 |
+ // Process is the container's main process. |
|
| 11 |
+ Process Process `json:"process"` |
|
| 12 |
+ // Root is the root information for the container's filesystem. |
|
| 13 |
+ Root Root `json:"root"` |
|
| 14 |
+ // Hostname is the container's host name. |
|
| 15 |
+ Hostname string `json:"hostname,omitempty"` |
|
| 16 |
+ // Mounts profile configuration for adding mounts to the container's filesystem. |
|
| 17 |
+ Mounts []Mount `json:"mounts,omitempty"` |
|
| 18 |
+ // Hooks are the commands run at various lifecycle events of the container. |
|
| 19 |
+ Hooks Hooks `json:"hooks"` |
|
| 20 |
+ // Annotations is an unstructured key value map that may be set by external tools to store and retrieve arbitrary metadata. |
|
| 21 |
+ Annotations map[string]string `json:"annotations,omitempty"` |
|
| 22 |
+ |
|
| 23 |
+ // Linux is platform specific configuration for Linux based containers. |
|
| 24 |
+ Linux Linux `json:"linux" platform:"linux,omitempty"` |
|
| 25 |
+ // Solaris is platform specific configuration for Solaris containers. |
|
| 26 |
+ Solaris Solaris `json:"solaris" platform:"solaris,omitempty"` |
|
| 27 |
+} |
|
| 28 |
+ |
|
| 29 |
+// Process contains information to start a specific application inside the container. |
|
| 30 |
+type Process struct {
|
|
| 31 |
+ // Terminal creates an interactive terminal for the container. |
|
| 32 |
+ Terminal bool `json:"terminal,omitempty"` |
|
| 33 |
+ // User specifies user information for the process. |
|
| 34 |
+ User User `json:"user"` |
|
| 35 |
+ // Args specifies the binary and arguments for the application to execute. |
|
| 36 |
+ Args []string `json:"args"` |
|
| 37 |
+ // Env populates the process environment for the process. |
|
| 38 |
+ Env []string `json:"env,omitempty"` |
|
| 39 |
+ // Cwd is the current working directory for the process and must be |
|
| 40 |
+ // relative to the container's root. |
|
| 41 |
+ Cwd string `json:"cwd"` |
|
| 42 |
+ // Capabilities are Linux capabilities that are kept for the container. |
|
| 43 |
+ Capabilities []string `json:"capabilities,omitempty" platform:"linux"` |
|
| 44 |
+ // Rlimits specifies rlimit options to apply to the process. |
|
| 45 |
+ Rlimits []Rlimit `json:"rlimits,omitempty"` |
|
| 46 |
+ // NoNewPrivileges controls whether additional privileges could be gained by processes in the container. |
|
| 47 |
+ NoNewPrivileges bool `json:"noNewPrivileges,omitempty"` |
|
| 48 |
+ |
|
| 49 |
+ // ApparmorProfile specified the apparmor profile for the container. (this field is platform dependent) |
|
| 50 |
+ ApparmorProfile string `json:"apparmorProfile,omitempty" platform:"linux"` |
|
| 51 |
+ // SelinuxLabel specifies the selinux context that the container process is run as. (this field is platform dependent) |
|
| 52 |
+ SelinuxLabel string `json:"selinuxLabel,omitempty" platform:"linux"` |
|
| 53 |
+} |
|
| 54 |
+ |
|
| 55 |
+// User specifies Linux specific user and group information for the container's |
|
| 56 |
+// main process. |
|
| 57 |
+type User struct {
|
|
| 58 |
+ // UID is the user id. (this field is platform dependent) |
|
| 59 |
+ UID uint32 `json:"uid" platform:"linux"` |
|
| 60 |
+ // GID is the group id. (this field is platform dependent) |
|
| 61 |
+ GID uint32 `json:"gid" platform:"linux"` |
|
| 62 |
+ // AdditionalGids are additional group ids set for the container's process. (this field is platform dependent) |
|
| 63 |
+ AdditionalGids []uint32 `json:"additionalGids,omitempty" platform:"linux"` |
|
| 64 |
+} |
|
| 65 |
+ |
|
| 66 |
+// Root contains information about the container's root filesystem on the host. |
|
| 67 |
+type Root struct {
|
|
| 68 |
+ // Path is the absolute path to the container's root filesystem. |
|
| 69 |
+ Path string `json:"path"` |
|
| 70 |
+ // Readonly makes the root filesystem for the container readonly before the process is executed. |
|
| 71 |
+ Readonly bool `json:"readonly,omitempty"` |
|
| 72 |
+} |
|
| 73 |
+ |
|
| 74 |
+// Platform specifies OS and arch information for the host system that the container |
|
| 75 |
+// is created for. |
|
| 76 |
+type Platform struct {
|
|
| 77 |
+ // OS is the operating system. |
|
| 78 |
+ OS string `json:"os"` |
|
| 79 |
+ // Arch is the architecture |
|
| 80 |
+ Arch string `json:"arch"` |
|
| 81 |
+} |
|
| 82 |
+ |
|
| 83 |
+// Mount specifies a mount for a container. |
|
| 84 |
+type Mount struct {
|
|
| 85 |
+ // Destination is the path where the mount will be placed relative to the container's root. The path and child directories MUST exist, a runtime MUST NOT create directories automatically to a mount point. |
|
| 86 |
+ Destination string `json:"destination"` |
|
| 87 |
+ // Type specifies the mount kind. |
|
| 88 |
+ Type string `json:"type"` |
|
| 89 |
+ // Source specifies the source path of the mount. In the case of bind mounts on |
|
| 90 |
+ // Linux based systems this would be the file on the host. |
|
| 91 |
+ Source string `json:"source"` |
|
| 92 |
+ // Options are fstab style mount options. |
|
| 93 |
+ Options []string `json:"options,omitempty"` |
|
| 94 |
+} |
|
| 95 |
+ |
|
| 96 |
+// Hook specifies a command that is run at a particular event in the lifecycle of a container |
|
| 97 |
+type Hook struct {
|
|
| 98 |
+ Path string `json:"path"` |
|
| 99 |
+ Args []string `json:"args,omitempty"` |
|
| 100 |
+ Env []string `json:"env,omitempty"` |
|
| 101 |
+ Timeout *int `json:"timeout,omitempty"` |
|
| 102 |
+} |
|
| 103 |
+ |
|
| 104 |
+// Hooks for container setup and teardown |
|
| 105 |
+type Hooks struct {
|
|
| 106 |
+ // Prestart is a list of hooks to be run before the container process is executed. |
|
| 107 |
+ // On Linux, they are run after the container namespaces are created. |
|
| 108 |
+ Prestart []Hook `json:"prestart,omitempty"` |
|
| 109 |
+ // Poststart is a list of hooks to be run after the container process is started. |
|
| 110 |
+ Poststart []Hook `json:"poststart,omitempty"` |
|
| 111 |
+ // Poststop is a list of hooks to be run after the container process exits. |
|
| 112 |
+ Poststop []Hook `json:"poststop,omitempty"` |
|
| 113 |
+} |
|
| 114 |
+ |
|
| 115 |
+// Linux contains platform specific configuration for Linux based containers. |
|
| 116 |
+type Linux struct {
|
|
| 117 |
+ // UIDMapping specifies user mappings for supporting user namespaces on Linux. |
|
| 118 |
+ UIDMappings []IDMapping `json:"uidMappings,omitempty"` |
|
| 119 |
+ // GIDMapping specifies group mappings for supporting user namespaces on Linux. |
|
| 120 |
+ GIDMappings []IDMapping `json:"gidMappings,omitempty"` |
|
| 121 |
+ // Sysctl are a set of key value pairs that are set for the container on start |
|
| 122 |
+ Sysctl map[string]string `json:"sysctl,omitempty"` |
|
| 123 |
+ // Resources contain cgroup information for handling resource constraints |
|
| 124 |
+ // for the container |
|
| 125 |
+ Resources *Resources `json:"resources,omitempty"` |
|
| 126 |
+ // CgroupsPath specifies the path to cgroups that are created and/or joined by the container. |
|
| 127 |
+ // The path is expected to be relative to the cgroups mountpoint. |
|
| 128 |
+ // If resources are specified, the cgroups at CgroupsPath will be updated based on resources. |
|
| 129 |
+ CgroupsPath *string `json:"cgroupsPath,omitempty"` |
|
| 130 |
+ // Namespaces contains the namespaces that are created and/or joined by the container |
|
| 131 |
+ Namespaces []Namespace `json:"namespaces,omitempty"` |
|
| 132 |
+ // Devices are a list of device nodes that are created for the container |
|
| 133 |
+ Devices []Device `json:"devices,omitempty"` |
|
| 134 |
+ // Seccomp specifies the seccomp security settings for the container. |
|
| 135 |
+ Seccomp *Seccomp `json:"seccomp,omitempty"` |
|
| 136 |
+ // RootfsPropagation is the rootfs mount propagation mode for the container. |
|
| 137 |
+ RootfsPropagation string `json:"rootfsPropagation,omitempty"` |
|
| 138 |
+ // MaskedPaths masks over the provided paths inside the container. |
|
| 139 |
+ MaskedPaths []string `json:"maskedPaths,omitempty"` |
|
| 140 |
+ // ReadonlyPaths sets the provided paths as RO inside the container. |
|
| 141 |
+ ReadonlyPaths []string `json:"readonlyPaths,omitempty"` |
|
| 142 |
+ // MountLabel specifies the selinux context for the mounts in the container. |
|
| 143 |
+ MountLabel string `json:"mountLabel,omitempty"` |
|
| 144 |
+} |
|
| 145 |
+ |
|
| 146 |
+// Namespace is the configuration for a Linux namespace |
|
| 147 |
+type Namespace struct {
|
|
| 148 |
+ // Type is the type of Linux namespace |
|
| 149 |
+ Type NamespaceType `json:"type"` |
|
| 150 |
+ // Path is a path to an existing namespace persisted on disk that can be joined |
|
| 151 |
+ // and is of the same type |
|
| 152 |
+ Path string `json:"path,omitempty"` |
|
| 153 |
+} |
|
| 154 |
+ |
|
| 155 |
+// NamespaceType is one of the Linux namespaces |
|
| 156 |
+type NamespaceType string |
|
| 157 |
+ |
|
| 158 |
+const ( |
|
| 159 |
+ // PIDNamespace for isolating process IDs |
|
| 160 |
+ PIDNamespace NamespaceType = "pid" |
|
| 161 |
+ // NetworkNamespace for isolating network devices, stacks, ports, etc |
|
| 162 |
+ NetworkNamespace = "network" |
|
| 163 |
+ // MountNamespace for isolating mount points |
|
| 164 |
+ MountNamespace = "mount" |
|
| 165 |
+ // IPCNamespace for isolating System V IPC, POSIX message queues |
|
| 166 |
+ IPCNamespace = "ipc" |
|
| 167 |
+ // UTSNamespace for isolating hostname and NIS domain name |
|
| 168 |
+ UTSNamespace = "uts" |
|
| 169 |
+ // UserNamespace for isolating user and group IDs |
|
| 170 |
+ UserNamespace = "user" |
|
| 171 |
+ // CgroupNamespace for isolating cgroup hierarchies |
|
| 172 |
+ CgroupNamespace = "cgroup" |
|
| 173 |
+) |
|
| 174 |
+ |
|
| 175 |
+// IDMapping specifies UID/GID mappings |
|
| 176 |
+type IDMapping struct {
|
|
| 177 |
+ // HostID is the UID/GID of the host user or group |
|
| 178 |
+ HostID uint32 `json:"hostID"` |
|
| 179 |
+ // ContainerID is the UID/GID of the container's user or group |
|
| 180 |
+ ContainerID uint32 `json:"containerID"` |
|
| 181 |
+ // Size is the length of the range of IDs mapped between the two namespaces |
|
| 182 |
+ Size uint32 `json:"size"` |
|
| 183 |
+} |
|
| 184 |
+ |
|
| 185 |
+// Rlimit type and restrictions |
|
| 186 |
+type Rlimit struct {
|
|
| 187 |
+ // Type of the rlimit to set |
|
| 188 |
+ Type string `json:"type"` |
|
| 189 |
+ // Hard is the hard limit for the specified type |
|
| 190 |
+ Hard uint64 `json:"hard"` |
|
| 191 |
+ // Soft is the soft limit for the specified type |
|
| 192 |
+ Soft uint64 `json:"soft"` |
|
| 193 |
+} |
|
| 194 |
+ |
|
| 195 |
+// HugepageLimit structure corresponds to limiting kernel hugepages |
|
| 196 |
+type HugepageLimit struct {
|
|
| 197 |
+ // Pagesize is the hugepage size |
|
| 198 |
+ Pagesize *string `json:"pageSize,omitempty"` |
|
| 199 |
+ // Limit is the limit of "hugepagesize" hugetlb usage |
|
| 200 |
+ Limit *uint64 `json:"limit,omitempty"` |
|
| 201 |
+} |
|
| 202 |
+ |
|
| 203 |
+// InterfacePriority for network interfaces |
|
| 204 |
+type InterfacePriority struct {
|
|
| 205 |
+ // Name is the name of the network interface |
|
| 206 |
+ Name string `json:"name"` |
|
| 207 |
+ // Priority for the interface |
|
| 208 |
+ Priority uint32 `json:"priority"` |
|
| 209 |
+} |
|
| 210 |
+ |
|
| 211 |
+// blockIODevice holds major:minor format supported in blkio cgroup |
|
| 212 |
+type blockIODevice struct {
|
|
| 213 |
+ // Major is the device's major number. |
|
| 214 |
+ Major int64 `json:"major"` |
|
| 215 |
+ // Minor is the device's minor number. |
|
| 216 |
+ Minor int64 `json:"minor"` |
|
| 217 |
+} |
|
| 218 |
+ |
|
| 219 |
+// WeightDevice struct holds a `major:minor weight` pair for blkioWeightDevice |
|
| 220 |
+type WeightDevice struct {
|
|
| 221 |
+ blockIODevice |
|
| 222 |
+ // Weight is the bandwidth rate for the device, range is from 10 to 1000 |
|
| 223 |
+ Weight *uint16 `json:"weight,omitempty"` |
|
| 224 |
+ // LeafWeight is the bandwidth rate for the device while competing with the cgroup's child cgroups, range is from 10 to 1000, CFQ scheduler only |
|
| 225 |
+ LeafWeight *uint16 `json:"leafWeight,omitempty"` |
|
| 226 |
+} |
|
| 227 |
+ |
|
| 228 |
+// ThrottleDevice struct holds a `major:minor rate_per_second` pair |
|
| 229 |
+type ThrottleDevice struct {
|
|
| 230 |
+ blockIODevice |
|
| 231 |
+ // Rate is the IO rate limit per cgroup per device |
|
| 232 |
+ Rate *uint64 `json:"rate,omitempty"` |
|
| 233 |
+} |
|
| 234 |
+ |
|
| 235 |
+// BlockIO for Linux cgroup 'blkio' resource management |
|
| 236 |
+type BlockIO struct {
|
|
| 237 |
+ // Specifies per cgroup weight, range is from 10 to 1000 |
|
| 238 |
+ Weight *uint16 `json:"blkioWeight,omitempty"` |
|
| 239 |
+ // Specifies tasks' weight in the given cgroup while competing with the cgroup's child cgroups, range is from 10 to 1000, CFQ scheduler only |
|
| 240 |
+ LeafWeight *uint16 `json:"blkioLeafWeight,omitempty"` |
|
| 241 |
+ // Weight per cgroup per device, can override BlkioWeight |
|
| 242 |
+ WeightDevice []WeightDevice `json:"blkioWeightDevice,omitempty"` |
|
| 243 |
+ // IO read rate limit per cgroup per device, bytes per second |
|
| 244 |
+ ThrottleReadBpsDevice []ThrottleDevice `json:"blkioThrottleReadBpsDevice,omitempty"` |
|
| 245 |
+ // IO write rate limit per cgroup per device, bytes per second |
|
| 246 |
+ ThrottleWriteBpsDevice []ThrottleDevice `json:"blkioThrottleWriteBpsDevice,omitempty"` |
|
| 247 |
+ // IO read rate limit per cgroup per device, IO per second |
|
| 248 |
+ ThrottleReadIOPSDevice []ThrottleDevice `json:"blkioThrottleReadIOPSDevice,omitempty"` |
|
| 249 |
+ // IO write rate limit per cgroup per device, IO per second |
|
| 250 |
+ ThrottleWriteIOPSDevice []ThrottleDevice `json:"blkioThrottleWriteIOPSDevice,omitempty"` |
|
| 251 |
+} |
|
| 252 |
+ |
|
| 253 |
+// Memory for Linux cgroup 'memory' resource management |
|
| 254 |
+type Memory struct {
|
|
| 255 |
+ // Memory limit (in bytes). |
|
| 256 |
+ Limit *uint64 `json:"limit,omitempty"` |
|
| 257 |
+ // Memory reservation or soft_limit (in bytes). |
|
| 258 |
+ Reservation *uint64 `json:"reservation,omitempty"` |
|
| 259 |
+ // Total memory limit (memory + swap). |
|
| 260 |
+ Swap *uint64 `json:"swap,omitempty"` |
|
| 261 |
+ // Kernel memory limit (in bytes). |
|
| 262 |
+ Kernel *uint64 `json:"kernel,omitempty"` |
|
| 263 |
+ // Kernel memory limit for tcp (in bytes) |
|
| 264 |
+ KernelTCP *uint64 `json:"kernelTCP"` |
|
| 265 |
+ // How aggressive the kernel will swap memory pages. Range from 0 to 100. |
|
| 266 |
+ Swappiness *uint64 `json:"swappiness,omitempty"` |
|
| 267 |
+} |
|
| 268 |
+ |
|
| 269 |
+// CPU for Linux cgroup 'cpu' resource management |
|
| 270 |
+type CPU struct {
|
|
| 271 |
+ // CPU shares (relative weight (ratio) vs. other cgroups with cpu shares). |
|
| 272 |
+ Shares *uint64 `json:"shares,omitempty"` |
|
| 273 |
+ // CPU hardcap limit (in usecs). Allowed cpu time in a given period. |
|
| 274 |
+ Quota *uint64 `json:"quota,omitempty"` |
|
| 275 |
+ // CPU period to be used for hardcapping (in usecs). |
|
| 276 |
+ Period *uint64 `json:"period,omitempty"` |
|
| 277 |
+ // How much time realtime scheduling may use (in usecs). |
|
| 278 |
+ RealtimeRuntime *uint64 `json:"realtimeRuntime,omitempty"` |
|
| 279 |
+ // CPU period to be used for realtime scheduling (in usecs). |
|
| 280 |
+ RealtimePeriod *uint64 `json:"realtimePeriod,omitempty"` |
|
| 281 |
+ // CPUs to use within the cpuset. Default is to use any CPU available. |
|
| 282 |
+ Cpus *string `json:"cpus,omitempty"` |
|
| 283 |
+ // List of memory nodes in the cpuset. Default is to use any available memory node. |
|
| 284 |
+ Mems *string `json:"mems,omitempty"` |
|
| 285 |
+} |
|
| 286 |
+ |
|
| 287 |
+// Pids for Linux cgroup 'pids' resource management (Linux 4.3) |
|
| 288 |
+type Pids struct {
|
|
| 289 |
+ // Maximum number of PIDs. Default is "no limit". |
|
| 290 |
+ Limit *int64 `json:"limit,omitempty"` |
|
| 291 |
+} |
|
| 292 |
+ |
|
| 293 |
+// Network identification and priority configuration |
|
| 294 |
+type Network struct {
|
|
| 295 |
+ // Set class identifier for container's network packets |
|
| 296 |
+ ClassID *uint32 `json:"classID"` |
|
| 297 |
+ // Set priority of network traffic for container |
|
| 298 |
+ Priorities []InterfacePriority `json:"priorities,omitempty"` |
|
| 299 |
+} |
|
| 300 |
+ |
|
| 301 |
+// Resources has container runtime resource constraints |
|
| 302 |
+type Resources struct {
|
|
| 303 |
+ // Devices are a list of device rules for the whitelist controller |
|
| 304 |
+ Devices []DeviceCgroup `json:"devices"` |
|
| 305 |
+ // DisableOOMKiller disables the OOM killer for out of memory conditions |
|
| 306 |
+ DisableOOMKiller *bool `json:"disableOOMKiller,omitempty"` |
|
| 307 |
+ // Specify an oom_score_adj for the container. |
|
| 308 |
+ OOMScoreAdj *int `json:"oomScoreAdj,omitempty"` |
|
| 309 |
+ // Memory restriction configuration |
|
| 310 |
+ Memory *Memory `json:"memory,omitempty"` |
|
| 311 |
+ // CPU resource restriction configuration |
|
| 312 |
+ CPU *CPU `json:"cpu,omitempty"` |
|
| 313 |
+ // Task resource restriction configuration. |
|
| 314 |
+ Pids *Pids `json:"pids,omitempty"` |
|
| 315 |
+ // BlockIO restriction configuration |
|
| 316 |
+ BlockIO *BlockIO `json:"blockIO,omitempty"` |
|
| 317 |
+ // Hugetlb limit (in bytes) |
|
| 318 |
+ HugepageLimits []HugepageLimit `json:"hugepageLimits,omitempty"` |
|
| 319 |
+ // Network restriction configuration |
|
| 320 |
+ Network *Network `json:"network,omitempty"` |
|
| 321 |
+} |
|
| 322 |
+ |
|
| 323 |
+// Device represents the mknod information for a Linux special device file |
|
| 324 |
+type Device struct {
|
|
| 325 |
+ // Path to the device. |
|
| 326 |
+ Path string `json:"path"` |
|
| 327 |
+ // Device type, block, char, etc. |
|
| 328 |
+ Type string `json:"type"` |
|
| 329 |
+ // Major is the device's major number. |
|
| 330 |
+ Major int64 `json:"major"` |
|
| 331 |
+ // Minor is the device's minor number. |
|
| 332 |
+ Minor int64 `json:"minor"` |
|
| 333 |
+ // FileMode permission bits for the device. |
|
| 334 |
+ FileMode *os.FileMode `json:"fileMode,omitempty"` |
|
| 335 |
+ // UID of the device. |
|
| 336 |
+ UID *uint32 `json:"uid,omitempty"` |
|
| 337 |
+ // Gid of the device. |
|
| 338 |
+ GID *uint32 `json:"gid,omitempty"` |
|
| 339 |
+} |
|
| 340 |
+ |
|
| 341 |
+// DeviceCgroup represents a device rule for the whitelist controller |
|
| 342 |
+type DeviceCgroup struct {
|
|
| 343 |
+ // Allow or deny |
|
| 344 |
+ Allow bool `json:"allow"` |
|
| 345 |
+ // Device type, block, char, etc. |
|
| 346 |
+ Type *string `json:"type,omitempty"` |
|
| 347 |
+ // Major is the device's major number. |
|
| 348 |
+ Major *int64 `json:"major,omitempty"` |
|
| 349 |
+ // Minor is the device's minor number. |
|
| 350 |
+ Minor *int64 `json:"minor,omitempty"` |
|
| 351 |
+ // Cgroup access permissions format, rwm. |
|
| 352 |
+ Access *string `json:"access,omitempty"` |
|
| 353 |
+} |
|
| 354 |
+ |
|
| 355 |
+// Seccomp represents syscall restrictions |
|
| 356 |
+type Seccomp struct {
|
|
| 357 |
+ DefaultAction Action `json:"defaultAction"` |
|
| 358 |
+ Architectures []Arch `json:"architectures"` |
|
| 359 |
+ Syscalls []Syscall `json:"syscalls,omitempty"` |
|
| 360 |
+} |
|
| 361 |
+ |
|
| 362 |
+// Solaris contains platform specific configuration for Solaris application containers. |
|
| 363 |
+type Solaris struct {
|
|
| 364 |
+ // SMF FMRI which should go "online" before we start the container process. |
|
| 365 |
+ Milestone string `json:"milestone,omitempty"` |
|
| 366 |
+ // Maximum set of privileges any process in this container can obtain. |
|
| 367 |
+ LimitPriv string `json:"limitpriv,omitempty"` |
|
| 368 |
+ // The maximum amount of shared memory allowed for this container. |
|
| 369 |
+ MaxShmMemory string `json:"maxShmMemory,omitempty"` |
|
| 370 |
+ // Specification for automatic creation of network resources for this container. |
|
| 371 |
+ Anet []Anet `json:"anet,omitempty"` |
|
| 372 |
+ // Set limit on the amount of CPU time that can be used by container. |
|
| 373 |
+ CappedCPU CappedCPU `json:"cappedCPU,omitempty"` |
|
| 374 |
+ // The physical and swap caps on the memory that can be used by this container. |
|
| 375 |
+ CappedMemory CappedMemory `json:"cappedMemory,omitempty"` |
|
| 376 |
+} |
|
| 377 |
+ |
|
| 378 |
+// CappedCPU allows users to set limit on the amount of CPU time that can be used by container. |
|
| 379 |
+type CappedCPU struct {
|
|
| 380 |
+ Ncpus string `json:"ncpus,omitempty"` |
|
| 381 |
+} |
|
| 382 |
+ |
|
| 383 |
+// CappedMemory allows users to set the physical and swap caps on the memory that can be used by this container. |
|
| 384 |
+type CappedMemory struct {
|
|
| 385 |
+ Physical string `json:"physical,omitempty"` |
|
| 386 |
+ Swap string `json:"swap,omitempty"` |
|
| 387 |
+} |
|
| 388 |
+ |
|
| 389 |
+// Anet provides the specification for automatic creation of network resources for this container. |
|
| 390 |
+type Anet struct {
|
|
| 391 |
+ // Specify a name for the automatically created VNIC datalink. |
|
| 392 |
+ Linkname string `json:"linkname,omitempty"` |
|
| 393 |
+ // Specify the link over which the VNIC will be created. |
|
| 394 |
+ Lowerlink string `json:"lowerLink,omitempty"` |
|
| 395 |
+ // The set of IP addresses that the container can use. |
|
| 396 |
+ Allowedaddr string `json:"allowedAddress,omitempty"` |
|
| 397 |
+ // Specifies whether allowedAddress limitation is to be applied to the VNIC. |
|
| 398 |
+ Configallowedaddr string `json:"configureAllowedAddress,omitempty"` |
|
| 399 |
+ // The value of the optional default router. |
|
| 400 |
+ Defrouter string `json:"defrouter,omitempty"` |
|
| 401 |
+ // Enable one or more types of link protection. |
|
| 402 |
+ Linkprotection string `json:"linkProtection,omitempty"` |
|
| 403 |
+ // Set the VNIC's macAddress |
|
| 404 |
+ Macaddress string `json:"macAddress,omitempty"` |
|
| 405 |
+} |
|
| 406 |
+ |
|
| 407 |
+// Arch used for additional architectures |
|
| 408 |
+type Arch string |
|
| 409 |
+ |
|
| 410 |
+// Additional architectures permitted to be used for system calls |
|
| 411 |
+// By default only the native architecture of the kernel is permitted |
|
| 412 |
+const ( |
|
| 413 |
+ ArchX86 Arch = "SCMP_ARCH_X86" |
|
| 414 |
+ ArchX86_64 Arch = "SCMP_ARCH_X86_64" |
|
| 415 |
+ ArchX32 Arch = "SCMP_ARCH_X32" |
|
| 416 |
+ ArchARM Arch = "SCMP_ARCH_ARM" |
|
| 417 |
+ ArchAARCH64 Arch = "SCMP_ARCH_AARCH64" |
|
| 418 |
+ ArchMIPS Arch = "SCMP_ARCH_MIPS" |
|
| 419 |
+ ArchMIPS64 Arch = "SCMP_ARCH_MIPS64" |
|
| 420 |
+ ArchMIPS64N32 Arch = "SCMP_ARCH_MIPS64N32" |
|
| 421 |
+ ArchMIPSEL Arch = "SCMP_ARCH_MIPSEL" |
|
| 422 |
+ ArchMIPSEL64 Arch = "SCMP_ARCH_MIPSEL64" |
|
| 423 |
+ ArchMIPSEL64N32 Arch = "SCMP_ARCH_MIPSEL64N32" |
|
| 424 |
+ ArchPPC Arch = "SCMP_ARCH_PPC" |
|
| 425 |
+ ArchPPC64 Arch = "SCMP_ARCH_PPC64" |
|
| 426 |
+ ArchPPC64LE Arch = "SCMP_ARCH_PPC64LE" |
|
| 427 |
+ ArchS390 Arch = "SCMP_ARCH_S390" |
|
| 428 |
+ ArchS390X Arch = "SCMP_ARCH_S390X" |
|
| 429 |
+) |
|
| 430 |
+ |
|
| 431 |
+// Action taken upon Seccomp rule match |
|
| 432 |
+type Action string |
|
| 433 |
+ |
|
| 434 |
+// Define actions for Seccomp rules |
|
| 435 |
+const ( |
|
| 436 |
+ ActKill Action = "SCMP_ACT_KILL" |
|
| 437 |
+ ActTrap Action = "SCMP_ACT_TRAP" |
|
| 438 |
+ ActErrno Action = "SCMP_ACT_ERRNO" |
|
| 439 |
+ ActTrace Action = "SCMP_ACT_TRACE" |
|
| 440 |
+ ActAllow Action = "SCMP_ACT_ALLOW" |
|
| 441 |
+) |
|
| 442 |
+ |
|
| 443 |
+// Operator used to match syscall arguments in Seccomp |
|
| 444 |
+type Operator string |
|
| 445 |
+ |
|
| 446 |
+// Define operators for syscall arguments in Seccomp |
|
| 447 |
+const ( |
|
| 448 |
+ OpNotEqual Operator = "SCMP_CMP_NE" |
|
| 449 |
+ OpLessThan Operator = "SCMP_CMP_LT" |
|
| 450 |
+ OpLessEqual Operator = "SCMP_CMP_LE" |
|
| 451 |
+ OpEqualTo Operator = "SCMP_CMP_EQ" |
|
| 452 |
+ OpGreaterEqual Operator = "SCMP_CMP_GE" |
|
| 453 |
+ OpGreaterThan Operator = "SCMP_CMP_GT" |
|
| 454 |
+ OpMaskedEqual Operator = "SCMP_CMP_MASKED_EQ" |
|
| 455 |
+) |
|
| 456 |
+ |
|
| 457 |
+// Arg used for matching specific syscall arguments in Seccomp |
|
| 458 |
+type Arg struct {
|
|
| 459 |
+ Index uint `json:"index"` |
|
| 460 |
+ Value uint64 `json:"value"` |
|
| 461 |
+ ValueTwo uint64 `json:"valueTwo"` |
|
| 462 |
+ Op Operator `json:"op"` |
|
| 463 |
+} |
|
| 464 |
+ |
|
| 465 |
+// Syscall is used to match a syscall in Seccomp |
|
| 466 |
+type Syscall struct {
|
|
| 467 |
+ Name string `json:"name"` |
|
| 468 |
+ Action Action `json:"action"` |
|
| 469 |
+ Args []Arg `json:"args,omitempty"` |
|
| 470 |
+} |
| 0 | 471 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,17 @@ |
| 0 |
+package specs |
|
| 1 |
+ |
|
| 2 |
+// State holds information about the runtime state of the container. |
|
| 3 |
+type State struct {
|
|
| 4 |
+ // Version is the version of the specification that is supported. |
|
| 5 |
+ Version string `json:"version"` |
|
| 6 |
+ // ID is the container ID |
|
| 7 |
+ ID string `json:"id"` |
|
| 8 |
+ // Status is the runtime state of the container. |
|
| 9 |
+ Status string `json:"status"` |
|
| 10 |
+ // Pid is the process id for the container's main process. |
|
| 11 |
+ Pid int `json:"pid"` |
|
| 12 |
+ // BundlePath is the path to the container's bundle directory. |
|
| 13 |
+ BundlePath string `json:"bundlePath"` |
|
| 14 |
+ // Annotations are the annotations associated with the container. |
|
| 15 |
+ Annotations map[string]string `json:"annotations"` |
|
| 16 |
+} |
| 0 | 17 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,18 @@ |
| 0 |
+package specs |
|
| 1 |
+ |
|
| 2 |
+import "fmt" |
|
| 3 |
+ |
|
| 4 |
+const ( |
|
| 5 |
+ // VersionMajor is for an API incompatible changes |
|
| 6 |
+ VersionMajor = 1 |
|
| 7 |
+ // VersionMinor is for functionality in a backwards-compatible manner |
|
| 8 |
+ VersionMinor = 0 |
|
| 9 |
+ // VersionPatch is for backwards-compatible bug fixes |
|
| 10 |
+ VersionPatch = 0 |
|
| 11 |
+ |
|
| 12 |
+ // VersionDev indicates development branch. Releases will be empty string. |
|
| 13 |
+ VersionDev = "-rc1" |
|
| 14 |
+) |
|
| 15 |
+ |
|
| 16 |
+// Version is the specification version that the package types support. |
|
| 17 |
+var Version = fmt.Sprintf("%d.%d.%d%s", VersionMajor, VersionMinor, VersionPatch, VersionDev)
|
| 0 | 18 |
deleted file mode 100644 |
| ... | ... |
@@ -1,191 +0,0 @@ |
| 1 |
- |
|
| 2 |
- Apache License |
|
| 3 |
- Version 2.0, January 2004 |
|
| 4 |
- http://www.apache.org/licenses/ |
|
| 5 |
- |
|
| 6 |
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION |
|
| 7 |
- |
|
| 8 |
- 1. Definitions. |
|
| 9 |
- |
|
| 10 |
- "License" shall mean the terms and conditions for use, reproduction, |
|
| 11 |
- and distribution as defined by Sections 1 through 9 of this document. |
|
| 12 |
- |
|
| 13 |
- "Licensor" shall mean the copyright owner or entity authorized by |
|
| 14 |
- the copyright owner that is granting the License. |
|
| 15 |
- |
|
| 16 |
- "Legal Entity" shall mean the union of the acting entity and all |
|
| 17 |
- other entities that control, are controlled by, or are under common |
|
| 18 |
- control with that entity. For the purposes of this definition, |
|
| 19 |
- "control" means (i) the power, direct or indirect, to cause the |
|
| 20 |
- direction or management of such entity, whether by contract or |
|
| 21 |
- otherwise, or (ii) ownership of fifty percent (50%) or more of the |
|
| 22 |
- outstanding shares, or (iii) beneficial ownership of such entity. |
|
| 23 |
- |
|
| 24 |
- "You" (or "Your") shall mean an individual or Legal Entity |
|
| 25 |
- exercising permissions granted by this License. |
|
| 26 |
- |
|
| 27 |
- "Source" form shall mean the preferred form for making modifications, |
|
| 28 |
- including but not limited to software source code, documentation |
|
| 29 |
- source, and configuration files. |
|
| 30 |
- |
|
| 31 |
- "Object" form shall mean any form resulting from mechanical |
|
| 32 |
- transformation or translation of a Source form, including but |
|
| 33 |
- not limited to compiled object code, generated documentation, |
|
| 34 |
- and conversions to other media types. |
|
| 35 |
- |
|
| 36 |
- "Work" shall mean the work of authorship, whether in Source or |
|
| 37 |
- Object form, made available under the License, as indicated by a |
|
| 38 |
- copyright notice that is included in or attached to the work |
|
| 39 |
- (an example is provided in the Appendix below). |
|
| 40 |
- |
|
| 41 |
- "Derivative Works" shall mean any work, whether in Source or Object |
|
| 42 |
- form, that is based on (or derived from) the Work and for which the |
|
| 43 |
- editorial revisions, annotations, elaborations, or other modifications |
|
| 44 |
- represent, as a whole, an original work of authorship. For the purposes |
|
| 45 |
- of this License, Derivative Works shall not include works that remain |
|
| 46 |
- separable from, or merely link (or bind by name) to the interfaces of, |
|
| 47 |
- the Work and Derivative Works thereof. |
|
| 48 |
- |
|
| 49 |
- "Contribution" shall mean any work of authorship, including |
|
| 50 |
- the original version of the Work and any modifications or additions |
|
| 51 |
- to that Work or Derivative Works thereof, that is intentionally |
|
| 52 |
- submitted to Licensor for inclusion in the Work by the copyright owner |
|
| 53 |
- or by an individual or Legal Entity authorized to submit on behalf of |
|
| 54 |
- the copyright owner. For the purposes of this definition, "submitted" |
|
| 55 |
- means any form of electronic, verbal, or written communication sent |
|
| 56 |
- to the Licensor or its representatives, including but not limited to |
|
| 57 |
- communication on electronic mailing lists, source code control systems, |
|
| 58 |
- and issue tracking systems that are managed by, or on behalf of, the |
|
| 59 |
- Licensor for the purpose of discussing and improving the Work, but |
|
| 60 |
- excluding communication that is conspicuously marked or otherwise |
|
| 61 |
- designated in writing by the copyright owner as "Not a Contribution." |
|
| 62 |
- |
|
| 63 |
- "Contributor" shall mean Licensor and any individual or Legal Entity |
|
| 64 |
- on behalf of whom a Contribution has been received by Licensor and |
|
| 65 |
- subsequently incorporated within the Work. |
|
| 66 |
- |
|
| 67 |
- 2. Grant of Copyright License. Subject to the terms and conditions of |
|
| 68 |
- this License, each Contributor hereby grants to You a perpetual, |
|
| 69 |
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
|
| 70 |
- copyright license to reproduce, prepare Derivative Works of, |
|
| 71 |
- publicly display, publicly perform, sublicense, and distribute the |
|
| 72 |
- Work and such Derivative Works in Source or Object form. |
|
| 73 |
- |
|
| 74 |
- 3. Grant of Patent License. Subject to the terms and conditions of |
|
| 75 |
- this License, each Contributor hereby grants to You a perpetual, |
|
| 76 |
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
|
| 77 |
- (except as stated in this section) patent license to make, have made, |
|
| 78 |
- use, offer to sell, sell, import, and otherwise transfer the Work, |
|
| 79 |
- where such license applies only to those patent claims licensable |
|
| 80 |
- by such Contributor that are necessarily infringed by their |
|
| 81 |
- Contribution(s) alone or by combination of their Contribution(s) |
|
| 82 |
- with the Work to which such Contribution(s) was submitted. If You |
|
| 83 |
- institute patent litigation against any entity (including a |
|
| 84 |
- cross-claim or counterclaim in a lawsuit) alleging that the Work |
|
| 85 |
- or a Contribution incorporated within the Work constitutes direct |
|
| 86 |
- or contributory patent infringement, then any patent licenses |
|
| 87 |
- granted to You under this License for that Work shall terminate |
|
| 88 |
- as of the date such litigation is filed. |
|
| 89 |
- |
|
| 90 |
- 4. Redistribution. You may reproduce and distribute copies of the |
|
| 91 |
- Work or Derivative Works thereof in any medium, with or without |
|
| 92 |
- modifications, and in Source or Object form, provided that You |
|
| 93 |
- meet the following conditions: |
|
| 94 |
- |
|
| 95 |
- (a) You must give any other recipients of the Work or |
|
| 96 |
- Derivative Works a copy of this License; and |
|
| 97 |
- |
|
| 98 |
- (b) You must cause any modified files to carry prominent notices |
|
| 99 |
- stating that You changed the files; and |
|
| 100 |
- |
|
| 101 |
- (c) You must retain, in the Source form of any Derivative Works |
|
| 102 |
- that You distribute, all copyright, patent, trademark, and |
|
| 103 |
- attribution notices from the Source form of the Work, |
|
| 104 |
- excluding those notices that do not pertain to any part of |
|
| 105 |
- the Derivative Works; and |
|
| 106 |
- |
|
| 107 |
- (d) If the Work includes a "NOTICE" text file as part of its |
|
| 108 |
- distribution, then any Derivative Works that You distribute must |
|
| 109 |
- include a readable copy of the attribution notices contained |
|
| 110 |
- within such NOTICE file, excluding those notices that do not |
|
| 111 |
- pertain to any part of the Derivative Works, in at least one |
|
| 112 |
- of the following places: within a NOTICE text file distributed |
|
| 113 |
- as part of the Derivative Works; within the Source form or |
|
| 114 |
- documentation, if provided along with the Derivative Works; or, |
|
| 115 |
- within a display generated by the Derivative Works, if and |
|
| 116 |
- wherever such third-party notices normally appear. The contents |
|
| 117 |
- of the NOTICE file are for informational purposes only and |
|
| 118 |
- do not modify the License. You may add Your own attribution |
|
| 119 |
- notices within Derivative Works that You distribute, alongside |
|
| 120 |
- or as an addendum to the NOTICE text from the Work, provided |
|
| 121 |
- that such additional attribution notices cannot be construed |
|
| 122 |
- as modifying the License. |
|
| 123 |
- |
|
| 124 |
- You may add Your own copyright statement to Your modifications and |
|
| 125 |
- may provide additional or different license terms and conditions |
|
| 126 |
- for use, reproduction, or distribution of Your modifications, or |
|
| 127 |
- for any such Derivative Works as a whole, provided Your use, |
|
| 128 |
- reproduction, and distribution of the Work otherwise complies with |
|
| 129 |
- the conditions stated in this License. |
|
| 130 |
- |
|
| 131 |
- 5. Submission of Contributions. Unless You explicitly state otherwise, |
|
| 132 |
- any Contribution intentionally submitted for inclusion in the Work |
|
| 133 |
- by You to the Licensor shall be under the terms and conditions of |
|
| 134 |
- this License, without any additional terms or conditions. |
|
| 135 |
- Notwithstanding the above, nothing herein shall supersede or modify |
|
| 136 |
- the terms of any separate license agreement you may have executed |
|
| 137 |
- with Licensor regarding such Contributions. |
|
| 138 |
- |
|
| 139 |
- 6. Trademarks. This License does not grant permission to use the trade |
|
| 140 |
- names, trademarks, service marks, or product names of the Licensor, |
|
| 141 |
- except as required for reasonable and customary use in describing the |
|
| 142 |
- origin of the Work and reproducing the content of the NOTICE file. |
|
| 143 |
- |
|
| 144 |
- 7. Disclaimer of Warranty. Unless required by applicable law or |
|
| 145 |
- agreed to in writing, Licensor provides the Work (and each |
|
| 146 |
- Contributor provides its Contributions) on an "AS IS" BASIS, |
|
| 147 |
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
|
| 148 |
- implied, including, without limitation, any warranties or conditions |
|
| 149 |
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A |
|
| 150 |
- PARTICULAR PURPOSE. You are solely responsible for determining the |
|
| 151 |
- appropriateness of using or redistributing the Work and assume any |
|
| 152 |
- risks associated with Your exercise of permissions under this License. |
|
| 153 |
- |
|
| 154 |
- 8. Limitation of Liability. In no event and under no legal theory, |
|
| 155 |
- whether in tort (including negligence), contract, or otherwise, |
|
| 156 |
- unless required by applicable law (such as deliberate and grossly |
|
| 157 |
- negligent acts) or agreed to in writing, shall any Contributor be |
|
| 158 |
- liable to You for damages, including any direct, indirect, special, |
|
| 159 |
- incidental, or consequential damages of any character arising as a |
|
| 160 |
- result of this License or out of the use or inability to use the |
|
| 161 |
- Work (including but not limited to damages for loss of goodwill, |
|
| 162 |
- work stoppage, computer failure or malfunction, or any and all |
|
| 163 |
- other commercial damages or losses), even if such Contributor |
|
| 164 |
- has been advised of the possibility of such damages. |
|
| 165 |
- |
|
| 166 |
- 9. Accepting Warranty or Additional Liability. While redistributing |
|
| 167 |
- the Work or Derivative Works thereof, You may choose to offer, |
|
| 168 |
- and charge a fee for, acceptance of support, warranty, indemnity, |
|
| 169 |
- or other liability obligations and/or rights consistent with this |
|
| 170 |
- License. However, in accepting such obligations, You may act only |
|
| 171 |
- on Your own behalf and on Your sole responsibility, not on behalf |
|
| 172 |
- of any other Contributor, and only if You agree to indemnify, |
|
| 173 |
- defend, and hold each Contributor harmless for any liability |
|
| 174 |
- incurred by, or claims asserted against, such Contributor by reason |
|
| 175 |
- of your accepting any such warranty or additional liability. |
|
| 176 |
- |
|
| 177 |
- END OF TERMS AND CONDITIONS |
|
| 178 |
- |
|
| 179 |
- Copyright 2015 The Linux Foundation. |
|
| 180 |
- |
|
| 181 |
- Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 182 |
- you may not use this file except in compliance with the License. |
|
| 183 |
- You may obtain a copy of the License at |
|
| 184 |
- |
|
| 185 |
- http://www.apache.org/licenses/LICENSE-2.0 |
|
| 186 |
- |
|
| 187 |
- Unless required by applicable law or agreed to in writing, software |
|
| 188 |
- distributed under the License is distributed on an "AS IS" BASIS, |
|
| 189 |
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 190 |
- See the License for the specific language governing permissions and |
|
| 191 |
- limitations under the License. |
| 192 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,471 +0,0 @@ |
| 1 |
-package specs |
|
| 2 |
- |
|
| 3 |
-import "os" |
|
| 4 |
- |
|
| 5 |
-// Spec is the base configuration for the container. |
|
| 6 |
-type Spec struct {
|
|
| 7 |
- // Version is the version of the specification that is supported. |
|
| 8 |
- Version string `json:"ociVersion"` |
|
| 9 |
- // Platform is the host information for OS and Arch. |
|
| 10 |
- Platform Platform `json:"platform"` |
|
| 11 |
- // Process is the container's main process. |
|
| 12 |
- Process Process `json:"process"` |
|
| 13 |
- // Root is the root information for the container's filesystem. |
|
| 14 |
- Root Root `json:"root"` |
|
| 15 |
- // Hostname is the container's host name. |
|
| 16 |
- Hostname string `json:"hostname,omitempty"` |
|
| 17 |
- // Mounts profile configuration for adding mounts to the container's filesystem. |
|
| 18 |
- Mounts []Mount `json:"mounts,omitempty"` |
|
| 19 |
- // Hooks are the commands run at various lifecycle events of the container. |
|
| 20 |
- Hooks Hooks `json:"hooks"` |
|
| 21 |
- // Annotations is an unstructured key value map that may be set by external tools to store and retrieve arbitrary metadata. |
|
| 22 |
- Annotations map[string]string `json:"annotations,omitempty"` |
|
| 23 |
- |
|
| 24 |
- // Linux is platform specific configuration for Linux based containers. |
|
| 25 |
- Linux Linux `json:"linux" platform:"linux,omitempty"` |
|
| 26 |
- // Solaris is platform specific configuration for Solaris containers. |
|
| 27 |
- Solaris Solaris `json:"solaris" platform:"solaris,omitempty"` |
|
| 28 |
-} |
|
| 29 |
- |
|
| 30 |
-// Process contains information to start a specific application inside the container. |
|
| 31 |
-type Process struct {
|
|
| 32 |
- // Terminal creates an interactive terminal for the container. |
|
| 33 |
- Terminal bool `json:"terminal,omitempty"` |
|
| 34 |
- // User specifies user information for the process. |
|
| 35 |
- User User `json:"user"` |
|
| 36 |
- // Args specifies the binary and arguments for the application to execute. |
|
| 37 |
- Args []string `json:"args"` |
|
| 38 |
- // Env populates the process environment for the process. |
|
| 39 |
- Env []string `json:"env,omitempty"` |
|
| 40 |
- // Cwd is the current working directory for the process and must be |
|
| 41 |
- // relative to the container's root. |
|
| 42 |
- Cwd string `json:"cwd"` |
|
| 43 |
- // Capabilities are Linux capabilities that are kept for the container. |
|
| 44 |
- Capabilities []string `json:"capabilities,omitempty" platform:"linux"` |
|
| 45 |
- // Rlimits specifies rlimit options to apply to the process. |
|
| 46 |
- Rlimits []Rlimit `json:"rlimits,omitempty"` |
|
| 47 |
- // NoNewPrivileges controls whether additional privileges could be gained by processes in the container. |
|
| 48 |
- NoNewPrivileges bool `json:"noNewPrivileges,omitempty"` |
|
| 49 |
- |
|
| 50 |
- // ApparmorProfile specified the apparmor profile for the container. (this field is platform dependent) |
|
| 51 |
- ApparmorProfile string `json:"apparmorProfile,omitempty" platform:"linux"` |
|
| 52 |
- // SelinuxLabel specifies the selinux context that the container process is run as. (this field is platform dependent) |
|
| 53 |
- SelinuxLabel string `json:"selinuxLabel,omitempty" platform:"linux"` |
|
| 54 |
-} |
|
| 55 |
- |
|
| 56 |
-// User specifies Linux specific user and group information for the container's |
|
| 57 |
-// main process. |
|
| 58 |
-type User struct {
|
|
| 59 |
- // UID is the user id. (this field is platform dependent) |
|
| 60 |
- UID uint32 `json:"uid" platform:"linux"` |
|
| 61 |
- // GID is the group id. (this field is platform dependent) |
|
| 62 |
- GID uint32 `json:"gid" platform:"linux"` |
|
| 63 |
- // AdditionalGids are additional group ids set for the container's process. (this field is platform dependent) |
|
| 64 |
- AdditionalGids []uint32 `json:"additionalGids,omitempty" platform:"linux"` |
|
| 65 |
-} |
|
| 66 |
- |
|
| 67 |
-// Root contains information about the container's root filesystem on the host. |
|
| 68 |
-type Root struct {
|
|
| 69 |
- // Path is the absolute path to the container's root filesystem. |
|
| 70 |
- Path string `json:"path"` |
|
| 71 |
- // Readonly makes the root filesystem for the container readonly before the process is executed. |
|
| 72 |
- Readonly bool `json:"readonly,omitempty"` |
|
| 73 |
-} |
|
| 74 |
- |
|
| 75 |
-// Platform specifies OS and arch information for the host system that the container |
|
| 76 |
-// is created for. |
|
| 77 |
-type Platform struct {
|
|
| 78 |
- // OS is the operating system. |
|
| 79 |
- OS string `json:"os"` |
|
| 80 |
- // Arch is the architecture |
|
| 81 |
- Arch string `json:"arch"` |
|
| 82 |
-} |
|
| 83 |
- |
|
| 84 |
-// Mount specifies a mount for a container. |
|
| 85 |
-type Mount struct {
|
|
| 86 |
- // Destination is the path where the mount will be placed relative to the container's root. The path and child directories MUST exist, a runtime MUST NOT create directories automatically to a mount point. |
|
| 87 |
- Destination string `json:"destination"` |
|
| 88 |
- // Type specifies the mount kind. |
|
| 89 |
- Type string `json:"type"` |
|
| 90 |
- // Source specifies the source path of the mount. In the case of bind mounts on |
|
| 91 |
- // Linux based systems this would be the file on the host. |
|
| 92 |
- Source string `json:"source"` |
|
| 93 |
- // Options are fstab style mount options. |
|
| 94 |
- Options []string `json:"options,omitempty"` |
|
| 95 |
-} |
|
| 96 |
- |
|
| 97 |
-// Hook specifies a command that is run at a particular event in the lifecycle of a container |
|
| 98 |
-type Hook struct {
|
|
| 99 |
- Path string `json:"path"` |
|
| 100 |
- Args []string `json:"args,omitempty"` |
|
| 101 |
- Env []string `json:"env,omitempty"` |
|
| 102 |
- Timeout *int `json:"timeout,omitempty"` |
|
| 103 |
-} |
|
| 104 |
- |
|
| 105 |
-// Hooks for container setup and teardown |
|
| 106 |
-type Hooks struct {
|
|
| 107 |
- // Prestart is a list of hooks to be run before the container process is executed. |
|
| 108 |
- // On Linux, they are run after the container namespaces are created. |
|
| 109 |
- Prestart []Hook `json:"prestart,omitempty"` |
|
| 110 |
- // Poststart is a list of hooks to be run after the container process is started. |
|
| 111 |
- Poststart []Hook `json:"poststart,omitempty"` |
|
| 112 |
- // Poststop is a list of hooks to be run after the container process exits. |
|
| 113 |
- Poststop []Hook `json:"poststop,omitempty"` |
|
| 114 |
-} |
|
| 115 |
- |
|
| 116 |
-// Linux contains platform specific configuration for Linux based containers. |
|
| 117 |
-type Linux struct {
|
|
| 118 |
- // UIDMapping specifies user mappings for supporting user namespaces on Linux. |
|
| 119 |
- UIDMappings []IDMapping `json:"uidMappings,omitempty"` |
|
| 120 |
- // GIDMapping specifies group mappings for supporting user namespaces on Linux. |
|
| 121 |
- GIDMappings []IDMapping `json:"gidMappings,omitempty"` |
|
| 122 |
- // Sysctl are a set of key value pairs that are set for the container on start |
|
| 123 |
- Sysctl map[string]string `json:"sysctl,omitempty"` |
|
| 124 |
- // Resources contain cgroup information for handling resource constraints |
|
| 125 |
- // for the container |
|
| 126 |
- Resources *Resources `json:"resources,omitempty"` |
|
| 127 |
- // CgroupsPath specifies the path to cgroups that are created and/or joined by the container. |
|
| 128 |
- // The path is expected to be relative to the cgroups mountpoint. |
|
| 129 |
- // If resources are specified, the cgroups at CgroupsPath will be updated based on resources. |
|
| 130 |
- CgroupsPath *string `json:"cgroupsPath,omitempty"` |
|
| 131 |
- // Namespaces contains the namespaces that are created and/or joined by the container |
|
| 132 |
- Namespaces []Namespace `json:"namespaces,omitempty"` |
|
| 133 |
- // Devices are a list of device nodes that are created for the container |
|
| 134 |
- Devices []Device `json:"devices,omitempty"` |
|
| 135 |
- // Seccomp specifies the seccomp security settings for the container. |
|
| 136 |
- Seccomp *Seccomp `json:"seccomp,omitempty"` |
|
| 137 |
- // RootfsPropagation is the rootfs mount propagation mode for the container. |
|
| 138 |
- RootfsPropagation string `json:"rootfsPropagation,omitempty"` |
|
| 139 |
- // MaskedPaths masks over the provided paths inside the container. |
|
| 140 |
- MaskedPaths []string `json:"maskedPaths,omitempty"` |
|
| 141 |
- // ReadonlyPaths sets the provided paths as RO inside the container. |
|
| 142 |
- ReadonlyPaths []string `json:"readonlyPaths,omitempty"` |
|
| 143 |
- // MountLabel specifies the selinux context for the mounts in the container. |
|
| 144 |
- MountLabel string `json:"mountLabel,omitempty"` |
|
| 145 |
-} |
|
| 146 |
- |
|
| 147 |
-// Namespace is the configuration for a Linux namespace |
|
| 148 |
-type Namespace struct {
|
|
| 149 |
- // Type is the type of Linux namespace |
|
| 150 |
- Type NamespaceType `json:"type"` |
|
| 151 |
- // Path is a path to an existing namespace persisted on disk that can be joined |
|
| 152 |
- // and is of the same type |
|
| 153 |
- Path string `json:"path,omitempty"` |
|
| 154 |
-} |
|
| 155 |
- |
|
| 156 |
-// NamespaceType is one of the Linux namespaces |
|
| 157 |
-type NamespaceType string |
|
| 158 |
- |
|
| 159 |
-const ( |
|
| 160 |
- // PIDNamespace for isolating process IDs |
|
| 161 |
- PIDNamespace NamespaceType = "pid" |
|
| 162 |
- // NetworkNamespace for isolating network devices, stacks, ports, etc |
|
| 163 |
- NetworkNamespace = "network" |
|
| 164 |
- // MountNamespace for isolating mount points |
|
| 165 |
- MountNamespace = "mount" |
|
| 166 |
- // IPCNamespace for isolating System V IPC, POSIX message queues |
|
| 167 |
- IPCNamespace = "ipc" |
|
| 168 |
- // UTSNamespace for isolating hostname and NIS domain name |
|
| 169 |
- UTSNamespace = "uts" |
|
| 170 |
- // UserNamespace for isolating user and group IDs |
|
| 171 |
- UserNamespace = "user" |
|
| 172 |
- // CgroupNamespace for isolating cgroup hierarchies |
|
| 173 |
- CgroupNamespace = "cgroup" |
|
| 174 |
-) |
|
| 175 |
- |
|
| 176 |
-// IDMapping specifies UID/GID mappings |
|
| 177 |
-type IDMapping struct {
|
|
| 178 |
- // HostID is the UID/GID of the host user or group |
|
| 179 |
- HostID uint32 `json:"hostID"` |
|
| 180 |
- // ContainerID is the UID/GID of the container's user or group |
|
| 181 |
- ContainerID uint32 `json:"containerID"` |
|
| 182 |
- // Size is the length of the range of IDs mapped between the two namespaces |
|
| 183 |
- Size uint32 `json:"size"` |
|
| 184 |
-} |
|
| 185 |
- |
|
| 186 |
-// Rlimit type and restrictions |
|
| 187 |
-type Rlimit struct {
|
|
| 188 |
- // Type of the rlimit to set |
|
| 189 |
- Type string `json:"type"` |
|
| 190 |
- // Hard is the hard limit for the specified type |
|
| 191 |
- Hard uint64 `json:"hard"` |
|
| 192 |
- // Soft is the soft limit for the specified type |
|
| 193 |
- Soft uint64 `json:"soft"` |
|
| 194 |
-} |
|
| 195 |
- |
|
| 196 |
-// HugepageLimit structure corresponds to limiting kernel hugepages |
|
| 197 |
-type HugepageLimit struct {
|
|
| 198 |
- // Pagesize is the hugepage size |
|
| 199 |
- Pagesize *string `json:"pageSize,omitempty"` |
|
| 200 |
- // Limit is the limit of "hugepagesize" hugetlb usage |
|
| 201 |
- Limit *uint64 `json:"limit,omitempty"` |
|
| 202 |
-} |
|
| 203 |
- |
|
| 204 |
-// InterfacePriority for network interfaces |
|
| 205 |
-type InterfacePriority struct {
|
|
| 206 |
- // Name is the name of the network interface |
|
| 207 |
- Name string `json:"name"` |
|
| 208 |
- // Priority for the interface |
|
| 209 |
- Priority uint32 `json:"priority"` |
|
| 210 |
-} |
|
| 211 |
- |
|
| 212 |
-// blockIODevice holds major:minor format supported in blkio cgroup |
|
| 213 |
-type blockIODevice struct {
|
|
| 214 |
- // Major is the device's major number. |
|
| 215 |
- Major int64 `json:"major"` |
|
| 216 |
- // Minor is the device's minor number. |
|
| 217 |
- Minor int64 `json:"minor"` |
|
| 218 |
-} |
|
| 219 |
- |
|
| 220 |
-// WeightDevice struct holds a `major:minor weight` pair for blkioWeightDevice |
|
| 221 |
-type WeightDevice struct {
|
|
| 222 |
- blockIODevice |
|
| 223 |
- // Weight is the bandwidth rate for the device, range is from 10 to 1000 |
|
| 224 |
- Weight *uint16 `json:"weight,omitempty"` |
|
| 225 |
- // LeafWeight is the bandwidth rate for the device while competing with the cgroup's child cgroups, range is from 10 to 1000, CFQ scheduler only |
|
| 226 |
- LeafWeight *uint16 `json:"leafWeight,omitempty"` |
|
| 227 |
-} |
|
| 228 |
- |
|
| 229 |
-// ThrottleDevice struct holds a `major:minor rate_per_second` pair |
|
| 230 |
-type ThrottleDevice struct {
|
|
| 231 |
- blockIODevice |
|
| 232 |
- // Rate is the IO rate limit per cgroup per device |
|
| 233 |
- Rate *uint64 `json:"rate,omitempty"` |
|
| 234 |
-} |
|
| 235 |
- |
|
| 236 |
-// BlockIO for Linux cgroup 'blkio' resource management |
|
| 237 |
-type BlockIO struct {
|
|
| 238 |
- // Specifies per cgroup weight, range is from 10 to 1000 |
|
| 239 |
- Weight *uint16 `json:"blkioWeight,omitempty"` |
|
| 240 |
- // Specifies tasks' weight in the given cgroup while competing with the cgroup's child cgroups, range is from 10 to 1000, CFQ scheduler only |
|
| 241 |
- LeafWeight *uint16 `json:"blkioLeafWeight,omitempty"` |
|
| 242 |
- // Weight per cgroup per device, can override BlkioWeight |
|
| 243 |
- WeightDevice []WeightDevice `json:"blkioWeightDevice,omitempty"` |
|
| 244 |
- // IO read rate limit per cgroup per device, bytes per second |
|
| 245 |
- ThrottleReadBpsDevice []ThrottleDevice `json:"blkioThrottleReadBpsDevice,omitempty"` |
|
| 246 |
- // IO write rate limit per cgroup per device, bytes per second |
|
| 247 |
- ThrottleWriteBpsDevice []ThrottleDevice `json:"blkioThrottleWriteBpsDevice,omitempty"` |
|
| 248 |
- // IO read rate limit per cgroup per device, IO per second |
|
| 249 |
- ThrottleReadIOPSDevice []ThrottleDevice `json:"blkioThrottleReadIOPSDevice,omitempty"` |
|
| 250 |
- // IO write rate limit per cgroup per device, IO per second |
|
| 251 |
- ThrottleWriteIOPSDevice []ThrottleDevice `json:"blkioThrottleWriteIOPSDevice,omitempty"` |
|
| 252 |
-} |
|
| 253 |
- |
|
| 254 |
-// Memory for Linux cgroup 'memory' resource management |
|
| 255 |
-type Memory struct {
|
|
| 256 |
- // Memory limit (in bytes). |
|
| 257 |
- Limit *uint64 `json:"limit,omitempty"` |
|
| 258 |
- // Memory reservation or soft_limit (in bytes). |
|
| 259 |
- Reservation *uint64 `json:"reservation,omitempty"` |
|
| 260 |
- // Total memory limit (memory + swap). |
|
| 261 |
- Swap *uint64 `json:"swap,omitempty"` |
|
| 262 |
- // Kernel memory limit (in bytes). |
|
| 263 |
- Kernel *uint64 `json:"kernel,omitempty"` |
|
| 264 |
- // Kernel memory limit for tcp (in bytes) |
|
| 265 |
- KernelTCP *uint64 `json:"kernelTCP"` |
|
| 266 |
- // How aggressive the kernel will swap memory pages. Range from 0 to 100. |
|
| 267 |
- Swappiness *uint64 `json:"swappiness,omitempty"` |
|
| 268 |
-} |
|
| 269 |
- |
|
| 270 |
-// CPU for Linux cgroup 'cpu' resource management |
|
| 271 |
-type CPU struct {
|
|
| 272 |
- // CPU shares (relative weight (ratio) vs. other cgroups with cpu shares). |
|
| 273 |
- Shares *uint64 `json:"shares,omitempty"` |
|
| 274 |
- // CPU hardcap limit (in usecs). Allowed cpu time in a given period. |
|
| 275 |
- Quota *uint64 `json:"quota,omitempty"` |
|
| 276 |
- // CPU period to be used for hardcapping (in usecs). |
|
| 277 |
- Period *uint64 `json:"period,omitempty"` |
|
| 278 |
- // How much time realtime scheduling may use (in usecs). |
|
| 279 |
- RealtimeRuntime *uint64 `json:"realtimeRuntime,omitempty"` |
|
| 280 |
- // CPU period to be used for realtime scheduling (in usecs). |
|
| 281 |
- RealtimePeriod *uint64 `json:"realtimePeriod,omitempty"` |
|
| 282 |
- // CPUs to use within the cpuset. Default is to use any CPU available. |
|
| 283 |
- Cpus *string `json:"cpus,omitempty"` |
|
| 284 |
- // List of memory nodes in the cpuset. Default is to use any available memory node. |
|
| 285 |
- Mems *string `json:"mems,omitempty"` |
|
| 286 |
-} |
|
| 287 |
- |
|
| 288 |
-// Pids for Linux cgroup 'pids' resource management (Linux 4.3) |
|
| 289 |
-type Pids struct {
|
|
| 290 |
- // Maximum number of PIDs. Default is "no limit". |
|
| 291 |
- Limit *int64 `json:"limit,omitempty"` |
|
| 292 |
-} |
|
| 293 |
- |
|
| 294 |
-// Network identification and priority configuration |
|
| 295 |
-type Network struct {
|
|
| 296 |
- // Set class identifier for container's network packets |
|
| 297 |
- ClassID *uint32 `json:"classID"` |
|
| 298 |
- // Set priority of network traffic for container |
|
| 299 |
- Priorities []InterfacePriority `json:"priorities,omitempty"` |
|
| 300 |
-} |
|
| 301 |
- |
|
| 302 |
-// Resources has container runtime resource constraints |
|
| 303 |
-type Resources struct {
|
|
| 304 |
- // Devices are a list of device rules for the whitelist controller |
|
| 305 |
- Devices []DeviceCgroup `json:"devices"` |
|
| 306 |
- // DisableOOMKiller disables the OOM killer for out of memory conditions |
|
| 307 |
- DisableOOMKiller *bool `json:"disableOOMKiller,omitempty"` |
|
| 308 |
- // Specify an oom_score_adj for the container. |
|
| 309 |
- OOMScoreAdj *int `json:"oomScoreAdj,omitempty"` |
|
| 310 |
- // Memory restriction configuration |
|
| 311 |
- Memory *Memory `json:"memory,omitempty"` |
|
| 312 |
- // CPU resource restriction configuration |
|
| 313 |
- CPU *CPU `json:"cpu,omitempty"` |
|
| 314 |
- // Task resource restriction configuration. |
|
| 315 |
- Pids *Pids `json:"pids,omitempty"` |
|
| 316 |
- // BlockIO restriction configuration |
|
| 317 |
- BlockIO *BlockIO `json:"blockIO,omitempty"` |
|
| 318 |
- // Hugetlb limit (in bytes) |
|
| 319 |
- HugepageLimits []HugepageLimit `json:"hugepageLimits,omitempty"` |
|
| 320 |
- // Network restriction configuration |
|
| 321 |
- Network *Network `json:"network,omitempty"` |
|
| 322 |
-} |
|
| 323 |
- |
|
| 324 |
-// Device represents the mknod information for a Linux special device file |
|
| 325 |
-type Device struct {
|
|
| 326 |
- // Path to the device. |
|
| 327 |
- Path string `json:"path"` |
|
| 328 |
- // Device type, block, char, etc. |
|
| 329 |
- Type string `json:"type"` |
|
| 330 |
- // Major is the device's major number. |
|
| 331 |
- Major int64 `json:"major"` |
|
| 332 |
- // Minor is the device's minor number. |
|
| 333 |
- Minor int64 `json:"minor"` |
|
| 334 |
- // FileMode permission bits for the device. |
|
| 335 |
- FileMode *os.FileMode `json:"fileMode,omitempty"` |
|
| 336 |
- // UID of the device. |
|
| 337 |
- UID *uint32 `json:"uid,omitempty"` |
|
| 338 |
- // Gid of the device. |
|
| 339 |
- GID *uint32 `json:"gid,omitempty"` |
|
| 340 |
-} |
|
| 341 |
- |
|
| 342 |
-// DeviceCgroup represents a device rule for the whitelist controller |
|
| 343 |
-type DeviceCgroup struct {
|
|
| 344 |
- // Allow or deny |
|
| 345 |
- Allow bool `json:"allow"` |
|
| 346 |
- // Device type, block, char, etc. |
|
| 347 |
- Type *string `json:"type,omitempty"` |
|
| 348 |
- // Major is the device's major number. |
|
| 349 |
- Major *int64 `json:"major,omitempty"` |
|
| 350 |
- // Minor is the device's minor number. |
|
| 351 |
- Minor *int64 `json:"minor,omitempty"` |
|
| 352 |
- // Cgroup access permissions format, rwm. |
|
| 353 |
- Access *string `json:"access,omitempty"` |
|
| 354 |
-} |
|
| 355 |
- |
|
| 356 |
-// Seccomp represents syscall restrictions |
|
| 357 |
-type Seccomp struct {
|
|
| 358 |
- DefaultAction Action `json:"defaultAction"` |
|
| 359 |
- Architectures []Arch `json:"architectures"` |
|
| 360 |
- Syscalls []Syscall `json:"syscalls,omitempty"` |
|
| 361 |
-} |
|
| 362 |
- |
|
| 363 |
-// Solaris contains platform specific configuration for Solaris application containers. |
|
| 364 |
-type Solaris struct {
|
|
| 365 |
- // SMF FMRI which should go "online" before we start the container process. |
|
| 366 |
- Milestone string `json:"milestone,omitempty"` |
|
| 367 |
- // Maximum set of privileges any process in this container can obtain. |
|
| 368 |
- LimitPriv string `json:"limitpriv,omitempty"` |
|
| 369 |
- // The maximum amount of shared memory allowed for this container. |
|
| 370 |
- MaxShmMemory string `json:"maxShmMemory,omitempty"` |
|
| 371 |
- // Specification for automatic creation of network resources for this container. |
|
| 372 |
- Anet []Anet `json:"anet,omitempty"` |
|
| 373 |
- // Set limit on the amount of CPU time that can be used by container. |
|
| 374 |
- CappedCPU CappedCPU `json:"cappedCPU,omitempty"` |
|
| 375 |
- // The physical and swap caps on the memory that can be used by this container. |
|
| 376 |
- CappedMemory CappedMemory `json:"cappedMemory,omitempty"` |
|
| 377 |
-} |
|
| 378 |
- |
|
| 379 |
-// CappedCPU allows users to set limit on the amount of CPU time that can be used by container. |
|
| 380 |
-type CappedCPU struct {
|
|
| 381 |
- Ncpus string `json:"ncpus,omitempty"` |
|
| 382 |
-} |
|
| 383 |
- |
|
| 384 |
-// CappedMemory allows users to set the physical and swap caps on the memory that can be used by this container. |
|
| 385 |
-type CappedMemory struct {
|
|
| 386 |
- Physical string `json:"physical,omitempty"` |
|
| 387 |
- Swap string `json:"swap,omitempty"` |
|
| 388 |
-} |
|
| 389 |
- |
|
| 390 |
-// Anet provides the specification for automatic creation of network resources for this container. |
|
| 391 |
-type Anet struct {
|
|
| 392 |
- // Specify a name for the automatically created VNIC datalink. |
|
| 393 |
- Linkname string `json:"linkname,omitempty"` |
|
| 394 |
- // Specify the link over which the VNIC will be created. |
|
| 395 |
- Lowerlink string `json:"lowerLink,omitempty"` |
|
| 396 |
- // The set of IP addresses that the container can use. |
|
| 397 |
- Allowedaddr string `json:"allowedAddress,omitempty"` |
|
| 398 |
- // Specifies whether allowedAddress limitation is to be applied to the VNIC. |
|
| 399 |
- Configallowedaddr string `json:"configureAllowedAddress,omitempty"` |
|
| 400 |
- // The value of the optional default router. |
|
| 401 |
- Defrouter string `json:"defrouter,omitempty"` |
|
| 402 |
- // Enable one or more types of link protection. |
|
| 403 |
- Linkprotection string `json:"linkProtection,omitempty"` |
|
| 404 |
- // Set the VNIC's macAddress |
|
| 405 |
- Macaddress string `json:"macAddress,omitempty"` |
|
| 406 |
-} |
|
| 407 |
- |
|
| 408 |
-// Arch used for additional architectures |
|
| 409 |
-type Arch string |
|
| 410 |
- |
|
| 411 |
-// Additional architectures permitted to be used for system calls |
|
| 412 |
-// By default only the native architecture of the kernel is permitted |
|
| 413 |
-const ( |
|
| 414 |
- ArchX86 Arch = "SCMP_ARCH_X86" |
|
| 415 |
- ArchX86_64 Arch = "SCMP_ARCH_X86_64" |
|
| 416 |
- ArchX32 Arch = "SCMP_ARCH_X32" |
|
| 417 |
- ArchARM Arch = "SCMP_ARCH_ARM" |
|
| 418 |
- ArchAARCH64 Arch = "SCMP_ARCH_AARCH64" |
|
| 419 |
- ArchMIPS Arch = "SCMP_ARCH_MIPS" |
|
| 420 |
- ArchMIPS64 Arch = "SCMP_ARCH_MIPS64" |
|
| 421 |
- ArchMIPS64N32 Arch = "SCMP_ARCH_MIPS64N32" |
|
| 422 |
- ArchMIPSEL Arch = "SCMP_ARCH_MIPSEL" |
|
| 423 |
- ArchMIPSEL64 Arch = "SCMP_ARCH_MIPSEL64" |
|
| 424 |
- ArchMIPSEL64N32 Arch = "SCMP_ARCH_MIPSEL64N32" |
|
| 425 |
- ArchPPC Arch = "SCMP_ARCH_PPC" |
|
| 426 |
- ArchPPC64 Arch = "SCMP_ARCH_PPC64" |
|
| 427 |
- ArchPPC64LE Arch = "SCMP_ARCH_PPC64LE" |
|
| 428 |
- ArchS390 Arch = "SCMP_ARCH_S390" |
|
| 429 |
- ArchS390X Arch = "SCMP_ARCH_S390X" |
|
| 430 |
-) |
|
| 431 |
- |
|
| 432 |
-// Action taken upon Seccomp rule match |
|
| 433 |
-type Action string |
|
| 434 |
- |
|
| 435 |
-// Define actions for Seccomp rules |
|
| 436 |
-const ( |
|
| 437 |
- ActKill Action = "SCMP_ACT_KILL" |
|
| 438 |
- ActTrap Action = "SCMP_ACT_TRAP" |
|
| 439 |
- ActErrno Action = "SCMP_ACT_ERRNO" |
|
| 440 |
- ActTrace Action = "SCMP_ACT_TRACE" |
|
| 441 |
- ActAllow Action = "SCMP_ACT_ALLOW" |
|
| 442 |
-) |
|
| 443 |
- |
|
| 444 |
-// Operator used to match syscall arguments in Seccomp |
|
| 445 |
-type Operator string |
|
| 446 |
- |
|
| 447 |
-// Define operators for syscall arguments in Seccomp |
|
| 448 |
-const ( |
|
| 449 |
- OpNotEqual Operator = "SCMP_CMP_NE" |
|
| 450 |
- OpLessThan Operator = "SCMP_CMP_LT" |
|
| 451 |
- OpLessEqual Operator = "SCMP_CMP_LE" |
|
| 452 |
- OpEqualTo Operator = "SCMP_CMP_EQ" |
|
| 453 |
- OpGreaterEqual Operator = "SCMP_CMP_GE" |
|
| 454 |
- OpGreaterThan Operator = "SCMP_CMP_GT" |
|
| 455 |
- OpMaskedEqual Operator = "SCMP_CMP_MASKED_EQ" |
|
| 456 |
-) |
|
| 457 |
- |
|
| 458 |
-// Arg used for matching specific syscall arguments in Seccomp |
|
| 459 |
-type Arg struct {
|
|
| 460 |
- Index uint `json:"index"` |
|
| 461 |
- Value uint64 `json:"value"` |
|
| 462 |
- ValueTwo uint64 `json:"valueTwo"` |
|
| 463 |
- Op Operator `json:"op"` |
|
| 464 |
-} |
|
| 465 |
- |
|
| 466 |
-// Syscall is used to match a syscall in Seccomp |
|
| 467 |
-type Syscall struct {
|
|
| 468 |
- Name string `json:"name"` |
|
| 469 |
- Action Action `json:"action"` |
|
| 470 |
- Args []Arg `json:"args,omitempty"` |
|
| 471 |
-} |
| 472 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,17 +0,0 @@ |
| 1 |
-package specs |
|
| 2 |
- |
|
| 3 |
-// State holds information about the runtime state of the container. |
|
| 4 |
-type State struct {
|
|
| 5 |
- // Version is the version of the specification that is supported. |
|
| 6 |
- Version string `json:"version"` |
|
| 7 |
- // ID is the container ID |
|
| 8 |
- ID string `json:"id"` |
|
| 9 |
- // Status is the runtime state of the container. |
|
| 10 |
- Status string `json:"status"` |
|
| 11 |
- // Pid is the process id for the container's main process. |
|
| 12 |
- Pid int `json:"pid"` |
|
| 13 |
- // BundlePath is the path to the container's bundle directory. |
|
| 14 |
- BundlePath string `json:"bundlePath"` |
|
| 15 |
- // Annotations are the annotations associated with the container. |
|
| 16 |
- Annotations map[string]string `json:"annotations"` |
|
| 17 |
-} |
| 18 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,18 +0,0 @@ |
| 1 |
-package specs |
|
| 2 |
- |
|
| 3 |
-import "fmt" |
|
| 4 |
- |
|
| 5 |
-const ( |
|
| 6 |
- // VersionMajor is for an API incompatible changes |
|
| 7 |
- VersionMajor = 1 |
|
| 8 |
- // VersionMinor is for functionality in a backwards-compatible manner |
|
| 9 |
- VersionMinor = 0 |
|
| 10 |
- // VersionPatch is for backwards-compatible bug fixes |
|
| 11 |
- VersionPatch = 0 |
|
| 12 |
- |
|
| 13 |
- // VersionDev indicates development branch. Releases will be empty string. |
|
| 14 |
- VersionDev = "-rc1" |
|
| 15 |
-) |
|
| 16 |
- |
|
| 17 |
-// Version is the specification version that the package types support. |
|
| 18 |
-var Version = fmt.Sprintf("%d.%d.%d%s", VersionMajor, VersionMinor, VersionPatch, VersionDev)
|