diff --git a/pkg/wekafs/apiclient/interfacegroup.go b/pkg/wekafs/apiclient/interfacegroup.go index 82ce4f604..2bd751f5c 100644 --- a/pkg/wekafs/apiclient/interfacegroup.go +++ b/pkg/wekafs/apiclient/interfacegroup.go @@ -190,7 +190,7 @@ func (a *ApiClient) GetNfsInterfaceGroup(ctx context.Context, name string) *Inte // TODO: need to do it much more sophisticated way to distribute load func (a *ApiClient) GetNfsMountIp(ctx context.Context, interfaceGroupName string) (string, error) { // if override is set, use it - if len(a.Credentials.NfsTargetIPs) > 0 { + if len(a.Credentials.NfsTargetIPs) > 0 && a.Credentials.NfsTargetIPs[0] != "" { ips := a.Credentials.NfsTargetIPs idx := rand.Intn(len(ips)) ip := ips[idx] diff --git a/pkg/wekafs/wekafs.go b/pkg/wekafs/wekafs.go index 4e832b422..cab2a4bc4 100644 --- a/pkg/wekafs/wekafs.go +++ b/pkg/wekafs/wekafs.go @@ -106,6 +106,9 @@ func (api *ApiStore) fromSecrets(ctx context.Context, secrets map[string]string, nfsTargetIpsRaw := strings.TrimSpace(strings.ReplaceAll(strings.TrimSuffix(secrets["nfsTargetIps"], "\n"), "\n", ",")) nfsTargetIps = func() []string { var ret []string + if nfsTargetIpsRaw == "" { + return ret + } for _, s := range strings.Split(nfsTargetIpsRaw, ",") { ret = append(ret, strings.TrimSpace(strings.TrimSuffix(s, "\n"))) }