Skip to content

Commit

Permalink
Build the LUKS secret mount
Browse files Browse the repository at this point in the history
This patch will mount the expected LUKS secret to virt-v2v pod. This
will later allow us to read the secret and provide the arguments to the
migration.

Signed-off-by: Liran Rotenberg <[email protected]>
  • Loading branch information
liranr23 committed Dec 10, 2023
1 parent 7818054 commit a317695
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion pkg/controller/plan/kubevirt.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"strings"
"time"

api "github.com/konveyor/forklift-controller/pkg/apis/forklift/v1beta1"
template "github.com/openshift/api/template/v1"
"github.com/openshift/library-go/pkg/template/generator"
"github.com/openshift/library-go/pkg/template/templateprocessing"
Expand All @@ -26,12 +25,14 @@ import (
libvirtxml "libvirt.org/libvirt-go-xml"

"github.com/konveyor/forklift-controller/pkg/apis/forklift/v1beta1"
api "github.com/konveyor/forklift-controller/pkg/apis/forklift/v1beta1"
"github.com/konveyor/forklift-controller/pkg/apis/forklift/v1beta1/plan"
"github.com/konveyor/forklift-controller/pkg/apis/forklift/v1beta1/ref"
"github.com/konveyor/forklift-controller/pkg/controller/plan/adapter"
plancontext "github.com/konveyor/forklift-controller/pkg/controller/plan/context"
libcnd "github.com/konveyor/forklift-controller/pkg/lib/condition"
liberr "github.com/konveyor/forklift-controller/pkg/lib/error"
libref "github.com/konveyor/forklift-controller/pkg/lib/ref"
core "k8s.io/api/core/v1"
k8serr "k8s.io/apimachinery/pkg/api/errors"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -1476,6 +1477,22 @@ func (r *KubeVirt) podVolumeMounts(vmVolumes []cnv.Volume, configMap *core.Confi
EmptyDir: &core.EmptyDirVolumeSource{},
},
})
if libref.RefSet(&r.Plan.Spec.LUKS) {
volumes = append(volumes, core.Volume{
Name: "luks",
VolumeSource: core.VolumeSource{
Secret: &core.SecretVolumeSource{
SecretName: r.Plan.Spec.LUKS.Name,
},
},
})
mounts = append(mounts,
core.VolumeMount{
Name: "luks",
MountPath: "/etc/luks",
ReadOnly: true,
})
}

return
}
Expand Down

0 comments on commit a317695

Please sign in to comment.