Skip to content

Commit

Permalink
fixed go formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
AmitRoushan committed Aug 19, 2021
1 parent f1e246f commit 1b765fe
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
11 changes: 6 additions & 5 deletions src/csi/driver/driver.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package driver

import(
import (
"strings"
"utils/k8sutils"
)

Expand All @@ -10,17 +11,17 @@ type Driver struct {
useMultiPath bool
isNeedMultiPath bool
k8sUtils k8sutils.Interface
nodeName string
nodeName string
}

func NewDriver(name, version string, useMultiPath, isNeedMultiPath bool,
k8sUtils k8sutils.Interface, nodeName string) *Driver {
k8sUtils k8sutils.Interface, nodeName string) *Driver {
return &Driver{
name: name,
version: version,
useMultiPath: useMultiPath,
isNeedMultiPath: isNeedMultiPath,
k8sUtils: k8sUtils,
nodeName: nodeName,
k8sUtils: k8sUtils,
nodeName: strings.TrimSpace(nodeName),
}
}
6 changes: 3 additions & 3 deletions src/csi/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"runtime/debug"
"time"
"utils"
"utils/log"
"utils/k8sutils"
"utils/log"

"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/sirupsen/logrus"
Expand All @@ -32,7 +32,7 @@ const (
csiVersion = "2.2.13"
defaultDriverName = "csi.huawei.com"

nodeNameEnv = "CSI_ESDK_NODENAME"
nodeNameEnv = "CSI_ESDK_NODENAME"
)

var (
Expand Down Expand Up @@ -73,7 +73,7 @@ type CSIConfig struct {
}

type CSISecret struct {
Secrets map[string]interface{} `json:"secrets"`
Secrets map[string]interface{} `json:"secrets"`
}

func init() {
Expand Down
10 changes: 5 additions & 5 deletions src/utils/k8sutils/k8sutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import (
)

const (
topologyRegx = "topology.*"
topologyRegx = "topology.*"
)

type Interface interface {
GetNodeTopology(nodeName string) (map[string]string, error)
}

type KubeClient struct {
clientSet *kubernetes.Clientset
clientSet *kubernetes.Clientset
}

func NewK8SUtils(kubeConfig string) (Interface, error) {
Expand Down Expand Up @@ -49,8 +49,8 @@ func NewK8SUtils(kubeConfig string) (Interface, error) {
}
}

return &KubeClient{
clientSet: clientset,
return &KubeClient{
clientSet: clientset,
}, nil
}

Expand All @@ -72,4 +72,4 @@ func (k *KubeClient) GetNodeTopology(nodeName string) (map[string]string, error)

func (k *KubeClient) getNode(nodeName string) (*corev1.Node, error) {
return k.clientSet.CoreV1().Nodes().Get(nodeName, metav1.GetOptions{})
}
}

0 comments on commit 1b765fe

Please sign in to comment.