Browse code

Merge pull request #26505 from Microsoft/jjh/ocistep1

Windows OCI convergence step 1

Kenfe-Mickaƫl Laventure authored on 2016/09/20 02:23:11
Showing 3 changed files
... ...
@@ -6,7 +6,7 @@ import (
6 6
 )
7 7
 
8 8
 // Spec is the base configuration for the container.
9
-type Spec windowsoci.WindowsSpec
9
+type Spec windowsoci.Spec
10 10
 
11 11
 // Process contains information to start a specific application inside the container.
12 12
 type Process windowsoci.Process
... ...
@@ -6,31 +6,31 @@ package windowsoci
6 6
 
7 7
 import "fmt"
8 8
 
9
-// WindowsSpec is the full specification for Windows containers.
10
-type WindowsSpec struct {
11
-	Spec
12
-
13
-	// Windows is platform specific configuration for Windows based containers.
14
-	Windows Windows `json:"windows"`
15
-}
16
-
17
-// Spec is the base configuration for the container.  It specifies platform
18
-// independent configuration. This information must be included when the
19
-// bundle is packaged for distribution.
9
+// Spec is the base configuration for the container.
20 10
 type Spec struct {
21
-
22
-	// Version is the version of the specification that is supported.
11
+	// Version of the Open Container Runtime Specification with which the bundle complies.
23 12
 	Version string `json:"ociVersion"`
24
-	// Platform is the host information for OS and Arch.
13
+	// Platform specifies the configuration's target platform.
25 14
 	Platform Platform `json:"platform"`
26
-	// Process is the container's main process.
15
+	// Process configures the container process.
27 16
 	Process Process `json:"process"`
28
-	// Root is the root information for the container's filesystem.
17
+	// Root configures the container's root filesystem.
29 18
 	Root Root `json:"root"`
30
-	// Hostname is the container's host name.
19
+	// Hostname configures the container's hostname.
31 20
 	Hostname string `json:"hostname,omitempty"`
32
-	// Mounts profiles configuration for adding mounts to the container's filesystem.
33
-	Mounts []Mount `json:"mounts"`
21
+	// Mounts configures additional mounts (on top of Root).
22
+	Mounts []Mount `json:"mounts,omitempty"`
23
+	// Hooks configures callbacks for container lifecycle events.
24
+	Hooks Hooks `json:"hooks"`
25
+	// Annotations contains arbitrary metadata for the container.
26
+	Annotations map[string]string `json:"annotations,omitempty"`
27
+
28
+	// Linux is platform specific configuration for Linux based containers.
29
+	Linux *Linux `json:"linux,omitempty" platform:"linux"`
30
+	// Solaris is platform specific configuration for Solaris containers.
31
+	Solaris *Solaris `json:"solaris,omitempty" platform:"solaris"`
32
+	// Windows is platform specific configuration for Windows based containers, including Hyper-V containers.
33
+	Windows *Windows `json:"windows,omitempty" platform:"windows"`
34 34
 }
35 35
 
36 36
 // Windows contains platform specific configuration for Windows based containers.
... ...
@@ -182,3 +182,19 @@ const (
182 182
 
183 183
 // Version is the specification version that the package types support.
184 184
 var Version = fmt.Sprintf("%d.%d.%d%s (Windows)", VersionMajor, VersionMinor, VersionPatch, VersionDev)
185
+
186
+//
187
+// Temporary structures. Ultimately this whole file will be removed.
188
+//
189
+
190
+// Linux contains platform specific configuration for Linux based containers.
191
+type Linux struct {
192
+}
193
+
194
+// Solaris contains platform specific configuration for Solaris application containers.
195
+type Solaris struct {
196
+}
197
+
198
+// Hooks for container setup and teardown
199
+type Hooks struct {
200
+}
... ...
@@ -7,17 +7,13 @@ import (
7 7
 )
8 8
 
9 9
 // DefaultSpec returns default spec used by docker.
10
-func DefaultSpec() windowsoci.WindowsSpec {
11
-	s := windowsoci.Spec{
10
+func DefaultSpec() windowsoci.Spec {
11
+	return windowsoci.Spec{
12 12
 		Version: windowsoci.Version,
13 13
 		Platform: windowsoci.Platform{
14 14
 			OS:   runtime.GOOS,
15 15
 			Arch: runtime.GOARCH,
16 16
 		},
17
-	}
18
-
19
-	return windowsoci.WindowsSpec{
20
-		Spec:    s,
21
-		Windows: windowsoci.Windows{},
17
+		Windows: &windowsoci.Windows{},
22 18
 	}
23 19
 }