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 <fabiano.fidencio@intel.com>
  • Loading branch information
fidencio committed Dec 23, 2023
1 parent 7d89970 commit 5c2e16a
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions controllers/ccruntime_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -629,15 +629,16 @@ 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 != "" {
if snapshotter_handler_mapping == "" {
snapshotter_handler_mapping += runtimeClass.Name + ":" + runtimeClass.Snapshotter
} else {
snapshotter_handler_mapping += "," + runtimeClass.Name + ":" + runtimeClass.Snapshotter
}
}
}
var runtimeClasses = strings.Join(runtimeClassNames, " ")
Expand Down Expand Up @@ -673,8 +674,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 5c2e16a

Please sign in to comment.