Skip to content

Commit b698016

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents 65e4e24 + 7e0bf83 commit b698016

File tree

20 files changed

+1814
-4
lines changed

20 files changed

+1814
-4
lines changed

Makefile

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
.PHONY: format build cargo docker-build
2+
3+
# Detect system type and set shell accordingly
4+
SYSTEM_TYPE := $(shell uname -s)
5+
IS_UBUNTU := $(shell grep -q -i ubuntu /etc/os-release 2>/dev/null && echo 1 || echo 0)
6+
7+
# Set shell command based on system type
8+
SHELL_CMD := sh
9+
ifeq ($(IS_UBUNTU),1)
10+
# Ubuntu system - use bash
11+
SHELL_CMD := bash
12+
endif
13+
14+
# 1. Format the project
15+
format:
16+
$(SHELL_CMD) build/pre-commit.sh
17+
18+
# 2. Build and package the project (depends on format)
19+
build: format
20+
$(SHELL_CMD) build/build.sh
21+
22+
# 3. Other modules through cargo command
23+
cargo:
24+
cargo $(ARGS)
25+
26+
# 4. Build compilation image under curvine-docker
27+
docker-build:
28+
docker build -t curvine-build -f curvine-docker/deploy/Dockerfile.build curvine-docker
29+
30+
MODE ?= debug
31+
32+
CARGO_FLAGS :=
33+
ifeq ($(MODE),release)
34+
CARGO_FLAGS := --release
35+
endif
36+
37+
# Build curvine-fuse
38+
fuse:
39+
cargo build -p curvine-fuse $(CARGO_FLAGS)
40+
41+
# Build curvine-server
42+
server:
43+
cargo build -p curvine-server $(CARGO_FLAGS)
44+
45+
# Build curvine-cli
46+
cli:
47+
cargo build -p curvine-cli $(CARGO_FLAGS)
48+
49+
# Build curvine-ufs
50+
ufs:
51+
cargo build -p curvine-ufs $(CARGO_FLAGS)
52+
53+
# 5. All in one
54+
all: build

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ You can either:
137137

138138
```bash
139139
# Compiled files are in build/dist
140-
sh build/build.sh
140+
make all
141141
```
142142

143143
After successful compilation, target file will be generated in the build/dist directory. This file is the Curvine installation package that can be used for deployment or building images.

SECURITY.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
Use this section to tell people about which versions of your project are
6+
currently being supported with security updates.
7+
8+
| Version | Supported |
9+
| ------- | ------------------ |
10+
| 0.1.x | :white_check_mark: |
11+
12+
## Reporting a Vulnerability
13+
14+
Use this section to tell people how to report a vulnerability.
15+
16+
Tell them where to go, how often they can expect to get an update on a
17+
reported vulnerability, what to expect if the vulnerability is accepted or
18+
declined, etc.

curvine-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ num-bigint = { workspace = true }
1717
bigdecimal = { workspace = true }
1818
chrono = { workspace = true }
1919
bytes = { workspace = true }
20-
reqwest = { version = "0.11", features = ["json"] }
20+
reqwest = { version = "0.11", features = ["json", "rustls-tls"], default-features = false}

curvine-csi/.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
bin/
8+
9+
# Test binary, build with ` + "`go test -c`" + `
10+
*.test
11+
12+
# Output of the go coverage tool, specifically when used with LiteIDE
13+
*.out
14+
15+
# editor and IDE paraphernalia
16+
.idea
17+
*.swp
18+
*.swo
19+
*~
20+
curvine/
21+
deploy/
22+
test/
23+
examples/

curvine-csi/Dockerfile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
FROM ubuntu:24.04
2+
3+
ARG GOPROXY
4+
5+
# 更换为清华大学TUNA镜像源并安装Go和FUSE3运行时依赖
6+
RUN sed -i 's/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list && \
7+
sed -i 's/security.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list && \
8+
apt-get update && apt-get install -y \
9+
wget \
10+
tar \
11+
make \
12+
build-essential \
13+
fuse3 \
14+
libfuse3-3 \
15+
ca-certificates \
16+
&& rm -rf /var/lib/apt/lists/*
17+
18+
# 安装Go 1.23
19+
RUN wget -O go1.23.linux-amd64.tar.gz https://go.dev/dl/go1.23.4.linux-amd64.tar.gz && \
20+
tar -C /usr/local -xzf go1.23.linux-amd64.tar.gz && \
21+
rm go1.23.linux-amd64.tar.gz
22+
23+
# 设置Go环境变量
24+
ENV PATH=/usr/local/go/bin:$PATH
25+
ENV GOPATH=/go
26+
ENV GOROOT=/usr/local/go
27+
28+
WORKDIR /curvine
29+
COPY . .
30+
ENV GOPROXY=${GOPROXY:-https://proxy.golang.org}
31+
32+
RUN make build && \
33+
mkdir -p /opt/curvine/bin && \
34+
mkdir -p /opt/curvine/conf && \
35+
cp -r curvine/bin/* /opt/curvine/bin && \
36+
cp -r curvine/conf/* /opt/curvine/conf && \
37+
cp bin/csi /opt/curvine/bin/ && \
38+
chmod u+x /opt/curvine/bin/csi && \
39+
chmod u+x /opt/curvine/bin/cv && \
40+
chmod u+x /opt/curvine/bin/curvine-fuse
41+
42+
WORKDIR /opt/curvine
43+
#ENTRYPOINT ["/opt/curvine/bin/csi"]

curvine-csi/Makefile

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// Copyright 2025 OPPO.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
# Image URL to use all building/pushing image targets
16+
IMG ?= curvine-csi:latest
17+
18+
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
19+
ifeq (,$(shell go env GOBIN))
20+
GOBIN=$(shell go env GOPATH)/bin
21+
else
22+
GOBIN=$(shell go env GOBIN)
23+
endif
24+
25+
# Setting SHELL to bash allows bash commands to be executed by recipes.
26+
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
27+
SHELL = /usr/bin/env bash -o pipefail
28+
.SHELLFLAGS = -ec
29+
30+
.PHONY: all
31+
all: build
32+
33+
##@ General
34+
35+
.PHONY: help
36+
help: ## Display this help.
37+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
38+
39+
.PHONY: fmt
40+
fmt: ## Run go fmt against code.
41+
go fmt ./...
42+
43+
.PHONY: vet
44+
vet: ## Run go vet against code.
45+
go vet ./...
46+
47+
##@ Build
48+
49+
.PHONY: build
50+
build: fmt vet ## Build manager binary.
51+
go build -o bin/csi main.go
52+
53+
.PHONY: run
54+
run: fmt vet ## Run a csi driver from your host.
55+
go run ./main.go
56+
57+
.PHONY: docker-build
58+
docker-build: ## Build docker image with the manager.
59+
docker build --build-arg GOPROXY=https://goproxy.cn,direct -t ${IMG} .
60+
61+
.PHONY: docker-push
62+
docker-push: ## Push docker image with the manager.
63+
docker push ${IMG}
64+
65+
.PHONY: docker
66+
docker: ## Build and push docker image with the manager.
67+
docker build --build-arg GOPROXY=https://goproxy.cn,direct -t ${IMG} .
68+
docker push ${IMG}
69+
70+
.PHONY: docker-fast
71+
docker-fast: ## Build docker image quickly (skip push).
72+
docker build --build-arg GOPROXY=https://goproxy.cn,direct -t ${IMG} .

curvine-csi/PROJECT

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version:
2+
number: 1
3+
stage: 0
4+
goversion: ""
5+
name: ""
6+
repo: github.com/curvineio/curvine-csi
7+
goversion: "1.18"

curvine-csi/go.mod

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
module github.com/curvineio/curvine-csi
2+
3+
go 1.22.0
4+
5+
require (
6+
github.com/container-storage-interface/spec v1.11.0
7+
google.golang.org/grpc v1.60.1
8+
k8s.io/klog v1.0.0
9+
)
10+
11+
require (
12+
github.com/golang/protobuf v1.5.3 // indirect
13+
golang.org/x/net v0.38.0 // indirect
14+
golang.org/x/sys v0.31.0 // indirect
15+
golang.org/x/text v0.23.0 // indirect
16+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463 // indirect
17+
google.golang.org/protobuf v1.36.6 // indirect
18+
)
19+
20+
replace google.golang.org/grpc v1.73.0 => google.golang.org/grpc v1.60.1
21+
22+
replace golang.org/x/net v0.38.0 => golang.org/x/net v0.20.0
23+
24+
replace golang.org/x/sys v0.31.0 => golang.org/x/sys v0.16.0
25+
26+
replace golang.org/x/text v0.23.0 => golang.org/x/text v0.14.0
27+
28+
replace google.golang.org/protobuf v1.36.6 => google.golang.org/protobuf v1.31.0
29+
30+
replace google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463 => google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f
31+
32+
replace github.com/container-storage-interface/spec v1.11.0 => github.com/container-storage-interface/spec v1.8.0

curvine-csi/go.sum

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
github.com/container-storage-interface/spec v1.8.0 h1:D0vhF3PLIZwlwZEf2eNbpujGCNwspwTYf2idJRJx4xI=
2+
github.com/container-storage-interface/spec v1.8.0/go.mod h1:ROLik+GhPslwwWRNFF1KasPzroNARibH2rfz1rkg4H0=
3+
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
4+
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
5+
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
6+
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
7+
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
8+
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
9+
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
10+
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
11+
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
12+
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
13+
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
14+
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
15+
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
16+
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
17+
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f h1:ultW7fxlIvee4HYrtnaRPon9HpEgFk5zYpmfMgtKB5I=
18+
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f/go.mod h1:L9KNLi232K1/xB6f7AlSX692koaRnKaWSR0stBki0Yc=
19+
google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU=
20+
google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM=
21+
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
22+
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
23+
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
24+
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
25+
k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8=
26+
k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=

0 commit comments

Comments
 (0)