Skip to content

Commit

Permalink
controller: Handle snapshotter per handler
Browse files Browse the repository at this point in the history
Let's start properly setting a specific snapshotter per runtime handler
configured for containerd.

This work depends on a work done on the Kata Containers side to better
support setting snapshotters per runtime handler.

The PR from the Kata Containers side is:
kata-containers/kata-containers#8655.

Signed-off-by: Fabiano Fidêncio <[email protected]>
  • Loading branch information
fidencio committed Dec 26, 2023
1 parent 7d89970 commit 4ee7f81
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions controllers/ccruntime_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -629,15 +629,17 @@ func (r *CcRuntimeReconciler) processDaemonset(operation DaemonOperation) *appsv
}

var runtimeClassNames []string
var snapshotter = ""
var snapshotter_handler_mapping = ""
for _, runtimeClass := range r.ccRuntime.Spec.Config.RuntimeClasses {
runtimeClassNames = append(runtimeClassNames, runtimeClass.Name)
// FIXME: This will need to be changed by the moment the kata-containers
// payload script supports setting one snapshotter per runtime handler.
// For now, for the v0.8.0 release, we're fine assuming that all the
// set snapshotters are going to be the same.
if snapshotter == "" && runtimeClass.Snapshotter != "" {
snapshotter = runtimeClass.Snapshotter

if runtimeClass.Snapshotter != "" {
shim := strings.TrimPrefix(runtimeClass.Name, "kata-")
if snapshotter_handler_mapping == "" {
snapshotter_handler_mapping += shim + ":" + runtimeClass.Snapshotter
} else {
snapshotter_handler_mapping += "," + shim + ":" + runtimeClass.Snapshotter
}
}
}
var runtimeClasses = strings.Join(runtimeClassNames, " ")
Expand Down Expand Up @@ -673,8 +675,8 @@ func (r *CcRuntimeReconciler) processDaemonset(operation DaemonOperation) *appsv
Value: shims,
},
{
Name: "SNAPSHOTTER",
Value: snapshotter,
Name: "SNAPSHOTTER_HANDLER_MAPPING",
Value: snapshotter_handler_mapping,
},
}
envVars = append(envVars, r.ccRuntime.Spec.Config.EnvironmentVariables...)
Expand Down

0 comments on commit 4ee7f81

Please sign in to comment.