Skip to content

Commit

Permalink
Allow runtime class for workshop containers to be set globally.
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamDumpleton committed Feb 15, 2023
1 parent 6c33de0 commit 48a7199
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions carvel-packages/training-platform/bundle/config/00-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ imageVersions:
- name: ""
image: ""

#! Settings for customizing container runtime used for Educates deployments.

clusterRuntime:

#! Runtime class applied to deployments. Can be set where pods should be run
#! using a container runtime other than the default. For example one could
#! select Kata containers as runtime so workshop containers are isolated in an
#! additional lightweight VM. Only workshop containers currently have this
#! runtime class applied.

class: ""

#! Settings for customizing ingress details by which Educates will be accessed.

clusterIngress:
Expand Down
2 changes: 2 additions & 0 deletions session-manager/handlers/operator_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
else:
IMAGE_REPOSITORY = "registry.default.svc.cluster.local:5001"

RUNTIME_CLASS = xget(config_values, "clusterRuntime.class", "")

INGRESS_DOMAIN = xget(config_values, "clusterIngress.domain", "educates-local-dev.xyz")
INGRESS_CLASS = xget(config_values, "clusterIngress.class", "")

Expand Down
4 changes: 4 additions & 0 deletions session-manager/handlers/workshopsession.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
OPERATOR_STATUS_KEY,
OPERATOR_NAME_PREFIX,
IMAGE_REPOSITORY,
RUNTIME_CLASS,
INGRESS_DOMAIN,
INGRESS_PROTOCOL,
INGRESS_SECRET,
Expand Down Expand Up @@ -1393,6 +1394,9 @@ def resolve_security_policy(name):

deployment_pod_template_spec = deployment_body["spec"]["template"]["spec"]

if RUNTIME_CLASS:
deployment_pod_template_spec["runtimeClassName"] = RUNTIME_CLASS

token_enabled = (
workshop_spec["session"]
.get("namespaces", {})
Expand Down

0 comments on commit 48a7199

Please sign in to comment.