From 55a7f90ae8649b798b792836478f53d57efd387e Mon Sep 17 00:00:00 2001 From: Arik Hadas Date: Wed, 4 Oct 2023 13:57:35 +0300 Subject: [PATCH] minor cleanup to recent OVA related changes Signed-off-by: Arik Hadas --- pkg/controller/plan/migration.go | 2 +- pkg/controller/provider/ova-setup.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/controller/plan/migration.go b/pkg/controller/plan/migration.go index b841a77a4..9d3cde4cb 100644 --- a/pkg/controller/plan/migration.go +++ b/pkg/controller/plan/migration.go @@ -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 } } diff --git a/pkg/controller/provider/ova-setup.go b/pkg/controller/provider/ova-setup.go index 7731b551f..f519a0d10 100644 --- a/pkg/controller/provider/ova-setup.go +++ b/pkg/controller/provider/ova-setup.go @@ -15,7 +15,7 @@ import ( ) const ( - ovaServerPrefix = "ova-server" + ovaServer = "ova-server" ovaImageVar = "OVA_PROVIDER_SERVER_IMAGE" nfsVolumeNamePrefix = "nfs-volume" mountPath = "/ova" @@ -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") @@ -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{ @@ -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,