Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install blobfuse proxy on the host using dameonset #367

Merged
merged 2 commits into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 50 additions & 46 deletions deploy/blobfuse-proxy/blobfuse-proxy.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# This is to be used in e2e test, while for production, we suggest install this proxy as a standalone process
---
kind: DaemonSet
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: csi-blobfuse-proxy
namespace: kube-system
Expand All @@ -14,10 +13,6 @@ spec:
labels:
app: csi-blobfuse-proxy
spec:
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
nodeSelector:
kubernetes.io/os: linux
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
Expand All @@ -27,45 +22,54 @@ spec:
operator: NotIn
values:
- virtual-kubelet
containers:
- command:
- nsenter
- '--target'
- '1'
- '--mount'
- '--uts'
- '--ipc'
- '--net'
- '--pid'
- '--'
- sh
- '-c'
- |
set -xe
apt update
# update blobfuse version on the host to 1.3.6
wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
dpkg -i packages-microsoft-prod.deb
apt-get update
apt-get install -y blobfuse=1.3.6
# download blobfuse-proxy .deb package
wget https://github.com/boddumanohar/blob-csi-driver/raw/blobfuse-proxy-ds/deploy/blobfuse-proxy/v0.1.0/blobfuse-proxy-v0.1.0.deb -O /tmp/blobfuse-proxy-v0.1.0.deb
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls change this boddumanohar to kubernetes-sigs in another PR

dpkg -i /tmp/blobfuse-proxy-v0.1.0.deb
mkdir -p /var/lib/kubelet/plugins/blob.csi.azure.com
echo "Enabling blobfuse proxy systemctl service"
systemctl daemon-reload
systemctl enable blobfuse-proxy
systemctl stop blobfuse-proxy
systemctl start blobfuse-proxy
echo "removing the file: /tmp/blobfuse-proxy-v0.1.0.deb"
rm /tmp/blobfuse-proxy-v0.1.0.deb
echo "sleeping for 19 years"
sleep 600000000s
image: alpine
imagePullPolicy: IfNotPresent
name: sysctl-install-blobfuse-proxy
resources:
requests:
cpu: 10m
securityContext:
privileged: true
dnsPolicy: ClusterFirstWithHostNet
hostNetwork: true
hostPID: true
nodeSelector:
kubernetes.io/os: linux
priorityClassName: system-node-critical
restartPolicy: Always
tolerations:
- operator: "Exists"
containers:
- name: proxy
image: bmanu199/blobfuse-proxy@sha256:65659c9effa9df94c42a5f8388cef9656343c8fdd47a200ab69dc53913af7a42
imagePullPolicy: IfNotPresent
args:
- "--blobfuse-proxy-endpoint=$(BLOBFUSE_PROXY_ENDPOINT)"
env:
- name: BLOBFUSE_PROXY_ENDPOINT
value: unix://csi/blobfuse-proxy.sock
securityContext:
privileged: true
volumeMounts:
- mountPath: /csi
name: socket-dir
- mountPath: /var/lib/kubelet/
mountPropagation: Bidirectional
name: mountpoint-dir
- mountPath: /mnt
name: blob-cache
resources:
limits:
cpu: 2
memory: 2100Mi
requests:
cpu: 10m
memory: 20Mi
volumes:
- hostPath:
path: /var/lib/kubelet/plugins/blob.csi.azure.com
type: DirectoryOrCreate
name: socket-dir
- hostPath:
path: /var/lib/kubelet/
type: DirectoryOrCreate
name: mountpoint-dir
- hostPath:
path: /mnt
name: blob-cache
---
- operator: Exists
Binary file modified deploy/blobfuse-proxy/v0.1.0/blobfuse-proxy-v0.1.0.deb
Binary file not shown.
Binary file removed deploy/blobfuse-proxy/v0.1/blobfuse-proxy-v0.1.deb
Binary file not shown.
2 changes: 1 addition & 1 deletion pkg/blob/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func (d *Driver) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolu
klog.V(2).Infof("NodeUnstageVolume: volume %s unmounting on %s", volumeID, stagingTargetPath)
err := mount.CleanupMountPoint(stagingTargetPath, d.mounter, false)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to unmount staing target %q: %v", stagingTargetPath, err)
return nil, status.Errorf(codes.Internal, "failed to unmount staging target %q: %v", stagingTargetPath, err)
}
klog.V(2).Infof("NodeUnstageVolume: volume %s unmount on %s successfully", volumeID, stagingTargetPath)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Description=Blobfuse proxy service

[Service]
ExecStart=/usr/bin/blobfuse-proxy -blobfuse-proxy-endpoint=unix://var/lib/kubelet/blobfuse-proxy.sock
ExecStart=/usr/bin/blobfuse-proxy --v=5 --blobfuse-proxy-endpoint=unix://var/lib/kubelet/plugins/blob.csi.azure.com/blobfuse-proxy.sock

[Install]
WantedBy=multi-user.target
6 changes: 3 additions & 3 deletions pkg/blobfuse-proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package main

import (
"flag"
"log"
"net"
"os"

Expand All @@ -37,6 +36,7 @@ var (
)

func main() {
klog.InitFlags(nil)
flag.Parse()
proto, addr, err := csicommon.ParseEndpoint(*blobfuseProxyEndpoint)
if err != nil {
Expand All @@ -57,8 +57,8 @@ func main() {

mountServer := server.NewMountServiceServer()

log.Printf("Listening for connections on address: %#v\n", listener.Addr())
klog.V(2).Info("Listening for connections on address: %v\n", listener.Addr())
if err = server.RunGRPCServer(mountServer, false, listener); err != nil {
klog.Fatalf("Listening for connections on address: %#v, error: %v", listener.Addr(), err)
klog.Fatalf("Error running grpc server. Error: %v", listener.Addr(), err)
}
}
1 change: 1 addition & 0 deletions pkg/blobfuse-proxy/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func (server *MountServer) MountAzureBlob(ctx context.Context,
klog.V(2).Infof("successfully mounted")
}
result.Output = string(output)
klog.V(2).Infof("blobfuse output: %s\n", result.Output)
return &result, err
}

Expand Down
9 changes: 9 additions & 0 deletions test/utils/blob_log.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,12 @@ echo "print out cloudprovider_azure metrics ..."
echo "======================================================================================"
ip=`kubectl get svc csi-blob-controller -n kube-system | grep blob | awk '{print $4}'`
curl http://$ip:29634/metrics


echo "print out sysctl-install-blobfuseproxy logs ..."
echo "======================================================================================"
LABEL='app=csi-blobfuse-proxy'
PROXY=sysctl-install-blobfuse-proxy
kubectl get pods -n${NS} -l${LABEL} \
| awk 'NR>1 {print $1}' \
| xargs -I {} kubectl logs {} --prefix -c${PROXY} -n${NS}