Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

controller: Handle snapshotter per handler #303

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions controllers/ccruntime_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -628,20 +628,19 @@ func (r *CcRuntimeReconciler) processDaemonset(operation DaemonOperation) *appsv
createDefaultRuntimeClass = "true"
}

var runtimeClassNames []string
var snapshotter = ""
var shims []string
var snapshotter_handler_mapping []string
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
// Similarly to what's being done for the default shim, let's remove
// the "kata-" prefix from the runtime class names
shim := strings.TrimPrefix(runtimeClass.Name, "kata-")
shims = append(shims, shim)

if runtimeClass.Snapshotter != "" {
fidencio marked this conversation as resolved.
Show resolved Hide resolved
mapping := shim + ":" + runtimeClass.Snapshotter
snapshotter_handler_mapping = append(snapshotter_handler_mapping, mapping)
}
}
var runtimeClasses = strings.Join(runtimeClassNames, " ")
var shims = strings.ReplaceAll(runtimeClasses, "kata-", "")

var envVars = []corev1.EnvVar{
{
Expand Down Expand Up @@ -670,11 +669,11 @@ func (r *CcRuntimeReconciler) processDaemonset(operation DaemonOperation) *appsv
},
{
Name: "SHIMS",
Value: shims,
Value: strings.Join(shims, " "),
},
{
Name: "SNAPSHOTTER",
Value: snapshotter,
Name: "SNAPSHOTTER_HANDLER_MAPPING",
Value: strings.Join(snapshotter_handler_mapping, ","),
},
}
envVars = append(envVars, r.ccRuntime.Spec.Config.EnvironmentVariables...)
Expand Down