Skip to content

Commit

Permalink
crd: Expose "Debug" for the CcInstallConfig
Browse files Browse the repository at this point in the history
This will allow us passing down to the payloads whether it should be
installed and configured to run on Debug mode, easing the life of folks
who want to debug issues with the Operator's paylods.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
  • Loading branch information
fidencio committed Aug 7, 2023
1 parent 2efecdf commit 6cf4bda
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions api/v1beta1/ccruntime_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ type CcInstallConfig struct {
// +optional
RuntimeClassNames []string `json:"runtimeClassNames,omitempty"`

// This specifies whether the CcRuntime (kata or enclave-cc) will be running on debug mode
// +optional
Debug bool `json:"debug,omitempty"`

// This specifies the environment variables required by the daemon set
// +optional
EnvironmentVariables []corev1.EnvVar `json:"environmentVariables,omitempty"`
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/confidentialcontainers.org_ccruntimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ spec:
items:
type: string
type: array
debug:
description: This specifies whether the CcRuntime (kata or enclave-cc)
will be running on debug mode
type: boolean
environmentVariables:
description: This specifies the environment variables required
by the daemon set
Expand Down
13 changes: 12 additions & 1 deletion controllers/ccruntime_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package controllers
import (
"context"
"fmt"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -651,6 +652,16 @@ func (r *CcRuntimeReconciler) processDaemonset(operation DaemonOperation) *appsv
containerCommand = r.ccRuntime.Spec.Config.UninstallCmd
}

var debug = strconv.FormatBool(r.ccRuntime.Spec.Config.Debug)

var envVars = []corev1.EnvVar{
{
Name: "DEBUG",
Value: debug,
},
}
envVars = append(envVars, r.ccRuntime.Spec.Config.EnvironmentVariables...)

return &appsv1.DaemonSet{
TypeMeta: metav1.TypeMeta{
APIVersion: "apps/v1",
Expand Down Expand Up @@ -692,7 +703,7 @@ func (r *CcRuntimeReconciler) processDaemonset(operation DaemonOperation) *appsv
RunAsUser: &runAsUser,
},
Command: containerCommand,
Env: r.ccRuntime.Spec.Config.EnvironmentVariables,
Env: envVars,
VolumeMounts: r.ccRuntime.Spec.Config.InstallerVolumeMounts,
},
},
Expand Down

0 comments on commit 6cf4bda

Please sign in to comment.