Skip to content

Commit

Permalink
add support for IAM account authentication for SFS (#59)
Browse files Browse the repository at this point in the history
* add support for IAM account authentication for SFS

* the version number is changed to be specified when packaging
  • Loading branch information
chengxiangdong authored Nov 7, 2022
1 parent 89df4d3 commit 254e0f1
Show file tree
Hide file tree
Showing 11 changed files with 833 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ REGISTRY_PASSWORD ?=

SOURCES := $(shell find . -name '*.go' 2>/dev/null)
VERSION ?= $(shell git describe --dirty --tags --match='v*')
LDFLAGS := "-w -s -X 'k8s.io/component-base/version.gitVersion=$(VERSION)'"
LDFLAGS := "-w -s -X 'github.com/huaweicloud/huaweicloud-csi-driver/pkg/version.Version=$(VERSION)'"
TEMP_DIR:=$(shell mktemp -d)

ALL ?= evs-csi-plugin \
Expand Down
14 changes: 8 additions & 6 deletions cmd/sfs-csi-plugin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,23 @@ package main
import (
"flag"
"fmt"
"github.com/huaweicloud/huaweicloud-csi-driver/pkg/utils/mounts"
"os"

"github.com/huaweicloud/huaweicloud-csi-driver/pkg/utils/mounts"

"github.com/spf13/cobra"
"github.com/spf13/pflag"
"k8s.io/klog"

"github.com/huaweicloud/huaweicloud-csi-driver/pkg/config"
"github.com/huaweicloud/huaweicloud-csi-driver/pkg/sfs"
"github.com/huaweicloud/huaweicloud-csi-driver/pkg/sfs/config"
"github.com/huaweicloud/huaweicloud-csi-driver/pkg/version"
)

var (
endpoint string
nodeID string
cloudconfig string
cloudConfig string
)

//nolint:errcheck
Expand All @@ -42,7 +44,7 @@ func main() {

cmd := &cobra.Command{
Use: os.Args[0],
Short: "CSI SFS driver",
Short: fmt.Sprintf("HuaweiCloud SFS CSI driver %s", version.Version),
PersistentPreRun: func(cmd *cobra.Command, args []string) {
// Glog requires this otherwise it complains.
flag.CommandLine.Parse(nil)
Expand All @@ -62,7 +64,7 @@ func main() {
})
},
Run: func(cmd *cobra.Command, args []string) {
cloud, err := config.LoadConfig(cloudconfig)
cloud, err := config.LoadConfig(cloudConfig)
if err != nil {
klog.V(3).Infof("Failed to load cloud config: %v", err)
}
Expand All @@ -83,7 +85,7 @@ func main() {
cmd.PersistentFlags().StringVar(&nodeID, "nodeid", "", "node id")
cmd.MarkPersistentFlagRequired("nodeid")

cmd.PersistentFlags().StringVar(&cloudconfig, "cloud-config", "", "CSI driver cloud config")
cmd.PersistentFlags().StringVar(&cloudConfig, "cloud-config", "", "CSI driver cloud config")
cmd.MarkPersistentFlagRequired("cloud-config")

if err := cmd.Execute(); err != nil {
Expand Down
Loading

0 comments on commit 254e0f1

Please sign in to comment.