mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-06 11:42:14 +00:00
Use Join instead of concat it manually in cephfs.
This commit is contained in:
@@ -24,7 +24,7 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
@@ -317,15 +317,7 @@ func (cephfsVolume *cephfs) execMount(mountpoint string) error {
|
|||||||
opt = append(opt, cephOpt)
|
opt = append(opt, cephOpt)
|
||||||
|
|
||||||
// build src like mon1:6789,mon2:6789,mon3:6789:/
|
// build src like mon1:6789,mon2:6789,mon3:6789:/
|
||||||
hosts := cephfsVolume.mon
|
src := strings.Join(cephfsVolume.mon, ",") + ":" + cephfsVolume.path
|
||||||
l := len(hosts)
|
|
||||||
// pass all monitors and let ceph randomize and fail over
|
|
||||||
i := 0
|
|
||||||
src := ""
|
|
||||||
for i = 0; i < l-1; i++ {
|
|
||||||
src += hosts[i] + ","
|
|
||||||
}
|
|
||||||
src += hosts[i] + ":" + cephfsVolume.path
|
|
||||||
|
|
||||||
opt = util.JoinMountOptions(cephfsVolume.mountOptions, opt)
|
opt = util.JoinMountOptions(cephfsVolume.mountOptions, opt)
|
||||||
if err := cephfsVolume.mounter.Mount(src, mountpoint, "ceph", opt); err != nil {
|
if err := cephfsVolume.mounter.Mount(src, mountpoint, "ceph", opt); err != nil {
|
||||||
@@ -389,17 +381,8 @@ func (cephfsVolume *cephfs) execFuseMount(mountpoint string) error {
|
|||||||
} else {
|
} else {
|
||||||
keyringFile = cephfsVolume.secretFile
|
keyringFile = cephfsVolume.secretFile
|
||||||
}
|
}
|
||||||
|
|
||||||
// build src like mon1:6789,mon2:6789,mon3:6789:/
|
// build src like mon1:6789,mon2:6789,mon3:6789:/
|
||||||
hosts := cephfsVolume.mon
|
src := strings.Join(cephfsVolume.mon, ",")
|
||||||
l := len(hosts)
|
|
||||||
// pass all monitors and let ceph randomize and fail over
|
|
||||||
i := 0
|
|
||||||
src := ""
|
|
||||||
for i = 0; i < l-1; i++ {
|
|
||||||
src += hosts[i] + ","
|
|
||||||
}
|
|
||||||
src += hosts[i]
|
|
||||||
|
|
||||||
mountArgs := []string{}
|
mountArgs := []string{}
|
||||||
mountArgs = append(mountArgs, "-k")
|
mountArgs = append(mountArgs, "-k")
|
||||||
|
Reference in New Issue
Block a user