acorn-io / runtime

A simple application deployment framework built on Kubernetes
https://docs.acorn.io/
Apache License 2.0
1.13k stars 100 forks source link

Add support for runtime classes on Acorn computeclasses #2363

Closed cloudnautique closed 10 months ago

cloudnautique commented 10 months ago

Runtime classes are added as in internal value on Acorn compute class objects. This allows for using things like Kata Containers.

cjellick commented 10 months ago

@cloudnautique can you give a practicall example here? I understand this is related to the kata POC. But can you:

  1. show me in yaml what the compute class will look like
  2. explain what that translates to at a k8s infra level. Like, where does that runtime class get set?
cloudnautique commented 10 months ago

@cjellick I added an update to the docs, which shows a project compute class YAML. I think that satisfies the compute class yaml request. Please let me know if it doesn't and I can update the docs some more.

The field is set to the string name of a k8s RuntimeClass, an example YAML for one is:

apiVersion: node.k8s.io/v1
handler: kata-clh
kind: RuntimeClass
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"node.k8s.io/v1","handler":"kata-clh","kind":"RuntimeClass","metadata":{"annotations":{},"name":"kata-clh"},"overhead":{"podFixed":{"cpu":"250m","memory":"130Mi"}},"scheduling":{"nodeSelector":{"katacontainers.io/kata-runtime":"true"}}}
  creationTimestamp: "2023-11-21T17:54:07Z"
  name: kata-clh
  resourceVersion: "20424"
  uid: 85d1fdde-834d-4476-adb9-456b74d8e209
overhead:
  podFixed:
    cpu: 250m
    memory: 130Mi
scheduling:
  nodeSelector:
    katacontainers.io/kata-runtime: "true"

The RuntimeClass is set as a field on a K8s pod spec, when this is specified on the compute class a deployment will have it set like:

apiVersion: apps/v1
kind: Deployment
metadata:
  ...
    spec:
      containers:
       ...
        image: ghcr.io/cloudnautique/acorn-minecraft@sha256:fd92271de53157c76cfed9bc7e7bbef5c60b829e76afd7b50612f5cd8e607de9
        ...
      runtimeClassName: kata-clh
      ...