Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor cleanup in ova-setup.go #690

Merged
merged 1 commit into from
Dec 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions pkg/controller/provider/ova-setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"strings"

api "github.com/konveyor/forklift-controller/pkg/apis/forklift/v1beta1"
liberr "github.com/konveyor/forklift-controller/pkg/lib/error"
appsv1 "k8s.io/api/apps/v1"
core "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
Expand All @@ -30,6 +31,7 @@ func (r Reconciler) CreateOVAServerDeployment(provider *api.Provider, ctx contex
pvNamePrefix := fmt.Sprintf("%s-pv-%s-%s", ovaServer, provider.Name, provider.Namespace)
pv, err := r.createPvForNfs(provider, ctx, pvNamePrefix)
if err != nil {
err = liberr.Wrap(err)
r.Log.Error(err, "Failed to create PV for the OVA server")
return
}
Expand All @@ -44,19 +46,22 @@ func (r Reconciler) CreateOVAServerDeployment(provider *api.Provider, ctx contex
pvcNamePrefix := fmt.Sprintf("%s-pvc-%s", ovaServer, provider.Name)
pvc, err := r.createPvcForNfs(provider, ctx, ownerReference, pv.Name, pvcNamePrefix)
if err != nil {
err = liberr.Wrap(err)
r.Log.Error(err, "Failed to create PVC for the OVA server")
return
}

labels := map[string]string{"provider": provider.Name, "app": "forklift", "subapp": ovaServer}
err = r.createServerDeployment(provider, ctx, ownerReference, pvc.Name, labels)
if err != nil {
err = liberr.Wrap(err)
r.Log.Error(err, "Failed to create OVA server deployment")
return
}

err = r.createServerService(provider, ctx, ownerReference, labels)
if err != nil {
err = liberr.Wrap(err)
r.Log.Error(err, "Failed to create OVA server service")
return
}
Expand Down Expand Up @@ -91,9 +96,6 @@ func (r *Reconciler) createPvForNfs(provider *api.Provider, ctx context.Context,
},
}
err = r.Create(ctx, pv)
if err != nil {
return
}
return
}

Expand Down Expand Up @@ -121,9 +123,6 @@ func (r *Reconciler) createPvcForNfs(provider *api.Provider, ctx context.Context
},
}
err = r.Create(ctx, pvc)
if err != nil {
return
}
return
}

Expand Down Expand Up @@ -155,9 +154,6 @@ func (r *Reconciler) createServerDeployment(provider *api.Provider, ctx context.
}

err = r.Create(ctx, deployment)
if err != nil {
return
}
return
}

Expand Down Expand Up @@ -185,9 +181,6 @@ func (r *Reconciler) createServerService(provider *api.Provider, ctx context.Con
}

err = r.Create(ctx, service)
if err != nil {
return
}
return
}

Expand Down
Loading