Skip to content

Commit

Permalink
1.支持mounter和bucket自定义配置
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxu committed Apr 9, 2024
1 parent 04e418f commit 6fefda1
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 8 deletions.
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,63 @@
# S3 CSI Driver (Minio/Huawei cloud OBS/Amazon S3)

## Overview
The Mountpoint for S3 Container Storage Interface (CSI) Driver allows your Kubernetes applications to access S3 objects through a file system interface.

## Fatures
* **Static Provisioning** - Associate an existing S3 bucket with a [PersistentVolume](https://kubernetes.io/docs/concepts/storage/persistent-volumes/) (PV) for consumption within Kubernetes.
* **Mount Options** - Mount options can be specified in the PersistentVolume (PV) resource to define how the volume should be mounted. For Mountpoint-specific options

## Support S3 Server

|S3 Server Type|Supported|Remark|
|:--:|:--:|:--:|
|MinIO|Yes|No|
|Huawei Cloud OBS|Yes|No|
|Amazon S3|Yes|No|

## Support Mounter type

* **rclone** - [Rclone Github Link](https://github.com/rclone/rclone.git)
* **mountpoint-s3** [mountpoint-s3 Github Link](https://github.com/awslabs/mountpoint-s3-csi-driver.git)

## Container Images
| Driver Version | Image(Docker hub)|
|----------------|------------------|
| v1.2.0 | liuxuzxx/csi-s3:v1.2.0|

<summary>Previous Images</summary>

| Driver Version | Image(Docker hub) |
|----------------|-------------------|
| v1.1.0 | liuxuzxx/csi/s3:v1.1.0|

## Install

We support install use Helm

1. [Install Helm](https://helm.sh/docs/intro/install/)
2. Install csi-s3
```bash
linux> git clone https://github.com/liuxuzxx/csi-s3.git
linux> cd csi-s3/deploy/s3-csi
linux> helm install csi-s3 ./ -n xxx
```


## Self Build

```bash
linux> git clone https://github.com/liuxuzxx/csi-s3.git
linux> cd csi-s3/cmd/s3csi

#build image
linux> bash build-nopush.sh

#go build
linux> go build
```


# 概述
支持S3协议的K8S的CSI插件实现

Expand Down
2 changes: 1 addition & 1 deletion cmd/s3csi/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
tag="v1.1.0"
tag="release-v1.2.0.1"

go build

Expand Down
12 changes: 12 additions & 0 deletions deploy/s3-csi/templates/mounter-bucket-sc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: mounter-bucket-xw-sc
provisioner: minio.s3.csi.xw.com
parameters:
#目前支持两种类型: rclone,mountpoint-s3
mounter: mountpoint-s3
bucket: mounter-bucket-sc-dev
access-key: {{ .Values.minio.accessKey }}
secret-key: {{ .Values.minio.accessSecret }}
endpoint: {{ .Values.minio.url }}
2 changes: 1 addition & 1 deletion deploy/s3-csi/templates/storageclass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
provisioner: minio.s3.csi.xw.com
parameters:
#目前支持两种类型: rclone,mountpoint-s3
mounter: rclone
mounter: mount-s3
bucket: {{ .Values.minio.bucket }}
access-key: {{ .Values.minio.accessKey }}
secret-key: {{ .Values.minio.accessSecret }}
Expand Down
2 changes: 1 addition & 1 deletion deploy/s3-csi/values.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
global:
image: xwharbor.wxchina.com/cpaas-dev/component/csi-s3
tag: v1.1.0
tag: release-v1.2.0.1

minio:
url: 10.20.121.41:30629
Expand Down
2 changes: 1 addition & 1 deletion deploy/test/pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: test-s3-minio
namespace: minio
spec:
storageClassName: minio-csi-s3-xw
storageClassName: mounter-bucket-xw-sc
resources:
requests:
storage: 10Gi
Expand Down
7 changes: 3 additions & 4 deletions pkg/s3/mounter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package s3

import (
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/liuxuzxx/csi-s3/pkg/s3"
)

const (
Expand Down Expand Up @@ -32,10 +31,10 @@ func NewMounter(req *csi.NodePublishVolumeRequest) Mounter {
mounter := param[MounterType]
switch mounter {
case RcloneMounter:
return s3.NewRclone(req)
return NewRclone(req)
case MountpointS3Mounter:
return s3.NewMountpointS3(req)
return NewMountpointS3(req)
default:
return s3.NewRclone(req)
return NewRclone(req)
}
}

0 comments on commit 6fefda1

Please sign in to comment.