mirror of
https://github.com/kubernetes-csi/csi-driver-nvmf.git
synced 2025-04-27 19:05:26 +00:00
style&chore: modity Makefile and some code style
1. add .prow.sh 2. add a symlink in Makefile related to release-tools. 3. modify some code style to pass fmt test. Signed-off-by: Meinhard Zhou <zhouenhua@bytedance.com>
This commit is contained in:
parent
a62f221f93
commit
3e07ae4e60
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
.idea/
|
||||
.vscode/
|
27
.prow.sh
Executable file
27
.prow.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#! /bin/bash
|
||||
|
||||
# Copyright 2022 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# A Prow job can override these defaults, but this shouldn't be necessary.
|
||||
|
||||
# disable e2e tests for now
|
||||
CSI_PROW_E2E_REPO=none
|
||||
|
||||
# Only these tests make sense for unit test
|
||||
: ${CSI_PROW_TESTS:="unit"}
|
||||
|
||||
. release-tools/prow.sh
|
||||
|
||||
main
|
@ -1,5 +1,5 @@
|
||||
FROM debian:9.13
|
||||
|
||||
COPY ./output/nvmfplugin .
|
||||
COPY ./bin/nvmfplugin .
|
||||
|
||||
ENTRYPOINT ["./nvmfplugin"]
|
||||
ENTRYPOINT ["/nvmfplugin"]
|
||||
|
16
Makefile
16
Makefile
@ -13,18 +13,10 @@
|
||||
# limitations under the License.
|
||||
|
||||
CMDS=nvmfplugin
|
||||
REV=$(shell git describe --long --tags --match='v*' --dirty 2>/dev/null || git rev-list -n1 HEAD)
|
||||
|
||||
all: build
|
||||
|
||||
build-%:
|
||||
mkdir -p output
|
||||
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-X main.version=$(REV) -extldflags "-static"' -o ./output/$* ./cmd/nvmfplugin/$*.go
|
||||
include release-tools/build.make
|
||||
|
||||
container-%: build-%
|
||||
docker build -t $*:latest -f Dockerfile --label revision=$(REV) .
|
||||
|
||||
build: ${CMDS:%=build-%}
|
||||
container: ${CMDS:%=container-%}
|
||||
clean:
|
||||
-rm -rf output/
|
||||
GOPATH ?= $(shell go env GOPATH)
|
||||
GOBIN ?= $(GOPATH)/bin
|
||||
export GOPATH GOBIN
|
||||
|
@ -38,7 +38,7 @@ func NewControllerServer(d *driver) *ControllerServer {
|
||||
// You should realize your volume provider here, such as requesting the Cloud to create an NVMf block and
|
||||
// returning specific information to you
|
||||
func (c *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented,"CreateVolume should implement by yourself. ")
|
||||
return nil, status.Errorf(codes.Unimplemented, "CreateVolume should implement by yourself. ")
|
||||
}
|
||||
|
||||
func (c *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {
|
||||
|
@ -44,7 +44,7 @@ func getNVMfDiskMounter(nvmfInfo *nvmfDiskInfo, req *csi.NodePublishVolumeReques
|
||||
mountOptions := req.GetVolumeCapability().GetMount().GetMountFlags()
|
||||
|
||||
return &nvmfDiskMounter{
|
||||
nvmfDiskInfo : nvmfInfo,
|
||||
nvmfDiskInfo: nvmfInfo,
|
||||
readOnly: readOnly,
|
||||
fsType: fsType,
|
||||
mountOptions: mountOptions,
|
||||
|
@ -40,7 +40,7 @@ func AttachDisk(req *csi.NodePublishVolumeRequest, nm nvmfDiskMounter) (string,
|
||||
return "", fmt.Errorf("Heuristic determination of mount point failed:%v", err)
|
||||
}
|
||||
if !notMounted {
|
||||
klog.Infof("AttachDisk: VolumeID: %s, Path: %s is already mounted, device: %s", req.VolumeId, nm.targetPath)
|
||||
klog.Infof("AttachDisk: VolumeID: %s, Path: %s is already mounted, device: %s", req.VolumeId, nm.targetPath, nm.DeviceUUID)
|
||||
return "", nil
|
||||
}
|
||||
|
||||
|
@ -79,6 +79,4 @@ func ReadLinesFromFile(file *os.File) (lines []string, err error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return lines, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user