mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Prevent CephFS from logging senstive options
This commit is contained in:
parent
548b297a00
commit
3784438b56
@ -300,25 +300,24 @@ func (cephfsVolume *cephfs) GetKeyringPath() string {
|
|||||||
|
|
||||||
func (cephfsVolume *cephfs) execMount(mountpoint string) error {
|
func (cephfsVolume *cephfs) execMount(mountpoint string) error {
|
||||||
// cephfs mount option
|
// cephfs mount option
|
||||||
cephOpt := ""
|
cephSensitiveOpt := []string{"name=" + cephfsVolume.id}
|
||||||
// override secretfile if secret is provided
|
// override secretfile if secret is provided
|
||||||
if cephfsVolume.secret != "" {
|
if cephfsVolume.secret != "" {
|
||||||
cephOpt = "name=" + cephfsVolume.id + ",secret=" + cephfsVolume.secret
|
cephSensitiveOpt = append(cephSensitiveOpt, "secret="+cephfsVolume.secret)
|
||||||
} else {
|
} else {
|
||||||
cephOpt = "name=" + cephfsVolume.id + ",secretfile=" + cephfsVolume.secretFile
|
cephSensitiveOpt = append(cephSensitiveOpt, "secretfile="+cephfsVolume.secretFile)
|
||||||
}
|
}
|
||||||
// build option array
|
// build option array
|
||||||
opt := []string{}
|
opt := []string{}
|
||||||
if cephfsVolume.readonly {
|
if cephfsVolume.readonly {
|
||||||
opt = append(opt, "ro")
|
opt = append(opt, "ro")
|
||||||
}
|
}
|
||||||
opt = append(opt, cephOpt)
|
|
||||||
|
|
||||||
// build src like mon1:6789,mon2:6789,mon3:6789:/
|
// build src like mon1:6789,mon2:6789,mon3:6789:/
|
||||||
src := strings.Join(cephfsVolume.mon, ",") + ":" + cephfsVolume.path
|
src := strings.Join(cephfsVolume.mon, ",") + ":" + 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.MountSensitive(src, mountpoint, "ceph", opt, cephSensitiveOpt); err != nil {
|
||||||
return fmt.Errorf("CephFS: mount failed: %v", err)
|
return fmt.Errorf("CephFS: mount failed: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user