Currently, Ratify is not aware of the host OS/Architecture that a container should be used with. As a result, any subject reference that is an OCI Index is validated at the Index level instead of the platform-specific manifest that the container will use. This leads to two main questions:
Ratify MUST special case the OCI Index and Docker Manifest List. The subject reference should resolve to the descriptor of the index/list and the platform-specific manifest in the index/list. We will change the behavior of the GetSubjectDescriptor
method to return a list of descriptors which will all be treated as subjects to be verified. We will leverage the existing ORAS store Resolve
function to provide a platform specific hint that can be used to return the correct descriptor.
At admission time of the Pod resource, the AdmissionRequest
resource that Gatekeeper receives as input, contains the full PodSpec. Since the Pod is yet to be created, the kube scheduler has not matched the pod to a node to run on in the cluster. Thus we can ONLY rely upon the information in the PodSpec. During policy evaluation, the rego has access to the entire PodSpec input
. This spec can be used to find specific node selection labels such as kubernetes.io/arch
and kubernetes.io/os
. If found, we can provide the target OS/arch combination in the external data provider request to Ratify. Since the current data Provider request only accepts a list of strings, we propose to define a new string based ratify request that will encode the subject reference and the target OS/Arch information. Ratify will be able to interpret this string request and provide the OS/Arch hint to the referrer store's GetSubjectDescriptor
method. If the external data provider request does not contain the OS/Arch for reference, Ratify will default to inferring the OS/Arch based on the node the Ratify pod is running on.
Typically, user can specify the node os/arch a pod must run on using Node Selectors, Affinity, and Tolerations. The rego templates we provide should handle each scenario.
This is the most common way to define OS/Arch in the pod spec.
Example:
Example:
Example: Set a taint on the Nodes with key: kubernetes.io/arch
and NoSchedule
effect for "arm64".
Payload would be JSON serialized and converted to string. Each entry in the list of parameters in external data provider request would a serialized string.
kubernetes.io/arch
and kubernetes.io/os
labels enough to rely upon? What happens when user has custom label names instead?
nodeSelectorTerms
.