Image compatibility metadata enables container image authors to define their
image requirements using [Node Feature Rules](./custom-resources.md#nodefeaturerule).
This complementary solution allows features discovered on nodes to be matched
directly from images. As a result, container requirements become discoverable
and programmable, supporting various consumers and use cases where applications
need a specific compatible environment.
### Compatibility Specification
The compatibility specification is a list of compatibility objects that contain
[Node Feature Rules](./custom-resources.md#nodefeaturerule), along with
additional fields to control the execution of validation between the image and
the host.
### Schema
- **version** - *string*
This REQUIRED property specifies the version of the API in use.
- **compatibilities** - *array of object*
This REQUIRED property is a list of compatibility sets.
- **rules** - *object*
This REQUIRED property is a reference to the spec of the [NodeFeatureRule API](./custom-resources.md#nodefeaturerule).
The spec allows image requirements to be described using the features
discovered from NFD sources. For more details, please refer to [the documentation](./custom-resources.md#nodefeaturerule).
- **weight** - *int*
This OPTIONAL property specifies the [node affinity weight](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity-weight).
- **tag** - *string*
This OPTIONAL property allows for the grouping or separation of
compatibility sets.
- **description** - *string*
This OPTIONAL property provides a brief description of a compatibility set.
#### Example
```yaml
version: v1alpha1
compatibilities:
- description: "My image requirements"
rules:
- name: "kernel and cpu"
matchFeatures:
- feature: kernel.loadedmodule
matchExpressions:
vfio-pci: {op: Exists}
- feature: cpu.model
matchExpressions:
vendor_id: {op: In, value: ["Intel", "AMD"]}
- name: "one of available nics"
matchAny:
- matchFeatures:
- feature: pci.device
matchExpressions:
vendor: {op: In, value: ["0eee"]}
class: {op: In, value: ["0200"]}
- matchFeatures:
- feature: pci.device
matchExpressions:
vendor: {op: In, value: ["0fff"]}
class: {op: In, value: ["0200"]}
```
### OCI Artifact
An [OCI artifact](https://github.com/opencontainers/image-spec/blob/main/manifest.md#guidelines-for-artifact-usage)
is used to store image compatibility metadata.
The artifact can be associated with a specific image through [the subject field](https://github.com/opencontainers/distribution-spec/blob/11b8e3fba7d2d7329513d0cff53058243c334858/spec.md#pushing-manifests-with-subject)