Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Add support for runtime classes on Acorn computeclasses #2363

Merged

Conversation

cloudnautique
Copy link
Member

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

@cloudnautique cloudnautique marked this pull request as draft November 26, 2023 20:39
@cloudnautique cloudnautique force-pushed the add_runtime_class_support branch 3 times, most recently from c7ba8a4 to f7cd45f Compare November 30, 2023 19:49
@cloudnautique cloudnautique marked this pull request as ready for review December 1, 2023 16:09
pkg/controller/appdefinition/deploy.go Outdated Show resolved Hide resolved
pkg/install/role.yaml Show resolved Hide resolved
@cjellick
Copy link
Member

cjellick commented Dec 5, 2023

@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?

@@ -125,6 +132,21 @@ func PriorityClassName(req router.Request, computeClass *adminv1.ProjectComputeC
return computeClass.PriorityClassName, nil
}

// RuntimeClassName checks that a defined RuntimeClass exists and returns the name of it
func RuntimeClassName(req router.Request, computeClass *adminv1.ProjectComputeClassInstance) (string, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are exporting this function. I don't think it is used outside this package. If that's true, can you unexport (lowercase) it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like you were copying the pattern of PriorityClassName. If the same is true for that one, please unexport it as well

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

Signed-off-by: Bill Maxwell <[email protected]>
@cloudnautique cloudnautique force-pushed the add_runtime_class_support branch from f7cd45f to 1a1e7fa Compare December 5, 2023 22:10
@cloudnautique
Copy link
Member Author

@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
      ...

If the field is an empty string or unset, we should return a nil
pointer.

Signed-off-by: Bill Maxwell <[email protected]>
Signed-off-by: Bill Maxwell <[email protected]>
@cloudnautique cloudnautique force-pushed the add_runtime_class_support branch from a391d5d to f4aade4 Compare December 5, 2023 22:51
@cloudnautique cloudnautique merged commit af0829e into acorn-io:main Dec 6, 2023
5 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants