Skip to content

Commit

Permalink
minor cleanup to recent OVA related changes
Browse files Browse the repository at this point in the history
Signed-off-by: Arik Hadas <[email protected]>
  • Loading branch information
ahadas committed Oct 4, 2023
1 parent 76919d9 commit 55a7f90
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/controller/plan/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ func (r *Migration) Archive() {
if r.Plan.Provider.Source.Type() == v1beta1.Ova {
err = r.deletePvcPvForOva()
if err != nil {
r.Log.Error(err, "Failed to cleanup the PVC and PV for OVA plan")
r.Log.Error(err, "Failed to clean up the PVC and PV for the OVA plan")
return
}
}
Expand Down
12 changes: 6 additions & 6 deletions pkg/controller/provider/ova-setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
)

const (
ovaServerPrefix = "ova-server"
ovaServer = "ova-server"
ovaImageVar = "OVA_PROVIDER_SERVER_IMAGE"
nfsVolumeNamePrefix = "nfs-volume"
mountPath = "/ova"
Expand All @@ -29,21 +29,21 @@ func (r Reconciler) CreateOVAServerDeployment(provider *api.Provider, ctx contex
Name: provider.Name,
UID: provider.UID,
}
pvName := fmt.Sprintf("%s-pv-%s-%s", ovaServerPrefix, provider.Name, provider.Namespace)
pvName := fmt.Sprintf("%s-pv-%s-%s", ovaServer, provider.Name, provider.Namespace)
err := r.createPvForNfs(provider, ctx, ownerReference, pvName)
if err != nil {
r.Log.Error(err, "Failed to create PV for the OVA server")
return
}

pvcName := fmt.Sprintf("%s-pvc-%s", ovaServerPrefix, provider.Name)
pvcName := fmt.Sprintf("%s-pvc-%s", ovaServer, provider.Name)
err = r.createPvcForNfs(provider, ctx, ownerReference, pvName, pvcName)
if err != nil {
r.Log.Error(err, "Failed to create PVC for the OVA server")
return
}

labels := map[string]string{"provider": provider.Name, "app": "forklift", "subapp": "ova-server"}
labels := map[string]string{"provider": provider.Name, "app": "forklift", "subapp": ovaServer}
err = r.createServerDeployment(provider, ctx, ownerReference, pvcName, labels)
if err != nil {
r.Log.Error(err, "Failed to create OVA server deployment")
Expand All @@ -61,7 +61,7 @@ func (r *Reconciler) createPvForNfs(provider *api.Provider, ctx context.Context,
splitted := strings.Split(provider.Spec.URL, ":")
nfsServer := splitted[0]
nfsPath := splitted[1]
labels := map[string]string{"provider": provider.Name, "app": "forklift", "subapp": "ova-server"}
labels := map[string]string{"provider": provider.Name, "app": "forklift", "subapp": ovaServer}

pv := &core.PersistentVolume{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -93,7 +93,7 @@ func (r *Reconciler) createPvForNfs(provider *api.Provider, ctx context.Context,

func (r *Reconciler) createPvcForNfs(provider *api.Provider, ctx context.Context, ownerReference metav1.OwnerReference, pvName, pvcName string) (err error) {
sc := ""
labels := map[string]string{"provider": provider.Name, "app": "forklift", "subapp": "ova-server"}
labels := map[string]string{"provider": provider.Name, "app": "forklift", "subapp": ovaServer}
pvc := &core.PersistentVolumeClaim{
ObjectMeta: metav1.ObjectMeta{
Name: pvcName,
Expand Down

0 comments on commit 55a7f90

Please sign in to comment.