Skip to content

Commit

Permalink
fix(pkg/driverbuilder): fixed kubernetes command.
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
  • Loading branch information
FedeDP authored and poiana committed Mar 25, 2024
1 parent cd9e5b3 commit 0f094fc
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions pkg/driverbuilder/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ func (bp *KubernetesBuildProcessor) buildModule(b *builder.Build) error {
return err
}

// We run a script that downloads libs,
// download and extracts kernelURLs saving its output to KERNELDIR env variable,
// then finally runs the build script.
res = fmt.Sprintf("%s\nexport KERNELDIR=$(%s)\n%s", libsDownloadScript, kernelDownloadScript, res)

if c.ModuleFilePath != "" {
res = fmt.Sprintf("%s\n%s", "touch "+moduleLockFile, res)
res = fmt.Sprintf("%s\n%s", res, "rm "+moduleLockFile)
Expand All @@ -128,7 +133,7 @@ func (bp *KubernetesBuildProcessor) buildModule(b *builder.Build) error {
buildCmd := []string{
"/bin/bash",
"-l",
"/driverkit/download-libs.sh && KERNELDIR=$(/driverkit/download-headers.sh) /driverkit/driverkit.sh",
"/driverkit/driverkit.sh",
}

commonMeta := metav1.ObjectMeta{
Expand Down Expand Up @@ -176,13 +181,19 @@ func (bp *KubernetesBuildProcessor) buildModule(b *builder.Build) error {
secuContext := corev1.PodSecurityContext{
RunAsUser: &bp.runAsUser,
}

imagePullSecrets := make([]corev1.LocalObjectReference, 0)
if bp.imagePullSecret != "" {
imagePullSecrets = append(imagePullSecrets, corev1.LocalObjectReference{Name: bp.imagePullSecret})
}

pod := &corev1.Pod{
ObjectMeta: commonMeta,
Spec: corev1.PodSpec{
ActiveDeadlineSeconds: pointer.Int64Ptr(deadline),
RestartPolicy: corev1.RestartPolicyNever,
SecurityContext: &secuContext,
ImagePullSecrets: []corev1.LocalObjectReference{{Name: bp.imagePullSecret}},
ImagePullSecrets: imagePullSecrets,
Containers: []corev1.Container{
{
Name: name,
Expand Down

0 comments on commit 0f094fc

Please sign in to comment.