Skip to content

Commit 8f2be13

Browse files
committed
Simply platform field
Close: opencontainers#725 See discussion in opencontainers#830 , the full platform can be maintained in image-spec, but since we have platform-specific configurations in runtime-spec, I think it makes sence we keep a general simple definition for platform. Signed-off-by: Qiang Huang <[email protected]>
1 parent 837ee76 commit 8f2be13

File tree

6 files changed

+14
-63
lines changed

6 files changed

+14
-63
lines changed

config.md

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -304,46 +304,32 @@ For Windows based systems the user structure has the following fields:
304304

305305
## <a name="configPlatform" />Platform
306306

307-
**`platform`** (object, REQUIRED) specifies the configuration's target platform.
308-
309-
* **`os`** (string, REQUIRED) specifies the operating system family of the container configuration's specified [`root`](#root) file system bundle.
310-
The runtime MUST generate an error if it does not support the specified **`os`**.
311-
Bundles SHOULD use, and runtimes SHOULD understand, **`os`** entries listed in the Go Language document for [`GOOS`][go-environment].
312-
If an operating system is not included in the `GOOS` documentation, it SHOULD be submitted to this specification for standardization.
313-
* **`arch`** (string, REQUIRED) specifies the instruction set for which the binaries in the specified [`root`](#root) file system bundle have been compiled.
314-
The runtime MUST generate an error if it does not support the specified **`arch`**.
315-
Values for **`arch`** SHOULD use, and runtimes SHOULD understand, **`arch`** entries listed in the Go Language document for [`GOARCH`][go-environment].
316-
If an architecture is not included in the `GOARCH` documentation, it SHOULD be submitted to this specification for standardization.
307+
**`platform`** (string, REQUIRED) specifies the configuration's target platform.
308+
The value MUST be a slug from [the platform list](spec.md#platforms).
317309

318310
### Example
319311

320312
```json
321-
"platform": {
322-
"os": "linux",
323-
"arch": "amd64"
324-
}
313+
"platform": "linux"
325314
```
326315

327316
## <a name="configPlatformSpecificConfiguration" />Platform-specific configuration
328317

329-
[**`platform.os`**](#platform) is used to specify platform-specific configuration.
318+
[**`platform`**](#platform) is used to specify platform-specific configuration.
330319
Runtime implementations MAY support any valid values for platform-specific fields as part of this configuration.
331320

332321
* **`linux`** (object, OPTIONAL) [Linux-specific configuration](config-linux.md).
333-
This MAY be set if **`platform.os`** is `linux` and MUST NOT be set otherwise.
322+
This MAY be set if **`platform`** is `linux` and MUST NOT be set otherwise.
334323
* **`windows`** (object, OPTIONAL) [Windows-specific configuration](config-windows.md).
335-
This MAY be set if **`platform.os`** is `windows` and MUST NOT be set otherwise.
324+
This MAY be set if **`platform`** is `windows` and MUST NOT be set otherwise.
336325
* **`solaris`** (object, OPTIONAL) [Solaris-specific configuration](config-solaris.md).
337-
This MAY be set if **`platform.os`** is `solaris` and MUST NOT be set otherwise.
326+
This MAY be set if **`platform`** is `solaris` and MUST NOT be set otherwise.
338327

339328
### Example (Linux)
340329

341330
```json
342331
{
343-
"platform": {
344-
"os": "linux",
345-
"arch": "amd64"
346-
},
332+
"platform": "linux",
347333
"linux": {
348334
"namespaces": [
349335
{
@@ -459,10 +445,7 @@ Here is a full example `config.json` for reference.
459445
```json
460446
{
461447
"ociVersion": "0.5.0-dev",
462-
"platform": {
463-
"os": "linux",
464-
"arch": "amd64"
465-
},
448+
"platform": "linux",
466449
"process": {
467450
"terminal": true,
468451
"user": {

schema/config-schema.json

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,7 @@
3939
},
4040
"platform": {
4141
"id": "https://opencontainers.org/schema/bundle/platform",
42-
"type": "object",
43-
"required": [
44-
"arch",
45-
"os"
46-
],
47-
"properties": {
48-
"arch": {
49-
"id": "https://opencontainers.org/schema/bundle/platform/arch",
50-
"type": "string"
51-
},
52-
"os": {
53-
"id": "https://opencontainers.org/schema/bundle/platform/os",
54-
"type": "string"
55-
}
56-
}
42+
"type": "string",
5743
},
5844
"root": {
5945
"description": "Configures the container's root filesystem.",

schema/test/config/good/minimal-for-start.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
22
"ociVersion": "1.0.0",
3-
"platform": {
4-
"os": "linux",
5-
"arch": "amd64"
6-
},
3+
"platform": "linux",
74
"root": {
85
"path": "rootfs"
96
},

schema/test/config/good/minimal.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
22
"ociVersion": "1.0.0",
3-
"platform": {
4-
"os": "linux",
5-
"arch": "amd64"
6-
},
3+
"platform": "linux",
74
"root": {
85
"path": "rootfs"
96
}

schema/test/config/good/spec-example.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
22
"ociVersion": "0.5.0-dev",
3-
"platform": {
4-
"os": "linux",
5-
"arch": "amd64"
6-
},
3+
"platform": "linux",
74
"process": {
85
"terminal": true,
96
"user": {

specs-go/config.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ type Spec struct {
77
// Version of the Open Container Runtime Specification with which the bundle complies.
88
Version string `json:"ociVersion"`
99
// Platform specifies the configuration's target platform.
10-
Platform Platform `json:"platform"`
10+
Platform string `json:"platform"`
1111
// Process configures the container process.
1212
Process *Process `json:"process,omitempty"`
1313
// Root configures the container's root filesystem.
@@ -101,15 +101,6 @@ type Root struct {
101101
Readonly bool `json:"readonly,omitempty"`
102102
}
103103

104-
// Platform specifies OS and arch information for the host system that the container
105-
// is created for.
106-
type Platform struct {
107-
// OS is the operating system.
108-
OS string `json:"os"`
109-
// Arch is the architecture
110-
Arch string `json:"arch"`
111-
}
112-
113104
// Mount specifies a mount for a container.
114105
type Mount struct {
115106
// 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.

0 commit comments

Comments
 (0)