Skip to content

Support reading and comparing OSVersion on Linux platform. #19

@make1980

Description

@make1980

The OCI image spec contains the OSVersion field as part of the platform spec. However, this field isn't used on Linux platform. We have a scenario where container version will need to be dependent on the OS version because container images and OS images are built and qualified from the same release branch, which requires this feature.

The current implementation of containerd doesn't support this functionality because the platform module doesn't have functionality to read or compare OSVersion on Linux.

One solution is to add this support in the platform module so that OSVersion can be read from a configuration file such as /etc/os-release on Linux, using the VERSION_ID as the key to look up the version.

To support various Linux distributions we can allow the OS version config file path and config key to be customized through environment variables.

For example, the following environment variables can be defined:

export USE_OCI_OS_VERSION=true
export OCI_OS_VERSION_CONFIG_FILE=/etc/foo.yml
export OCI_OS_VERSION_CONFIG_KEY=bar

and in /etc/foo.yml file the following content can allow the OS version to be read as 1.0:

bar=1.0

An alternative to this solution is to update the CRI interface so that platform can be passed in(today there is only annotations field that can be potentially used but none of the platform fields is using it).

The alternative requires changes to containerd and all the CRI client implementation(kubelet/dockerd etc) so will be much more work. Also it's inconsistent with how containerd gets the OS and architecture values - containerd gets those values based on the golang runtime(so by itself).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions