mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-26 08:10:20 +00:00
Merge pull request #127 from humblec/clean
Remove unwanted else block and add comments about some exported funtions and variables
This commit is contained in:
commit
cf3855514f
@ -96,7 +96,7 @@ func createCephUser(volOptions *volumeOptions, adminCr *credentials, volId volum
|
|||||||
"osd", caps.Osd,
|
"osd", caps.Osd,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := execCommandJson(&ents, "ceph", args[:]...); err != nil {
|
if err := execCommandJSON(&ents, "ceph", args[:]...); err != nil {
|
||||||
return nil, fmt.Errorf("error creating ceph user: %v", err)
|
return nil, fmt.Errorf("error creating ceph user: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
// PluginFolder is the kubelet plugin directory for cephfs plugin
|
||||||
PluginFolder = "/var/lib/kubelet/plugins/csi-cephfsplugin"
|
PluginFolder = "/var/lib/kubelet/plugins/csi-cephfsplugin"
|
||||||
|
// Version of the cephfs csi driver
|
||||||
Version = "0.3.0"
|
Version = "0.3.0"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -46,6 +48,7 @@ var (
|
|||||||
DefaultVolumeMounter string
|
DefaultVolumeMounter string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// NewCephFSDriver provides a remote csi cephfs driver object.
|
||||||
func NewCephFSDriver() *cephfsDriver {
|
func NewCephFSDriver() *cephfsDriver {
|
||||||
return &cephfsDriver{}
|
return &cephfsDriver{}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ func execCommandAndValidate(program string, args ...string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func execCommandJson(v interface{}, program string, args ...string) error {
|
func execCommandJSON(v interface{}, program string, args ...string) error {
|
||||||
out, err := execCommand(program, args...)
|
out, err := execCommand(program, args...)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -119,12 +119,12 @@ func (k8scm *K8sCMCache) Create(identifier string, data interface{}) error {
|
|||||||
if cm != nil && err == nil {
|
if cm != nil && err == nil {
|
||||||
glog.V(4).Infof("k8s-cm-cache: configmap already exists, skipping configmap creation")
|
glog.V(4).Infof("k8s-cm-cache: configmap already exists, skipping configmap creation")
|
||||||
return nil
|
return nil
|
||||||
} else {
|
}
|
||||||
dataJson, err := json.Marshal(data)
|
dataJSON, err := json.Marshal(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "k8s-cm-cache: marshal error")
|
return errors.Wrap(err, "k8s-cm-cache: marshal error")
|
||||||
}
|
}
|
||||||
cm := &v1.ConfigMap{
|
cm = &v1.ConfigMap{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: identifier,
|
Name: identifier,
|
||||||
Namespace: k8scm.Namespace,
|
Namespace: k8scm.Namespace,
|
||||||
@ -134,7 +134,7 @@ func (k8scm *K8sCMCache) Create(identifier string, data interface{}) error {
|
|||||||
},
|
},
|
||||||
Data: map[string]string{},
|
Data: map[string]string{},
|
||||||
}
|
}
|
||||||
cm.Data[cmDataKey] = string(dataJson)
|
cm.Data[cmDataKey] = string(dataJSON)
|
||||||
|
|
||||||
_, err = k8scm.Client.CoreV1().ConfigMaps(k8scm.Namespace).Create(cm)
|
_, err = k8scm.Client.CoreV1().ConfigMaps(k8scm.Namespace).Create(cm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -145,7 +145,6 @@ func (k8scm *K8sCMCache) Create(identifier string, data interface{}) error {
|
|||||||
return errors.Wrapf(err, "k8s-cm-cache: couldn't persist %s metadata as configmap", identifier)
|
return errors.Wrapf(err, "k8s-cm-cache: couldn't persist %s metadata as configmap", identifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
glog.V(4).Infof("k8s-cm-cache: configmap %s successfully created\n", identifier)
|
glog.V(4).Infof("k8s-cm-cache: configmap %s successfully created\n", identifier)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user