Skip to content

Commit

Permalink
Merge pull request #1 from houz42/master
Browse files Browse the repository at this point in the history
use go mod, and minor fixes
  • Loading branch information
houz authored Jan 5, 2021
2 parents 8d41e47 + 5e6055d commit 8c96ed7
Show file tree
Hide file tree
Showing 4,756 changed files with 466 additions and 1,297,298 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
48 changes: 48 additions & 0 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: csi-huawei image
on:
push:
branches:
- master
tags:
- v*.*.*

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v2

- name: login to docker hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: set up docker buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- id: image_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: $GITHUB_ACTOR/csi-huawei # list of Docker images to use as base name for tags
tag-sha: true # add git short SHA as Docker tag

- name: build driver
id: docker_build_s3_driver
uses: docker/build-push-action@v2
with:
context: ./
file: Dockerfile
push: true
tags: ${{ steps.image_meta.outputs.tags }}
labels: ${{ steps.image_meta.outputs.labels }}
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM golang:alpine AS builder

WORKDIR /src
COPY . /src/
RUN go build -o bin/huawei-csi ./src/csi

FROM alpine
COPY --from=builder /src/bin/huawei-csi /huawei-csi
ENTRYPOINT [ "/huawei-csi" ]
18 changes: 0 additions & 18 deletions Makefile-CSI

This file was deleted.

13 changes: 13 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module github.com/Huawei/eSDK_K8S_Plugin

go 1.15

require (
github.com/container-storage-interface/spec v1.3.0
github.com/golang/protobuf v1.4.3
github.com/sirupsen/logrus v1.7.0
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
golang.org/x/sys v0.0.0-20210104204734-6f8348627aad
google.golang.org/grpc v1.34.0
k8s.io/apimachinery v0.20.1
)
206 changes: 206 additions & 0 deletions go.sum

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/connector/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package connector

import (
"fmt"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

const (
Expand Down
5 changes: 3 additions & 2 deletions src/connector/connector_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (
"regexp"
"strings"
"time"
"utils"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/utils"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

func GetDevice(findDeviceMap map[string]string, tgtLunGuid string) (string, error) {
Expand Down
7 changes: 4 additions & 3 deletions src/connector/fibrechannel/fc.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package fibrechannel

import (
"connector"
"dev"
"errors"
"fmt"
"time"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/connector"
"github.com/Huawei/eSDK_K8S_Plugin/src/dev"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

type FibreChannel struct{}
Expand Down
4 changes: 2 additions & 2 deletions src/connector/fibrechannel/fc_helper.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package fibrechannel

import (
"utils"
"utils/log"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

func scanHost() {
Expand Down
7 changes: 4 additions & 3 deletions src/connector/iscsi/iscsi.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package iscsi

import (
"connector"
"dev"
"strings"
"time"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/connector"
"github.com/Huawei/eSDK_K8S_Plugin/src/dev"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

type iSCSI struct{}
Expand Down
12 changes: 6 additions & 6 deletions src/connector/iscsi/iscsi_helper.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package iscsi

import (
"connector"
"errors"
"fmt"
"math"
"runtime/debug"
"strings"
"sync"
"time"
"utils"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/connector"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

type connectorInfo struct {
Expand Down Expand Up @@ -203,8 +204,7 @@ func findTgtMultiPath(lenIndex int, iscsiShareData *shareData, conn *connectorIn
var wwnAdded bool
var lastTryOn int64
for {
if (int64(lenIndex) == iscsiShareData.stoppedThreads && iscsiShareData.foundDevices == nil) || (
mPath != "" && int64(lenIndex) == iscsiShareData.numLogin+iscsiShareData.failedLogin) {
if (int64(lenIndex) == iscsiShareData.stoppedThreads && iscsiShareData.foundDevices == nil) || (mPath != "" && int64(lenIndex) == iscsiShareData.numLogin+iscsiShareData.failedLogin) {
break
}

Expand Down Expand Up @@ -239,7 +239,7 @@ func tryConnectVolume(connMap map[string]interface{}) (string, error) {
return "", err
}

// must ignore the error
// must ignore the error
allSessions, _ := utils.ExecShellCmd("iscsiadm -m session")

var mPath string
Expand Down
7 changes: 4 additions & 3 deletions src/connector/nvme/nvme.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package nvme

import (
"connector"
"errors"
"fmt"
"time"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/connector"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

type FCNVMe struct{}
Expand All @@ -22,7 +23,7 @@ func (fc *FCNVMe) ConnectVolume(conn map[string]interface{}) (string, error) {
log.Errorln(msg)
return "", errors.New(msg)
}
connectInfo := map[string]interface{} {
connectInfo := map[string]interface{}{
"protocol": "fc",
}
connector.ScanNVMe(connectInfo)
Expand Down
5 changes: 3 additions & 2 deletions src/connector/roce/roce.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package roce

import (
"connector"
"strings"
"time"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/connector"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

type RoCE struct{}
Expand Down
16 changes: 8 additions & 8 deletions src/connector/roce/roce_helper.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
package roce

import (
"connector"
"errors"
"fmt"
"math"
"runtime/debug"
"strings"
"sync"
"time"
"utils"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/connector"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

type connectorInfo struct {
tgtPortals []string
tgtPortals []string
tgtLunGuids []string
}

Expand Down Expand Up @@ -97,8 +98,8 @@ func singleConnectVolume(allSessions, tgtPortal, tgtLunGuid string, nvmeShareDat
nvmeShareData.failedLogin += 1
} else {
nvmeShareData.numLogin += 1
connectInfo := map[string]interface{} {
"protocol": "iscsi",
connectInfo := map[string]interface{}{
"protocol": "iscsi",
"targetNqn": tgtNqn,
}
for i := 1; i < 4; i++ {
Expand Down Expand Up @@ -165,8 +166,7 @@ func findTgtMultiPath(lenIndex int, nvmeShareData *shareData, conn *connectorInf
var mPath string
var lastTryOn int64
for {
if (int64(lenIndex) == nvmeShareData.stoppedThreads && nvmeShareData.foundDevices == nil) || (
mPath != "" && int64(lenIndex) == nvmeShareData.numLogin+nvmeShareData.failedLogin) {
if (int64(lenIndex) == nvmeShareData.stoppedThreads && nvmeShareData.foundDevices == nil) || (mPath != "" && int64(lenIndex) == nvmeShareData.numLogin+nvmeShareData.failedLogin) {
break
}

Expand Down
10 changes: 5 additions & 5 deletions src/csi/backend/backend.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package backend

import (
"csi/backend/plugin"
"errors"
"fmt"
"regexp"
"sync"
"utils"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/csi/backend/plugin"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

var (
Expand Down Expand Up @@ -168,8 +169,7 @@ func updateMetroBackends() {
continue
}

if (i.MetroDomain != "" && i.MetroDomain == j.MetroDomain) || (
i.MetrovStorePairID != "" && i.MetrovStorePairID == j.MetrovStorePairID) {
if (i.MetroDomain != "" && i.MetroDomain == j.MetroDomain) || (i.MetrovStorePairID != "" && i.MetrovStorePairID == j.MetrovStorePairID) {
i.MetroBackend, j.MetroBackend = j, i
i.Plugin.UpdateMetroRemotePlugin(j.Plugin)
j.Plugin.UpdateMetroRemotePlugin(i.Plugin)
Expand Down
3 changes: 2 additions & 1 deletion src/csi/backend/capability.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import (
"os"
"runtime/debug"
"sync"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

func updateBackendCapabilities(backend *Backend, sync bool) error {
Expand Down
11 changes: 6 additions & 5 deletions src/csi/backend/plugin/fusionstorage-nas.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
package plugin

import (
"dev"
"errors"
"fmt"
"net"
"storage/fusionstorage/volume"
"utils"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/dev"
"github.com/Huawei/eSDK_K8S_Plugin/src/storage/fusionstorage/volume"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

type FusionStorageNasPlugin struct {
FusionStoragePlugin
portal string
portal string
}

func init() {
Expand Down
13 changes: 7 additions & 6 deletions src/csi/backend/plugin/fusionstorage-san.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package plugin

import (
"dev"
"errors"
"fmt"
"net"
"proto"
"storage/fusionstorage/attacher"
"storage/fusionstorage/volume"
"strings"
"utils"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/dev"
"github.com/Huawei/eSDK_K8S_Plugin/src/proto"
"github.com/Huawei/eSDK_K8S_Plugin/src/storage/fusionstorage/attacher"
"github.com/Huawei/eSDK_K8S_Plugin/src/storage/fusionstorage/volume"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

type FusionStorageSanPlugin struct {
Expand Down
Loading

0 comments on commit 8c96ed7

Please sign in to comment.