Skip to content

Commit

Permalink
Simply platform field
Browse files Browse the repository at this point in the history
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 <h.huangqiang@huawei.com>
  • Loading branch information
hqhq committed May 24, 2017
1 parent 837ee76 commit 3cc7816
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 63 deletions.
35 changes: 9 additions & 26 deletions config.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,46 +304,32 @@ For Windows based systems the user structure has the following fields:

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

**`platform`** (object, REQUIRED) specifies the configuration's target platform.

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

### Example

```json
"platform": {
"os": "linux",
"arch": "amd64"
}
"platform": "linux"
```

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

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

* **`linux`** (object, OPTIONAL) [Linux-specific configuration](config-linux.md).
This MAY be set if **`platform.os`** is `linux` and MUST NOT be set otherwise.
This MAY be set if **`platform`** is `linux` and MUST NOT be set otherwise.
* **`windows`** (object, OPTIONAL) [Windows-specific configuration](config-windows.md).
This MAY be set if **`platform.os`** is `windows` and MUST NOT be set otherwise.
This MAY be set if **`platform`** is `windows` and MUST NOT be set otherwise.
* **`solaris`** (object, OPTIONAL) [Solaris-specific configuration](config-solaris.md).
This MAY be set if **`platform.os`** is `solaris` and MUST NOT be set otherwise.
This MAY be set if **`platform`** is `solaris` and MUST NOT be set otherwise.

### Example (Linux)

```json
{
"platform": {
"os": "linux",
"arch": "amd64"
},
"platform": "linux",
"linux": {
"namespaces": [
{
Expand Down Expand Up @@ -459,10 +445,7 @@ Here is a full example `config.json` for reference.
```json
{
"ociVersion": "0.5.0-dev",
"platform": {
"os": "linux",
"arch": "amd64"
},
"platform": "linux",
"process": {
"terminal": true,
"user": {
Expand Down
16 changes: 1 addition & 15 deletions schema/config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,7 @@
},
"platform": {
"id": "https://opencontainers.org/schema/bundle/platform",
"type": "object",
"required": [
"arch",
"os"
],
"properties": {
"arch": {
"id": "https://opencontainers.org/schema/bundle/platform/arch",
"type": "string"
},
"os": {
"id": "https://opencontainers.org/schema/bundle/platform/os",
"type": "string"
}
}
"type": "string"
},
"root": {
"description": "Configures the container's root filesystem.",
Expand Down
5 changes: 1 addition & 4 deletions schema/test/config/good/minimal-for-start.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"ociVersion": "1.0.0",
"platform": {
"os": "linux",
"arch": "amd64"
},
"platform": "linux",
"root": {
"path": "rootfs"
},
Expand Down
5 changes: 1 addition & 4 deletions schema/test/config/good/minimal.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"ociVersion": "1.0.0",
"platform": {
"os": "linux",
"arch": "amd64"
},
"platform": "linux",
"root": {
"path": "rootfs"
}
Expand Down
5 changes: 1 addition & 4 deletions schema/test/config/good/spec-example.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"ociVersion": "0.5.0-dev",
"platform": {
"os": "linux",
"arch": "amd64"
},
"platform": "linux",
"process": {
"terminal": true,
"user": {
Expand Down
11 changes: 1 addition & 10 deletions specs-go/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type Spec struct {
// Version of the Open Container Runtime Specification with which the bundle complies.
Version string `json:"ociVersion"`
// Platform specifies the configuration's target platform.
Platform Platform `json:"platform"`
Platform string `json:"platform"`
// Process configures the container process.
Process *Process `json:"process,omitempty"`
// Root configures the container's root filesystem.
Expand Down Expand Up @@ -101,15 +101,6 @@ type Root struct {
Readonly bool `json:"readonly,omitempty"`
}

// Platform specifies OS and arch information for the host system that the container
// is created for.
type Platform struct {
// OS is the operating system.
OS string `json:"os"`
// Arch is the architecture
Arch string `json:"arch"`
}

// Mount specifies a mount for a container.
type Mount struct {
// 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.
Expand Down

0 comments on commit 3cc7816

Please sign in to comment.