Skip to content

Commit

Permalink
Protect OVA URL parsing
Browse files Browse the repository at this point in the history
Signed-off-by: yaacov <[email protected]>
  • Loading branch information
yaacov committed Dec 30, 2024
1 parent bfb0a81 commit dc40900
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/controller/provider/ova-setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ func (r Reconciler) CreateOVAServerDeployment(provider *api.Provider, ctx contex

func (r *Reconciler) createPvForNfs(provider *api.Provider, ctx context.Context, pvNamePrefix string) (pv *core.PersistentVolume, err error) {
splitted := strings.Split(provider.Spec.URL, ":")
if len(splitted) < 2 {
err = fmt.Errorf("invalid provider URL format: %s", provider.Spec.URL)

err = liberr.Wrap(err)
r.Log.Error(err, "Failed to parse NFS server and path from provider URL")
return nil, err
}
nfsServer := splitted[0]
nfsPath := splitted[1]
labels := map[string]string{"provider": provider.Name, "app": "forklift", "subapp": ovaServer}
Expand Down

0 comments on commit dc40900

Please sign in to comment.