Skip to content

Commit 7241cc7

Browse files
authored
Merge pull request #356 from boddumanohar/blobfuse-proxy-code
feat: blobfuse proxy
2 parents 8949099 + eead4e7 commit 7241cc7

File tree

118 files changed

+9313
-3558
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+9313
-3558
lines changed

.github/workflows/linux.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ jobs:
2121
- name: Run unit test
2222
run: |
2323
export PATH=$PATH:$HOME/.local/bin
24+
wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
25+
sudo dpkg -i packages-microsoft-prod.deb
26+
sudo apt-get update
27+
sudo apt-get install blobfuse
2428
make verify
2529
2630
- name: Run build test
@@ -33,6 +37,11 @@ jobs:
3337
export PATH=$PATH:$HOME/.local/bin
3438
make container
3539
40+
- name: Make blobfuse-proxy test
41+
run: |
42+
export PATH=$PATH:$HOME/.local/bin
43+
make blobfuse-proxy
44+
3645
- name: Get code coverage
3746
env:
3847
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Makefile

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ e2e-test:
6363
go test -v -timeout=0 ./test/e2e ${GINKGO_FLAGS}
6464

6565
.PHONY: e2e-bootstrap
66-
e2e-bootstrap: install-helm
66+
e2e-bootstrap: install-helm install-blobfuse-proxy
6767
# Only build and push the image if it does not exist in the registry
6868
docker pull $(IMAGE_TAG) || make blob-container push
6969
helm install blob-csi-driver ./charts/latest/blob-csi-driver --namespace kube-system --wait --timeout=15m -v=5 --debug \
@@ -94,7 +94,7 @@ blob-darwin:
9494

9595
.PHONY: container
9696
container: blob
97-
docker build --no-cache -t $(IMAGE_TAG) -f ./pkg/blobplugin/dev.Dockerfile .
97+
docker build -t $(IMAGE_TAG) -f ./pkg/blobplugin/dev.Dockerfile .
9898

9999
.PHONY: blob-container
100100
blob-container:
@@ -147,3 +147,33 @@ create-metrics-svc:
147147
.PHONY: delete-metrics-svc
148148
delete-metrics-svc:
149149
kubectl delete -f deploy/example/metrics/csi-blob-controller-svc.yaml --ignore-not-found
150+
151+
# compile .proto file to go output
152+
.PHONY: gen-proto
153+
gen-proto:
154+
protoc --proto_path=pkg/blobfuse-proxy/proto --go-grpc_out=pkg/blobfuse-proxy/pb --go_out=pkg/blobfuse-proxy/pb pkg/blobfuse-proxy/proto/*.proto
155+
156+
# clean the files generated from .proto file
157+
.PHONY: clean-proto
158+
clean-proto:
159+
rm pkg/blobfuse-proxy/pb/*.go
160+
161+
.PHONY: blobfuse-proxy
162+
blobfuse-proxy:
163+
CGO_ENABLED=0 GOOS=linux go build -mod vendor -o _output/blobfuse-proxy ./pkg/blobfuse-proxy
164+
165+
.PHONY: blobfuse-proxy-container
166+
blobfuse-proxy-container:
167+
sudo docker build -t blobfuse-proxy -f pkg/blobfuse-proxy/Dockerfile .
168+
169+
.PHONY: install-blobfuse-proxy
170+
install-blobfuse-proxy:
171+
ifdef ENABLE_BLOBFUSE_PROXY
172+
kubectl apply -f ./deploy/blobfuse-proxy/blobfuse-proxy.yaml
173+
else
174+
echo "ENABLE_BLOBFUSE_PROXY env not found"
175+
endif
176+
177+
.PHONY: uninstall-blobfuse-proxy
178+
uninstall-blobfuse-proxy:
179+
kubectl delete -f ./deploy/blobfuse-proxy/blobfuse-proxy.yaml --ignore-not-found
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# This is to be used in e2e test, while for production, we suggest install this proxy as a standalone process
2+
---
3+
kind: DaemonSet
4+
apiVersion: apps/v1
5+
metadata:
6+
name: csi-blobfuse-proxy
7+
namespace: kube-system
8+
spec:
9+
selector:
10+
matchLabels:
11+
app: csi-blobfuse-proxy
12+
template:
13+
metadata:
14+
labels:
15+
app: csi-blobfuse-proxy
16+
spec:
17+
hostNetwork: true
18+
dnsPolicy: ClusterFirstWithHostNet
19+
nodeSelector:
20+
kubernetes.io/os: linux
21+
affinity:
22+
nodeAffinity:
23+
requiredDuringSchedulingIgnoredDuringExecution:
24+
nodeSelectorTerms:
25+
- matchExpressions:
26+
- key: type
27+
operator: NotIn
28+
values:
29+
- virtual-kubelet
30+
priorityClassName: system-node-critical
31+
tolerations:
32+
- operator: "Exists"
33+
containers:
34+
- name: proxy
35+
image: bmanu199/blobfuse-proxy@sha256:65659c9effa9df94c42a5f8388cef9656343c8fdd47a200ab69dc53913af7a42
36+
imagePullPolicy: IfNotPresent
37+
args:
38+
- "--blobfuse-proxy-endpoint=$(BLOBFUSE_PROXY_ENDPOINT)"
39+
env:
40+
- name: BLOBFUSE_PROXY_ENDPOINT
41+
value: unix://csi/blobfuse-proxy.sock
42+
securityContext:
43+
privileged: true
44+
volumeMounts:
45+
- mountPath: /csi
46+
name: socket-dir
47+
- mountPath: /var/lib/kubelet/
48+
mountPropagation: Bidirectional
49+
name: mountpoint-dir
50+
- mountPath: /mnt
51+
name: blob-cache
52+
resources:
53+
limits:
54+
cpu: 2
55+
memory: 2100Mi
56+
requests:
57+
cpu: 10m
58+
memory: 20Mi
59+
volumes:
60+
- hostPath:
61+
path: /var/lib/kubelet/plugins/blob.csi.azure.com
62+
type: DirectoryOrCreate
63+
name: socket-dir
64+
- hostPath:
65+
path: /var/lib/kubelet/
66+
type: DirectoryOrCreate
67+
name: mountpoint-dir
68+
- hostPath:
69+
path: /mnt
70+
name: blob-cache
71+
---

go.mod

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ require (
1010
github.com/golang/mock v1.4.3
1111
github.com/golang/protobuf v1.4.3
1212
github.com/imdario/mergo v0.3.9 // indirect
13-
github.com/kubernetes-csi/csi-lib-utils v0.7.0
13+
github.com/kubernetes-csi/csi-lib-utils v0.9.1
1414
github.com/onsi/ginkgo v1.11.0
1515
github.com/onsi/gomega v1.8.1
1616
github.com/pborman/uuid v1.2.0
1717
github.com/pelletier/go-toml v1.2.0
18-
github.com/stretchr/testify v1.6.1
18+
github.com/stretchr/testify v1.7.0
1919
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b
20-
google.golang.org/grpc v1.28.0
20+
google.golang.org/grpc v1.36.0
21+
google.golang.org/protobuf v1.25.0
2122
k8s.io/api v0.20.0
2223
k8s.io/apimachinery v0.20.0
2324
k8s.io/client-go v0.20.0
@@ -33,7 +34,7 @@ replace (
3334
github.com/container-storage-interface/spec => github.com/container-storage-interface/spec v1.3.0
3435
github.com/prometheus/client_golang => github.com/prometheus/client_golang v1.7.1
3536
go.etcd.io/etcd => go.etcd.io/etcd v0.0.0-20200410171415-59f5fb25a533
36-
google.golang.org/grpc => google.golang.org/grpc v1.27.0
37+
google.golang.org/grpc => google.golang.org/grpc v1.35.0
3738
k8s.io/api => k8s.io/api v0.20.0
3839
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.20.0
3940
k8s.io/apimachinery => k8s.io/apimachinery v0.20.0

0 commit comments

Comments
 (0)