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

support more volume and instance type #139

Merged
merged 1 commit into from
Oct 17, 2019
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
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ QingCloud CSI plugin implements an interface between Container Storage Interface

Disk plugin's design and installation use Kubernetes community recommended CSI plugin [architecture](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/storage/container-storage-interface.md#recommended-mechanism-for-deploying-csi-drivers-on-kubernetes). Plugin architecture contains Controller part and Node part. In the part of Controller, one Pod is created by Deployment in Kubernetes cluster. In the part of Node, one Pod is created by DaemonSet on every node. Now, it has been passed the [CSI test](https://github.com/kubernetes-csi/csi-test) in Kubernetes v1.15 environment.

After plugin installation completes, user can create volumes based on several types of disk, such as Standard disk, SSD Enterprise disk, High Performance disk, Super High Performance disk, NeonSAN disk and High Capacity disk, with ReadWriteOnce access mode and mount volumes on workloads.
After plugin installation completes, user can create volumes based on several types of disk, such as Standard disk, SSD Enterprise disk, High Performance disk, Super High Performance disk, NeonSAN disk, NeonSAN HDD disk and High Capacity disk, with ReadWriteOnce access mode and mount volumes on workloads.

### Kubernetes Compatibility Matrix

Expand Down Expand Up @@ -57,7 +57,7 @@ This guide will install CSI plugin in the *kube-system* namespace of Kubernetes
- Enable `--read-only-port=10255` on kubelet
- Download installation file
```
$ wget https://raw.githubusercontent.com/yunify/qingcloud-csi/master/deploy/disk/kubernetes/releases/qingcloud-csi-disk-v1.1.0-rc.2.yaml
$ wget https://raw.githubusercontent.com/yunify/qingcloud-csi/master/deploy/disk/kubernetes/releases/qingcloud-csi-disk-v1.1.0-rc.3.yaml
```
- Add QingCloud platform parameter on ConfigMap
QingCloud CSI plugin manipulates cloud resource by QingCloud platform API. User must test the connection between QingCloud platform API and user's own instance by and check QingCloud platform configuration by [QingCloud CLI](https://docs.qingcloud.com/product/cli/).
Expand All @@ -83,7 +83,7 @@ QingCloud CSI plugin manipulates cloud resource by QingCloud platform API. User
> IMPORTANT: If kubelet, a component of Kubernetes, set the `--root-dir` option (default: *"/var/lib/kubelet"*), please replace *"/var/lib/kubelet"* with the value of `--root-dir` at the CSI [DaemonSet](deploy/disk/kubernetes/csi-node-ds.yaml) YAML file's `spec.template.spec.containers[name=csi-qingcloud].volumeMounts[name=mount-dir].mountPath` and `spec.template.spec.volumes[name=mount-dir].hostPath.path` fields. For instance, in Kubernetes cluster based on QingCloud AppCenter, you should replace *"/var/lib/kubelet"* with *"/data/var/lib/kubelet"* in the CSI [DaemonSet](deploy/disk/kubernetes/csi-node-ds.yaml) YAML file.

```
$ kubectl apply -f qingcloud-csi-disk-v1.1.0-rc.2.yaml
$ kubectl apply -f qingcloud-csi-disk-v1.1.0-rc.3.yaml
```

- Check CSI plugin
Expand All @@ -99,7 +99,7 @@ $ kubectl get pods -n kube-system --selector=app=csi-qingcloud

### Uninstall
```
$ kubectl delete -f qingcloud-csi-disk-v1.1.0-rc.2.yaml
$ kubectl delete -f qingcloud-csi-disk-v1.1.0-rc.3.yaml
```

### StorageClass Parameters
Expand All @@ -122,7 +122,7 @@ parameters:
reclaimPolicy: Delete
```

- `type`: The type of volume in QingCloud IaaS platform. In QingCloud public cloud platform, `0` represents high performance volume. `3` respresents super high performance volume. `2` represents high capacity volume depending on cluster‘s zone. `5` represents enterprise distributed SAN (NeonSAN) volume. `100` represents standard volume. `200` represents SSD enterprise volume. See [QingCloud docs](https://docs.qingcloud.com/product/api/action/volume/create_volumes.html) for details.
- `type`: The type of volume in QingCloud IaaS platform. In QingCloud public cloud platform, `0` represents high performance volume. `3` respresents super high performance volume. `2` represents high capacity volume depending on cluster‘s zone. `5` represents enterprise distributed SAN (NeonSAN) volume. `6` represents NeonSAN HDD volume. `100` represents standard volume. `200` represents SSD enterprise volume. See [QingCloud docs](https://docs.qingcloud.com/product/api/action/volume/create_volumes.html) for details.

- `maxSize`, `minSize`: Limit the range of volume size in GiB.

Expand Down
10 changes: 5 additions & 5 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ QingCloud CSI 插件实现了 [CSI](https://github.com/container-storage-interfa

插件的设计和安装使用 Kubernetes 社区推荐的 CSI 插件[架构](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/storage/container-storage-interface.md#recommended-mechanism-for-deploying-csi-drivers-on-kubernetes),插件架构包含 Controller 和 Node 两部分,在 Controller 部分,由 Deployment 在 Kubernetes 集群内创建一个 Pod 副本。在 Node 部分,每个可调度的节点由 DaemonSet 创建一个 Pod 副本。插件已经在 Kubernetes v1.15 环境中通过了 [CSI 测试](https://github.com/kubernetes-csi/csi-test)。

块存储插件部署后, 用户可创建访问模式(Access Mode)为单节点读写(ReadWriteOnce)的基于 QingCloud 的基础型、SSD 企业型、性能型、超高性能型、超高性能容量型(NeonSAN)、容量型硬盘的存储卷并挂载至工作负载。
块存储插件部署后, 用户可创建访问模式(Access Mode)为单节点读写(ReadWriteOnce)的基于 QingCloud 的基础型、SSD 企业型、性能型、超高性能型、超高性能容量型(NeonSAN)、NeonSAN HDD 型、容量型硬盘的存储卷并挂载至工作负载。

### Kubernetes 适配性

Expand Down Expand Up @@ -58,7 +58,7 @@ QingCloud CSI 插件实现了 [CSI](https://github.com/container-storage-interfa

- 下载安装文件并解压
```
$ wget https://raw.githubusercontent.com/yunify/qingcloud-csi/master/deploy/disk/kubernetes/releases/qingcloud-csi-disk-v1.1.0-rc.2.yaml
$ wget https://raw.githubusercontent.com/yunify/qingcloud-csi/master/deploy/disk/kubernetes/releases/qingcloud-csi-disk-v1.1.0-rc.3.yaml
```

- 修改 QingCloud 云平台配置参数
Expand Down Expand Up @@ -86,8 +86,8 @@ $ wget https://raw.githubusercontent.com/yunify/qingcloud-csi/master/deploy/disk
> 注: 如果 Kubernetes 集群的 [kubelet](https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/) 设置了 `--root-dir` 选项(默认值为 *"/var/lib/kubelet"*),请将 DaemonSet 的 `spec.template.spec.containers[name=csi-qingcloud].volumeMounts[name=mount-dir].mountPath` 和 `spec.template.spec.volumes[name=mount-dir].hostPath.path` 的值 *"/var/lib/kubelet"* 替换为 `--root-dir` 选项的值。例如:在通过 QingCloud AppCenter 创建的 Kubernetes 集群内, 需要将 DaemonSet 的 *"/var/lib/kubelet"* 字段替换为 *"/data/var/lib/kubelet"*。

```
$ kubectl apply -f qingcloud-csi-disk-v1.1.0-rc.2.yaml
```
$ kubectl apply -f qingcloud-csi-disk-v1.1.0-rc.3.yaml
```

- 检查 CSI 插件状态
```
Expand All @@ -103,7 +103,7 @@ $ kubectl get pods -n kube-system --selector=app=csi-qingcloud
### 卸载

```
$ kubectl delete -f qingcloud-csi-disk-v1.1.0-rc.2.yaml
$ kubectl delete -f qingcloud-csi-disk-v1.1.0-rc.3.yaml
```

### 使用文档
Expand Down
32 changes: 20 additions & 12 deletions docs/user-guide-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,13 @@ volumeBindingMode: Immediate

|硬盘类型|type|maxSize|minSize|stepSize|
|:---:|:---:|:---:|:---:|:---:|
|性能型|0|1000|10|10|
|性能型|0|2000|10|10|
|容量型|2|5000|100|50|
|超高性能型|3|1000|10|10|
| NeonSAN|5|5000|100|100|
|超高性能型|3|2000|10|10|
| NeonSAN|5|50000|100|100|
|NeonSAN HDD|5|50000|100|100|
| 基础型|100|2000|10|10|
| SSD 企业型|200| 2000|10|10|
| SSD 企业型|2000| 2000|10|10|

#### fsType
支持 `ext3`, `ext4`, `xfs`. 默认为 `ext4`。
Expand Down Expand Up @@ -127,6 +128,7 @@ volumeBindingMode: Immediate
|容量型| High Capacity|2|
|超高性能型|Super High Performance|3|
|NeonSAN| NeonSAN|5|
|NeonSAN HDD|NeonSAN HDD|6|
|基础型| Standard|100|
|SSD 企业型| SSD Enterprise|200|

Expand All @@ -135,19 +137,25 @@ volumeBindingMode: Immediate
|:---:|:----:|:----:|
|性能型|High Performance|0|
|超高性能型|Super High Performance|1|
|SAN存储超高性能型|Super High Performance SAN|6|
|SAN存储性能型|High Performance SAN|7|
|基础型|Standard|101|
|企业型|Enterprise|201|
|企业型e1|Enterprise1|201|
|企业型e2|Enterprise2|202|
|专业增强型|Premium|301|

### 硬盘类型与主机适配性

| | 性能型硬盘 | 容量型硬盘 | 超高性能型硬盘 | NeonSAN 硬盘 |基础型硬盘| SSD 企业型硬盘|
|-----------|------------------|------------------|-----------------|---------|----------|-------|
|性能型主机| ✓ | ✓ | - | ✓ | ✓ | - |
|超高性能型主机| - | ✓ | ✓ |✓ |- |✓ |
|基础型主机| ✓ | ✓ | - |✓ |✓ |- |
|企业型主机| - | ✓ | ✓ |✓ |- |✓ |
|专业增强型| - | ✓ | ✓ |✓ |- |✓ |
| | 性能型硬盘 | 容量型硬盘 | 超高性能型硬盘 | NeonSAN 硬盘 | NeonSAN HDD 硬盘 | 基础型硬盘| SSD 企业型硬盘|
|-----------|------------------|------------------|-----------------|---------|----------|-------|-------|
|性能型主机| ✓ | ✓ | - | ✓ | ✓ | ✓ | - |
|超高性能型主机| - | ✓ | ✓ |✓ |✓ |- |✓ |
|SAN存储超高性能型| - | - | - |✓ |- |- |- |
|SAN存储性能型| - | - | - |- |✓ |- |- |
|基础型主机| ✓ | ✓ | - |✓ |✓ |✓ |- |
|企业型e1主机| - | ✓ | ✓ |✓ |✓ |- |✓ |
|企业型e1主机| - | ✓ | ✓ |✓ |✓ |- |✓ |
|专业增强型| - | ✓ | ✓ |✓ |✓ |- |✓ |

## 存储卷管理
存储卷(PVC,PersistentVolumeClaim)管理功能包括动态分配存储卷,删除存储卷,挂载存储卷到 Pod,从 Pod 卸载存储卷。用户可参考[示例 YAML 文件](https://github.com/yunify/qingcloud-csi/tree/master/deploy/disk/example/volume)。
Expand Down
85 changes: 57 additions & 28 deletions pkg/disk/driver/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ const (
HighPerformanceVolumeType VolumeType = 0
HighCapacityVolumeType VolumeType = 2
SuperHighPerformanceVolumeType VolumeType = 3
NeonSANVolumeType VolumeType = 5
NeonSANHDDVolumeType VolumeType = 6
StandardVolumeType VolumeType = 100
SSDEnterpriseVolumeType VolumeType = 200
NeonSANVolumeType VolumeType = 5
)

type VolumeType int
Expand Down Expand Up @@ -105,45 +106,50 @@ var VolumeTypeName = map[VolumeType]string{
0: "HighPerformance",
2: "HighCapacity",
3: "SuperHighPerformance",
5: "NeonSAN",
6: "NeonSANHDD",
100: "Standard",
200: "SSDEnterprise",
5: "NeonSAN",
}

var VolumeTypeValue = map[string]VolumeType{
"HighPerformance": 0,
"HighCapacity": 2,
"SuperHighPerformance": 3,
"NeonSAN": 5,
"NeonSANHDD": 6,
"Standard": 100,
"SSDEnterprise": 200,
"NeonSAN": 5,
}

var VolumeTypeToStepSize = map[VolumeType]int{
0: 10,
2: 50,
3: 10,
5: 100,
6: 100,
100: 10,
200: 10,
5: 100,
}

var VolumeTypeToMinSize = map[VolumeType]int{
0: 10,
2: 100,
3: 10,
5: 100,
6: 100,
100: 10,
200: 10,
5: 100,
}

var VolumeTypeToMaxSize = map[VolumeType]int{
0: 2000,
2: 5000,
3: 2000,
5: 50000,
6: 50000,
100: 2000,
200: 2000,
5: 50000,
}

type InstanceType int
Expand All @@ -161,60 +167,83 @@ func (i InstanceType) IsValid() bool {
}

const (
HighPerformanceInstanceType InstanceType = 0
SuperHighPerformanceInstanceType InstanceType = 1
StandardInstanceType InstanceType = 101
EnterpriseInstanceType InstanceType = 201
PremiumInstanceType InstanceType = 301
HighPerformanceInstanceType InstanceType = 0
SuperHighPerformanceInstanceType InstanceType = 1
SuperHighPreformanceSANInstanceType InstanceType = 6
HighPerformanceSANInstanceType InstanceType = 7
StandardInstanceType InstanceType = 101
Enterprise1InstanceType InstanceType = 201
Enterprise2InstanceType InstanceType = 202
PremiumInstanceType InstanceType = 301
)

var InstanceTypeName = map[InstanceType]string{
0: "HighPerformance",
1: "SuperHighPerformance",
6: "SuperHighPerformanceSAN",
7: "HighPerformanceSAN",
101: "Standard",
201: "Enterprise",
201: "Enterprise1",
202: "Enterprise2",
301: "Premium",
}

var InstanceTypeValue = map[string]InstanceType{
"HighPerformance": 0,
"SuperHighPerformance": 1,
"Standard": 101,
"Enterprise": 201,
"Premium": 301,
"HighPerformance": 0,
"SuperHighPerformance": 1,
"SuperHighPerformanceSAN": 6,
"HighPerformanceSAN": 7,
"Standard": 101,
"Enterprise1": 201,
"Enterprise2": 202,
"Premium": 301,
}

var VolumeTypeAttachConstraint = map[VolumeType][]InstanceType{
HighPerformanceVolumeType: {
HighPerformanceInstanceType,
StandardInstanceType,
},
HighCapacityVolumeType: {
HighPerformanceInstanceType,
SuperHighPerformanceInstanceType,
StandardInstanceType,
Enterprise1InstanceType,
Enterprise2InstanceType,
PremiumInstanceType,
},
SuperHighPerformanceVolumeType: {
SuperHighPerformanceInstanceType,
EnterpriseInstanceType,
Enterprise1InstanceType,
Enterprise2InstanceType,
PremiumInstanceType,
},
HighCapacityVolumeType: {
NeonSANVolumeType: {
HighPerformanceInstanceType,
SuperHighPerformanceInstanceType,
SuperHighPreformanceSANInstanceType,
StandardInstanceType,
EnterpriseInstanceType,
Enterprise1InstanceType,
Enterprise2InstanceType,
PremiumInstanceType,
},
StandardVolumeType: {
NeonSANHDDVolumeType: {
HighPerformanceInstanceType,
StandardInstanceType,
},
SSDEnterpriseVolumeType: {
SuperHighPerformanceInstanceType,
EnterpriseInstanceType,
HighPerformanceSANInstanceType,
StandardInstanceType,
Enterprise1InstanceType,
Enterprise2InstanceType,
PremiumInstanceType,
},
NeonSANVolumeType: {
StandardVolumeType: {
HighPerformanceInstanceType,
SuperHighPerformanceInstanceType,
StandardInstanceType,
EnterpriseInstanceType,
},
SSDEnterpriseVolumeType: {
SuperHighPerformanceInstanceType,
Enterprise1InstanceType,
Enterprise2InstanceType,
PremiumInstanceType,
},
}
Expand Down
Loading