Skip to content

Commit 82ab996

Browse files
authored
Merge pull request #1095 from najohnsn/zos
Introduce zos as platform
2 parents 8961758 + c83b45e commit 82ab996

File tree

8 files changed

+136
-6
lines changed

8 files changed

+136
-6
lines changed

config-zos.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
_This document is a work in progress._
2+
3+
# <a name="ZOSContainerConfiguration" />z/OS Container Configuration
4+
5+
This document describes the schema for the [z/OS-specific section](config.md#platform-specific-configuration) of the [container configuration](config.md).
6+
7+
## <a name="configZOSDevices" />Devices
8+
9+
**`devices`** (array of objects, OPTIONAL) lists devices that MUST be available in the container.
10+
The runtime MAY supply them however it likes.
11+
12+
Each entry has the following structure:
13+
14+
* **`type`** *(string, REQUIRED)* - type of device: `c`, `b`, `u` or `p`.
15+
* **`path`** *(string, REQUIRED)* - full path to device inside container.
16+
If a file already exists at `path` that does not match the requested device, the runtime MUST generate an error.
17+
* **`major, minor`** *(int64, REQUIRED unless `type` is `p`)* - major, minor numbers for the device.
18+
* **`fileMode`** *(uint32, OPTIONAL)* - file mode for the device.
19+
20+
The same `type`, `major` and `minor` SHOULD NOT be used for multiple devices.

config.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,8 @@ For Windows based systems the user structure has the following fields:
360360
This MAY be set if the target platform of this spec is `solaris`.
361361
* **`vm`** (object, OPTIONAL) [Virtual-machine-specific configuration](config-vm.md).
362362
This MAY be set if the target platform and architecture of this spec support hardware virtualization.
363+
* **`zos`** (object, OPTIONAL) [z/OS-specific configuration](config-zos.md).
364+
This MAY be set if the target platform of this spec is `zos`.
363365

364366
### Example (Linux)
365367

schema/config-schema.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@
180180
},
181181
"vm": {
182182
"$ref": "config-vm.json#/vm"
183+
},
184+
"zos": {
185+
"$ref": "config-zos.json#/zos"
183186
}
184187
},
185188
"required": [

schema/config-zos.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"zos": {
3+
"description": "z/OS platform-specific configurations",
4+
"type": "object",
5+
"properties": {
6+
"devices": {
7+
"type": "array",
8+
"items": {
9+
"$ref": "defs-zos.json#/definitions/Device"
10+
}
11+
}
12+
}
13+
}
14+
}

schema/defs-zos.json

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"definitions": {
3+
"Major": {
4+
"description": "major device number",
5+
"$ref": "defs.json#/definitions/int64"
6+
},
7+
"Minor": {
8+
"description": "minor device number",
9+
"$ref": "defs.json#/definitions/int64"
10+
},
11+
"FileMode": {
12+
"description": "File permissions mode (typically an octal value)",
13+
"type": "integer",
14+
"minimum": 0,
15+
"maximum": 512
16+
},
17+
"FileType": {
18+
"description": "Type of a block or special character device",
19+
"type": "string",
20+
"pattern": "^[cbup]$"
21+
},
22+
"Device": {
23+
"type": "object",
24+
"required": [
25+
"type",
26+
"path",
27+
"major",
28+
"minor"
29+
],
30+
"properties": {
31+
"path": {
32+
"$ref": "defs.json#/definitions/FilePath"
33+
},
34+
"type": {
35+
"$ref": "defs-zos.json#/definitions/FileType"
36+
},
37+
"major": {
38+
"$ref": "defs-zos.json#/definitions/Major"
39+
},
40+
"minor": {
41+
"$ref": "defs-zos.json#/definitions/Minor"
42+
},
43+
"fileMode": {
44+
"$ref": "defs-zos.json#/definitions/FileMode"
45+
},
46+
"uid": {
47+
"$ref": "defs.json#/definitions/UID"
48+
},
49+
"gid": {
50+
"$ref": "defs.json#/definitions/GID"
51+
}
52+
}
53+
}
54+
}
55+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"ociVersion": "1.0.0",
3+
"root": {
4+
"path": "rootfs"
5+
},
6+
"zos": {
7+
}
8+
}

spec.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Platforms defined by this specification are:
1717
* `solaris`: [runtime.md](runtime.md), [config.md](config.md), and [config-solaris.md](config-solaris.md).
1818
* `windows`: [runtime.md](runtime.md), [config.md](config.md), and [config-windows.md](config-windows.md).
1919
* `vm`: [runtime.md](runtime.md), [config.md](config.md), and [config-vm.md](config-vm.md).
20+
* `zos`: [runtime.md](runtime.md), [config.md](config.md), and [config-zos.md](config-zos.md).
2021

2122
# <a name="ociRuntimeSpecTOC" />Table of Contents
2223

@@ -31,6 +32,7 @@ Platforms defined by this specification are:
3132
- [Solaris-specific Configuration](config-solaris.md)
3233
- [Windows-specific Configuration](config-windows.md)
3334
- [Virtual-Machine-specific Configuration](config-vm.md)
35+
- [z/OS-specific Configuration](config-zos.md)
3436
- [Glossary](glossary.md)
3537

3638
# <a name="ociRuntimeSpecNotationalConventions" />Notational Conventions

specs-go/config.go

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type Spec struct {
1515
// Mounts configures additional mounts (on top of Root).
1616
Mounts []Mount `json:"mounts,omitempty"`
1717
// Hooks configures callbacks for container lifecycle events.
18-
Hooks *Hooks `json:"hooks,omitempty" platform:"linux,solaris"`
18+
Hooks *Hooks `json:"hooks,omitempty" platform:"linux,solaris,zos"`
1919
// Annotations contains arbitrary metadata for the container.
2020
Annotations map[string]string `json:"annotations,omitempty"`
2121

@@ -27,6 +27,8 @@ type Spec struct {
2727
Windows *Windows `json:"windows,omitempty" platform:"windows"`
2828
// VM specifies configuration for virtual-machine-based containers.
2929
VM *VM `json:"vm,omitempty" platform:"vm"`
30+
// ZOS is platform-specific configuration for z/OS based containers.
31+
ZOS *ZOS `json:"zos,omitempty" platform:"zos"`
3032
}
3133

3234
// Process contains information to start a specific application inside the container.
@@ -49,7 +51,7 @@ type Process struct {
4951
// Capabilities are Linux capabilities that are kept for the process.
5052
Capabilities *LinuxCapabilities `json:"capabilities,omitempty" platform:"linux"`
5153
// Rlimits specifies rlimit options to apply to the process.
52-
Rlimits []POSIXRlimit `json:"rlimits,omitempty" platform:"linux,solaris"`
54+
Rlimits []POSIXRlimit `json:"rlimits,omitempty" platform:"linux,solaris,zos"`
5355
// NoNewPrivileges controls whether additional privileges could be gained by processes in the container.
5456
NoNewPrivileges bool `json:"noNewPrivileges,omitempty" platform:"linux"`
5557
// ApparmorProfile specifies the apparmor profile for the container.
@@ -86,11 +88,11 @@ type Box struct {
8688
// User specifies specific user (and group) information for the container process.
8789
type User struct {
8890
// UID is the user id.
89-
UID uint32 `json:"uid" platform:"linux,solaris"`
91+
UID uint32 `json:"uid" platform:"linux,solaris,zos"`
9092
// GID is the group id.
91-
GID uint32 `json:"gid" platform:"linux,solaris"`
93+
GID uint32 `json:"gid" platform:"linux,solaris,zos"`
9294
// Umask is the umask for the init process.
93-
Umask *uint32 `json:"umask,omitempty" platform:"linux,solaris"`
95+
Umask *uint32 `json:"umask,omitempty" platform:"linux,solaris,zos"`
9496
// AdditionalGids are additional group ids set for the container's process.
9597
AdditionalGids []uint32 `json:"additionalGids,omitempty" platform:"linux,solaris"`
9698
// Username is the user name.
@@ -110,7 +112,7 @@ type Mount struct {
110112
// Destination is the absolute path where the mount will be placed in the container.
111113
Destination string `json:"destination"`
112114
// Type specifies the mount kind.
113-
Type string `json:"type,omitempty" platform:"linux,solaris"`
115+
Type string `json:"type,omitempty" platform:"linux,solaris,zos"`
114116
// Source specifies the source path of the mount.
115117
Source string `json:"source,omitempty"`
116118
// Options are fstab style mount options.
@@ -698,3 +700,27 @@ type LinuxIntelRdt struct {
698700
// default, and in "MBps" if MBA Software Controller is enabled.
699701
MemBwSchema string `json:"memBwSchema,omitempty"`
700702
}
703+
704+
// ZOS contains platform-specific configuration for z/OS based containers.
705+
type ZOS struct {
706+
// Devices are a list of device nodes that are created for the container
707+
Devices []ZOSDevice `json:"devices,omitempty"`
708+
}
709+
710+
// ZOSDevice represents the mknod information for a z/OS special device file
711+
type ZOSDevice struct {
712+
// Path to the device.
713+
Path string `json:"path"`
714+
// Device type, block, char, etc.
715+
Type string `json:"type"`
716+
// Major is the device's major number.
717+
Major int64 `json:"major"`
718+
// Minor is the device's minor number.
719+
Minor int64 `json:"minor"`
720+
// FileMode permission bits for the device.
721+
FileMode *os.FileMode `json:"fileMode,omitempty"`
722+
// UID of the device.
723+
UID *uint32 `json:"uid,omitempty"`
724+
// Gid of the device.
725+
GID *uint32 `json:"gid,omitempty"`
726+
}

0 commit comments

Comments
 (0)