runtime-tools: Handle errors in specerror
There are some declared errors in specerror that have not been called to validate them. Now they are listed below, and we can discuss what needs to be done and what does not. If there’s anything you need to add or remove, you can edit directly.
Bundle
- ConfigConstName: This REQUIRED file MUST be named
config.json.
Config-linux
Namespace
- NSProcInPath: The runtime MUST place the container process in the namespace associated with that
path. - NSPathMatchTypeError: The runtime MUST generate an error if
pathis not associated with a namespace of typetype. - NSNewNSWithoutPath: If
pathis not specified, the runtime MUST create a new container namespace of typetype. - NSInheritWithoutType: If a namespace type is not specified in the
namespacesarray, the container MUST inherit the runtime namespace of that type.
User namespace mappings
- ❌ UserNSMapOwnershipRO: The runtime SHOULD NOT modify the ownership of referenced filesystems to realize the mapping.
Devices
- ❌ DevicesMajMinRequired:
major, minor(int64, REQUIRED unlesstypeisp) - major, minor numbers for the device. - DevicesErrorOnDup: The same
type,majorandminorSHOULD NOT be used for multiple devices.
Cgroups
- ❌ CgroupsPathAbsOrRel: The value of
cgroupsPathMUST be either an absolute path or a relative path. - CgroupsAbsPathRelToMount: In the case of an absolute path (starting with
/), the runtime MUST take the path to be relative to the cgroups mount point. - CgroupsPathAttach: If the value is specified, the runtime MUST consistently attach to the same place in the cgroups hierarchy given the same value of
cgroupsPath. - ❌ CgroupsPathError: Runtimes MAY consider certain
cgroupsPathvalues to be invalid, and MUST generate an error if this is the case.
Device whitelist
- DevicesApplyInOrder: The runtime MUST apply entries in the listed order.
Block IO
- BlkIOWeightOrLeafWeightExist: You MUST specify at least one of
weightorleafWeightin a given entry, and MAY specify both.
IntelRdt
- ❌ IntelRdtPIDWrite: If
intelRdtis set, the runtime MUST write the container process ID to the<container-id>/tasksfile in a mountedresctrlpseudo-filesystem, using the container ID fromstartand creating thecontainer-iddirectory if necessary. - ❌ IntelRdtNoMountedResctrlError: If no mounted
resctrlpseudo-filesystem is available in the runtime mount namespace, the runtime MUST generate an error. - ❌ NotManipResctrlWithoutIntelRdt: If
intelRdtis not set, the runtime MUST NOT manipulate anyresctrlpseudo-filesystems. - ❌ IntelRdtL3CacheSchemaWrite: If
l3CacheSchemais set, runtimes MUST write the value to theschematafile in the<container-id>directory discussed inintelRdt. - ❌ IntelRdtL3CacheSchemaNotWrite: If
l3CacheSchemais not set, runtimes MUST NOT write toschematafiles in anyresctrlpseudo-filesystems.
Config-Windows
HyperV
- ❌ WindowsHyperVPresent: If present, the container MUST be run with Hyper-V isolation.
- ❌ WindowsHyperVOmit: If omitted, the container MUST be run as a Windows Server container.
Config
Root
- RootOnWindowsRequired: On Windows, for Windows Server Containers, this field is REQUIRED.
Mounts
- ❌ MountsOptionsOnWindowsROSupport: Windows: runtimes MUST support
ro, mounting the filesystem read-only whenrois given.
Process
- ❌ ProcRequiredAtStart: This property is REQUIRED when
startis called. (same with StartWithProcUnsetGenError) - ❌ ProcConsoleSizeIgnore: Runtimes MUST ignore
consoleSizeifterminalisfalseor unset.
POSIX process
- PosixProcRlimitsTypeGenError: The runtime MUST generate an error for any values which cannot be mapped to a relevant kernel interface.
- ❌ PosixProcRlimitsTypeGet: For each entry in
rlimits, agetrlimit(3)ontypeMUST succeed. - PosixProcRlimitsSoftMatchCur:
rlim.rlim_curMUST match the configured value. - PosixProcRlimitsHardMatchMax:
rlim.rlim_maxMUST match the configured value.
Linux Process
- LinuxProcCapError: Any value which cannot be mapped to a relevant kernel interface MUST cause an error.
- ❌ LinuxProcOomScoreAdjNotSet: If
oomScoreAdjis not set, the runtime MUST NOT change the value ofoom_score_adj.
POSIX-platform Hooks
- PosixHooksCalledInOrder: Hooks MUST be called in the listed order.
- PosixHooksStateToStdin: The state of the container MUST be passed to hooks over stdin so that they may do work appropriate to the current state of the container.
Annotations
- ❌ AnnotationsKeyValueMap: Annotations MUST be a key-value map.
- ❌ AnnotationsKeyRequired: Keys MUST NOT be an empty string.
- AnnotationsKeyReversedDomain: Keys SHOULD be named using a reverse domain notation - e.g.
com.example.myKey. - AnnotationsKeyReservedNS: Keys using the
org.opencontainersnamespace are reserved and MUST NOT be used by subsequent specifications. - AnnotationsKeyIgnoreUnknown: Implementations that are reading/processing this configuration file MUST NOT generate an error if they encounter an unknown annotation key.
- ❌ AnnotationsValueString: Values MUST be strings.
Extensibility
- ExtensibilityIgnoreUnknownProp: Runtimes that are reading or processing this configuration file MUST NOT generate an error if they encounter an unknown property.
Valid values
- ValidValues: Runtimes that are reading or processing this configuration file MUST generate an error when invalid or unsupported values are encountered.
Runtime-Linux
- DefaultRuntimeLinuxSymlinks: While creating the container (step 2 in the lifecycle), runtimes MUST create default symlinks if the source file exists after processing
mounts.
Runtime
- ❌ EntityOperSameContainer: The entity using a runtime to create a container MUST be able to use the operations defined in this specification against that same container.
State
- ❌ StateIDUniq:
id(string, REQUIRED) is the container’s ID. This MUST be unique across all containers on this host. - ❌ StateNewStatus: Additional values MAY be defined by the runtime, however, they MUST be used to represent new runtime states not defined above.
- DefaultStateJSONPattern: When serialized in JSON, the format MUST adhere to the default pattern.
Lifecycle
- ❌ EnvCreateImplement: The container’s runtime environment MUST be created according to the configuration in
config.json. - ❌ EnvCreateError: If the runtime is unable to create the environment specified in the
config.json, it MUST generate an error. - ConfigUpdatesWithoutAffect: Any updates to
config.jsonafter this step MUST NOT affect the container. - PrestartHookFailGenError: If any prestart hook fails, the runtime MUST generate an error, stop the container, and continue the lifecycle at step 9.
- ❌ UndoCreateSteps: The container MUST be destroyed by undoing the steps performed during create phase (step 2).
Errors
- ❌ ErrorsLeaveStateUnchange: Unless otherwise stated, generating an error MUST leave the state of the environment as if the operation were never attempted - modulo any possible trivial ancillary changes such as logging.
Warnings
- ❌ WarnsLeaveFlowUnchange: Unless otherwise stated, logging a warning does not change the flow of the operation; it MUST continue as if the warning had not been logged.
Operations
- ❌ DefaultOperations: Unless otherwise stated, runtimes MUST support the default operations.
Create
- PropsApplyExceptProcOnCreate: All of the properties configured in
config.jsonexcept forprocessMUST be applied. - ProcArgsApplyUntilStart:
process.argsMUST NOT be applied until triggered by thestartoperation. - PropApplyFailGenError: If the runtime cannot apply a property as specified in the configuration, it MUST generate an error.
- PropApplyFailNotCreate: If the runtime cannot apply a property as specified in the configuration, a new container MUST NOT be created.
Start
- StartWithoutIDGenError:
startoperation MUST generate an error if it is not provided the container ID. - StartNonCreateHaveNoEffect: Attempting to
starta container that is notcreatedMUST have no effect on the container. - StartNonCreateGenError: Attempting to
starta container that is notcreatedMUST generate an error. - StartProcImplement:
startoperation MUST run the user-specified program as specified byprocess. - StartWithProcUnsetGenError:
startoperation MUST generate an error ifprocesswas not set.
Kill
- KillWithoutIDGenError:
killoperation MUST generate an error if it is not provided the container ID. - KillNonCreateRunGenError: Attempting to send a signal to a container that is neither
creatednorrunningMUST generate an error. - KillSignalImplement:
killoperation MUST send the specified signal to the container process. - KillNonCreateRunHaveNoEffect: Attempting to send a signal to a container that is neither
creatednorrunningMUST have no effect.
Delete
- DeleteWithoutIDGenError:
deleteoperation MUST generate an error if it is not provided the container ID. - DeleteNonStopHaveNoEffect: Attempting to
deletea container that is notstoppedMUST have no effect on the container. - DeleteNonStopGenError: Attempting to
deletea container that is notstoppedMUST generate an error. - DeleteResImplement: Deleting a container MUST delete the resources that were created during the
createstep. - DeleteOnlyCreatedRes: Note that resources associated with the container, but not created by this container, MUST NOT be deleted.
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 1
- Comments: 46 (22 by maintainers)
Commits related to this issue
- validation: add a new test for NSNewNSWithoutPath WIP This test is to check for NSNewNSWithoutPath, i.e. "If path is not specified, the runtime MUST create a new container namepace of the given type... — committed to kinvolk-archives/runtime-tools by dongsupark 6 years ago
- validation: add a new test for NSNewNSWithoutPath This test is to check for NSNewNSWithoutPath, i.e. "If path is not specified, the runtime MUST create a new container namepace of the given type" Se... — committed to kinvolk-archives/runtime-tools by dongsupark 6 years ago
- validation: add a new test for NSNewNSWithoutPath This test is to check for NSNewNSWithoutPath, i.e. "If path is not specified, the runtime MUST create a new container namepace of the given type" Se... — committed to kinvolk-archives/runtime-tools by dongsupark 6 years ago
- validation: add a new test for NSNewNSWithoutPath This test is to check for NSNewNSWithoutPath, i.e. "If path is not specified, the runtime MUST create a new container namespace of the given type" S... — committed to kinvolk-archives/runtime-tools by dongsupark 6 years ago
- validation: add a new test for NSNewNSWithoutPath This test is to check for NSNewNSWithoutPath, i.e. "If path is not specified, the runtime MUST create a new container namespace of the given type" S... — committed to kinvolk-archives/runtime-tools by dongsupark 6 years ago
- validation: add a new test for NSInheritWithoutType This test is to check for NSInheritWithoutType, i.e. "If a namespace type is not specified in the namespaces array, the container MUST inherit the ... — committed to kinvolk-archives/runtime-tools by dongsupark 6 years ago
- validation: add a new test for NSNewNSWithoutPath This test is to check for NSNewNSWithoutPath, i.e. "If path is not specified, the runtime MUST create a new container namespace of the given type" S... — committed to kinvolk-archives/runtime-tools by dongsupark 6 years ago
- validation: add a new test for NSInheritWithoutType This test is to check for NSInheritWithoutType, i.e. "If a namespace type is not specified in the namespaces array, the container MUST inherit the ... — committed to kinvolk-archives/runtime-tools by dongsupark 6 years ago
- validation: add a new test for NSNewNSWithoutPath This test is to check for NSNewNSWithoutPath, i.e. "If path is not specified, the runtime MUST create a new container namespace of the given type" S... — committed to kinvolk-archives/runtime-tools by dongsupark 6 years ago
- validation: add a new test for NSNewNSWithoutPath This test is to check for NSNewNSWithoutPath, i.e. "If path is not specified, the runtime MUST create a new container namespace of the given type" S... — committed to kinvolk-archives/runtime-tools by dongsupark 6 years ago
- validation: add a new test for NSNewNSWithoutPath This test is to check for NSNewNSWithoutPath, i.e. "If path is not specified, the runtime MUST create a new container namespace of the given type" S... — committed to kinvolk-archives/runtime-tools by dongsupark 6 years ago
- validation: add a new test for NSNewNSWithoutPath This test is to check for NSNewNSWithoutPath, i.e. "If path is not specified, the runtime MUST create a new container namespace of the given type" S... — committed to kinvolk-archives/runtime-tools by dongsupark 6 years ago
- validation: add a new test for NSInheritWithoutType This test is to check for NSInheritWithoutType, i.e. "If a namespace type is not specified in the namespaces array, the container MUST inherit the ... — committed to kinvolk-archives/runtime-tools by dongsupark 6 years ago
- validation: add a new test for NSInheritWithoutType This test is to check for NSInheritWithoutType, i.e. "If a namespace type is not specified in the namespaces array, the container MUST inherit the ... — committed to kinvolk-archives/runtime-tools by dongsupark 6 years ago
- validation: add a new test for NSInheritWithoutType This test is to check for NSInheritWithoutType, i.e. "If a namespace type is not specified in the namespaces array, the container MUST inherit the ... — committed to kinvolk-archives/runtime-tools by dongsupark 6 years ago
- validation: add a new test for NSNewNSWithoutPath This test is to check for NSNewNSWithoutPath, i.e. "If path is not specified, the runtime MUST create a new container namespace of the given type" S... — committed to kinvolk-archives/runtime-tools by dongsupark 6 years ago
- validation: add a new test for NSInheritWithoutType This test is to check for NSInheritWithoutType, i.e. "If a namespace type is not specified in the namespaces array, the container MUST inherit the ... — committed to kinvolk-archives/runtime-tools by dongsupark 6 years ago
- validation: add a new test for NSPathMatchTypeError `checkNSPathMatchType` checks if the container returns an error when deliberately setting a wrong namespace type. Doing that, it is possible to ver... — committed to kinvolk-archives/runtime-tools by dongsupark 6 years ago
- validation: add a new test for NSPathMatchTypeError `checkNSPathMatchType` checks if the container returns an error when deliberately setting a wrong namespace type. Doing that, it is possible to ver... — committed to kinvolk-archives/runtime-tools by dongsupark 6 years ago
Ideas how to implement the tests?
readlink()+stat()on/proc/$pid/ns/{net,ipc...}and check that it is the same inode +same major/minor from the nsfs dev.We could either
util.RuntimeOutsideValidate()util.RuntimeInsideValidate.UserNSMapOwnershipRO is marked as unverifiable ❌ but we could check by running a
stat()from outside on a file in the rootfs, to check the UID & GID that the runtime didn’t do any chown.I can give this a try. Edit: WIP branch
@q384566678 and I remove the ‘[ ]’ to list valid tasks only.
I think this is done
We have ‘specConfig’ in validate.go. So these two ‘MUST’ are actually the same thing.