mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 14:20:19 +00:00
cephfs: cephconf: include volume UUID in keyrings/secrets
This commit is contained in:
parent
3c2c7551df
commit
cc88d2fa09
@ -52,8 +52,8 @@ const cephSecret = `{{.Key}}`
|
|||||||
const (
|
const (
|
||||||
cephConfigRoot = "/etc/ceph"
|
cephConfigRoot = "/etc/ceph"
|
||||||
cephConfigFileNameFmt = "ceph.share.%s.conf"
|
cephConfigFileNameFmt = "ceph.share.%s.conf"
|
||||||
cephKeyringFileNameFmt = "ceph.client.%s.keyring"
|
cephKeyringFileNameFmt = "ceph.share.%s.client.%s.keyring"
|
||||||
cephSecretFileNameFmt = "ceph.client.%s.secret"
|
cephSecretFileNameFmt = "ceph.share.%s.client.%s.secret"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -115,34 +115,37 @@ type cephKeyringData struct {
|
|||||||
UserId, Key string
|
UserId, Key string
|
||||||
RootPath string
|
RootPath string
|
||||||
Pool, Namespace string
|
Pool, Namespace string
|
||||||
|
VolumeUuid string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *cephKeyringData) writeToFile() error {
|
func (d *cephKeyringData) writeToFile() error {
|
||||||
return writeCephTemplate(fmt.Sprintf(cephKeyringFileNameFmt, d.UserId), 0600, cephKeyringTempl, d)
|
return writeCephTemplate(fmt.Sprintf(cephKeyringFileNameFmt, d.VolumeUuid, d.UserId), 0600, cephKeyringTempl, d)
|
||||||
}
|
}
|
||||||
|
|
||||||
type cephFullCapsKeyringData struct {
|
type cephFullCapsKeyringData struct {
|
||||||
UserId, Key string
|
UserId, Key string
|
||||||
|
VolumeUuid string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *cephFullCapsKeyringData) writeToFile() error {
|
func (d *cephFullCapsKeyringData) writeToFile() error {
|
||||||
return writeCephTemplate(fmt.Sprintf(cephKeyringFileNameFmt, d.UserId), 0600, cephFullCapsKeyringTempl, d)
|
return writeCephTemplate(fmt.Sprintf(cephKeyringFileNameFmt, d.VolumeUuid, d.UserId), 0600, cephFullCapsKeyringTempl, d)
|
||||||
}
|
}
|
||||||
|
|
||||||
type cephSecretData struct {
|
type cephSecretData struct {
|
||||||
UserId, Key string
|
UserId, Key string
|
||||||
|
VolumeUuid string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *cephSecretData) writeToFile() error {
|
func (d *cephSecretData) writeToFile() error {
|
||||||
return writeCephTemplate(fmt.Sprintf(cephSecretFileNameFmt, d.UserId), 0600, cephSecretTempl, d)
|
return writeCephTemplate(fmt.Sprintf(cephSecretFileNameFmt, d.VolumeUuid, d.UserId), 0600, cephSecretTempl, d)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getCephSecretPath(userId string) string {
|
func getCephSecretPath(volUuid, userId string) string {
|
||||||
return path.Join(cephConfigRoot, fmt.Sprintf(cephSecretFileNameFmt, userId))
|
return path.Join(cephConfigRoot, fmt.Sprintf(cephSecretFileNameFmt, volUuid, userId))
|
||||||
}
|
}
|
||||||
|
|
||||||
func getCephKeyringPath(userId string) string {
|
func getCephKeyringPath(volUuid, userId string) string {
|
||||||
return path.Join(cephConfigRoot, fmt.Sprintf(cephKeyringFileNameFmt, userId))
|
return path.Join(cephConfigRoot, fmt.Sprintf(cephKeyringFileNameFmt, volUuid, userId))
|
||||||
}
|
}
|
||||||
|
|
||||||
func getCephConfPath(volUuid string) string {
|
func getCephConfPath(volUuid string) string {
|
||||||
|
Loading…
Reference in New Issue
Block a user