Skip to content

Commit

Permalink
Switch to new Scaleway block API
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomy2e committed Oct 16, 2023
1 parent 745ae14 commit cce9f72
Show file tree
Hide file tree
Showing 56 changed files with 4,877 additions and 11,929 deletions.
18 changes: 18 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
linters:
enable:
- dupl
- errname
- ginkgolinter
- goconst
- godox
- gosec
- nilerr
- prealloc
- reassign
- tparallel
- wrapcheck

linters-settings:
wrapcheck:
ignorePackageGlobs:
- google.golang.org/grpc/status
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ COPY go.sum go.sum
RUN go mod download

COPY cmd/ cmd/
COPY scaleway/ scaleway/
COPY driver/ driver/
COPY pkg/ pkg/

ARG TAG
ARG COMMIT_SHA
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ clean:

.PHONY: test
test:
go test -timeout=1m -v -race -short ./...
go test -timeout=1m -v -race -short `go list ./... | grep -v /test`

.PHONY: test-sanity
test-sanity:
go test -count=1 -v -timeout 10m github.com/scaleway/scaleway-csi/test/sanity

.PHONY: fmt
fmt:
Expand Down
175 changes: 131 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,82 @@
# Scaleway Block Volume CSI driver

The [Scaleway Block Volume](https://www.scaleway.com/en/block-storage/) Container Storage Interface (CSI) driver is an implementation of the [CSI interface](https://github.com/container-storage-interface/spec/blob/master/spec.md) to provide a way to manage Scaleway Block Volumes through a container orchestration system, like Kubernetes.
> **Important**
> ⚠️ **Please read this first before doing anything else!** ⚠️
>
> You are currently on a branch which corresponds to the `v0.3` release of the Scaleway CSI.
>
> This release is **NOT** compatible with the `v0.2` and `v0.1` releases as it introduces
> a major **breaking change**: it now uses the **new Scaleway Block Storage (SBS) API** (which
> is still in private beta) instead of the Instance API to manage block volumes and
> snapshots.
>
> - If you are currently using the `v0.2.x` or `v0.1.x` versions of the Scaleway CSI:
> please do not use this release until we provide a tool to migrate from `v0.2` to the `v0.3` release.
> - If you are looking to install the CSI for the first time using the `v0.3` release:
> make sure you have access to the new Scaleway Block Storage API. You can request
> access [here](https://www.scaleway.com/en/betas/#block-storage-low-latency).
>
> Not sure what to do?
>
> ➡️ Use the [release-0.2](https://github.com/scaleway/scaleway-csi/tree/release-0.2)
> branch for now.
>
> ➡️ Reach us on the *#k8s* channel on the [Scaleway Slack community](https://www.scaleway.com/en/docs/tutorials/scaleway-slack-community/).
The [Scaleway Block Volume](https://www.scaleway.com/en/block-storage/)
Container Storage Interface (CSI) driver is an implementation of the
[CSI interface](https://github.com/container-storage-interface/spec/blob/master/spec.md)
to provide a way to manage Scaleway Block Volumes through a container orchestration system, like Kubernetes.

## CSI Specification Compatibility Matrix

| Scaleway CSI Driver \ CSI Version | v1.2.0 | v1.6.0 | v1.8.0 |
| --------------------------------- | ------ | ------ | ------ |
| master branch ||||
| v0.1.x ||||
| v0.2.x ||||
| v0.3.x ||||

## Scaleway Storage API Compatibility Matrix

Scaleway currently offers two APIs to manage Block Volumes and Snapshots:

- [Instance API](https://www.scaleway.com/en/developers/api/instance/)
- [Scaleway Block Storage API](https://www.scaleway.com/en/developers/api/block/)

A Block Volume or Snapshot currently managed by the *Instance API* **cannot** be managed by the
*Scaleway Block Storage API* and vice versa.

In the future, all Block Volumes and Snapshots will be managed by the *Scaleway Block Storage API*.
In order to use newer versions of the CSI (v0.3+), it is needed to migrate Block Volumes and Snapshots
from the *Instance API* to the *Scaleway Block Storage API* (currently not possible).

A tool will be made available later to facilitate upgrades from older CSI releases to v0.3+.

| Scaleway CSI Driver \ Scaleway Storage API compatibility | Instance API | Scaleway Block Storage API |
| -------------------------------------------------------- | ------------ | -------------------------- |
| master branch |||
| v0.1.x |||
| v0.2.x |||
| v0.3.x |||

## Features

Here is a list of features implemented by the Scaleway CSI driver.

### Block device resizing

The Scaleway CSI driver implements the resize feature ([example for Kubernetes](https://kubernetes.io/blog/2018/07/12/resizing-persistent-volumes-using-kubernetes/)).
It allows an online resize (without the need to detach the block device).
However resizing can only be done upwards, decreasing a volume's size is not supported.

### Raw Block Volume

[Raw Block Volumes](https://kubernetes.io/blog/2019/03/07/raw-block-volume-support-to-beta/)
allows the block volume to be exposed directly to the container as a block device,
instead of a mounted filesystem. To enable it, the `volumeMode` needs to be set to `Block`.
For instance, here is a PVC in raw block volume mode:

**WARNING**: ⚠️ This project is under active development and should be considered alpha.

### CSI Specification Compability Matrix

| Scaleway CSI Driver \ CSI Version | v1.2.0 | v1.6.0 |
|-----------------------------------|--------|--------|
| master branch | yes | yes |
| v0.1.x | yes | no |
| v0.2.x | yes | yes |

### Features

Here is a list of functionality implemented by the Scaleway CSI driver.

#### Block device resizing

The Scaleway CSI driver implements the resize feature ([example for Kubernetes](https://kubernetes.io/blog/2018/07/12/resizing-persistent-volumes-using-kubernetes/)). It allows an online resize (without the need to detach the block device). However resizing can only be done upwards, decreasing a volume's size is not supported.

#### Raw Block Volume

[Raw Block Volumes](https://kubernetes.io/blog/2019/03/07/raw-block-volume-support-to-beta/) allows the block volume to be exposed directly to the container as a block device, instead of a mounted filesystem. To enable it, the `volumeMode` needs to be set to `Block`. For instance, here is a PVC in raw block volume mode:
```yaml
apiVersion: v1
kind: PersistentVolumeClaim
Expand All @@ -33,48 +87,69 @@ spec:
[...]
```

#### At-Rest Encryption
### At-Rest Encryption

Support for volume encryption with Cryptsetup/LUKS. [See more details in examples](./examples/kubernetes#encrypting-volumes)

### Volume Snapshots

Support for volume encryption with Cryptsetup/LUKS. [See more details in examples](https://github.com/scaleway/scaleway-csi/tree/master/examples/kubernetes#encrypting-volumes)
[Volume Snapshots](https://kubernetes.io/docs/concepts/storage/volume-snapshots/)
allows the user to create a snapshot of a specific block volume.

#### Volume Snapshots
### Volume Statistics

[Volume Snapshots](https://kubernetes.io/docs/concepts/storage/volume-snapshots/) allows the user to create a snapshot of a specific block volume.
The Scaleway CSI driver implements the [`NodeGetVolumeStats`](https://github.com/container-storage-interface/spec/blob/master/spec.md#nodegetvolumestats)
CSI method. It is used to gather statistics about the used block volumes. In Kubernetes,
`kubelet` exposes these metrics.

#### Volume Statistics
### Block Storage Low Latency

The Scaleway CSI driver implements the [`NodeGetVolumeStats`](https://github.com/container-storage-interface/spec/blob/master/spec.md#nodegetvolumestats) CSI method. It is used to gather statistics about the used block volumes. In Kubernetes, `kubelet` exposes these metrics.
The Scaleway CSI driver is built upon the Block Storage Low Latency Scaleway product.
It currently provides volumes with up to 15,000 IOPS. By default, created volumes
have 5000 IOPS. To create volumes with higher IOPS, you can set the `iops` parameter
to the requested number of IOPS in your `StorageClass`. For example:

```yaml
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: my-15k-iops-storage-class
provisioner: csi.scaleway.com
reclaimPolicy: Delete
parameters:
iops: "15000"
```
## Kubernetes
This section is Kubernetes specific. Note that Scaleway CSI driver may work for older Kubernetes versions than those announced.
The CSI driver allows to use [Persistent Volumes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/) in Kubernetes.
This section is Kubernetes specific. Note that Scaleway CSI driver may work for
older Kubernetes versions than those announced. The CSI driver allows to use
[Persistent Volumes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/)
in Kubernetes.
### Kubernetes Version Compability Matrix
### Kubernetes Version Compatibility Matrix
| Scaleway CSI Driver \ Kubernetes Version | Min K8s Version | Max K8s Version |
|------------------------------------------|-----------------|-----------------|
| ---------------------------------------- | --------------- | --------------- |
| master branch | v1.20 | - |
| v0.1.x | v1.17 | - |
| v0.2.x | v1.20 | - |
| v0.3.x | v1.20 | - |
### Examples
Some examples are available [here](./examples/kubernetes).
### Installation
These steps will cover how to install the Scaleway CSI driver in your Kubernetes cluster, using Helm.

> **Warning**
> Please note that the manifest files provided in `deploy/kubernetes` are deprecated and
> no longer maintained.
These steps will cover how to install the Scaleway CSI driver in your Kubernetes
cluster, using Helm.
#### Requirements
* A Kubernetes cluster running on Scaleway instances (v1.20+)
* Scaleway Project or Organization ID, Access and Secret key
* Helm v3
- A Kubernetes cluster running on Scaleway instances (v1.20+)
- Scaleway Project or Organization ID, Access and Secret key
- Helm v3
#### Deployment
Expand All @@ -95,7 +170,8 @@ These steps will cover how to install the Scaleway CSI driver in your Kubernetes
--set controller.scaleway.env.SCW_SECRET_KEY=11111111-1111-1111-1111-111111111111
```

Review the [configuration values](https://github.com/scaleway/helm-charts/blob/master/charts/scaleway-csi/values.yaml) for the Helm chart.
Review the [configuration values](https://github.com/scaleway/helm-charts/blob/master/charts/scaleway-csi/values.yaml)
for the Helm chart.

3. You can now verify that the driver is running:

Expand All @@ -115,22 +191,31 @@ These steps will cover how to install the Scaleway CSI driver in your Kubernetes
### Build

You can build the Scaleway CSI driver executable using the following commands:

```bash
make build
```

You can build a local docker image named scaleway-csi for your current architecture using the following command:
You can build a local docker image named scaleway-csi for your current architecture
using the following command:

```bash
make docker-build
```

### Test

In order to run the tests:

```bash
make test
```

In addition to unit tests, we provide tools to run the following tests:

- [Kubernetes external storage e2e tests](./test/e2e/)
- [CSI sanity tests](./test/sanity/)

### Contribute

If you are looking for a way to contribute please read the [contributing guide](./CONTRIBUTING.md)
Expand All @@ -141,8 +226,10 @@ Participation in the Kubernetes community is governed by the [CNCF Code of Condu

## Reach us

We love feedback. Feel free to reach us on [Scaleway Slack community](https://slack.scaleway.com), we are waiting for you on #k8s.
We love feedback. Feel free to reach us on [Scaleway Slack community](https://slack.scaleway.com),
we are waiting for you on #k8s.

You can also join the official Kubernetes slack on #scaleway-k8s channel

You can also [raise an issue](https://github.com/scaleway/scaleway-csi/issues/new) if you think you've found a bug.
You can also [raise an issue](https://github.com/scaleway/scaleway-csi/issues/new)
if you think you've found a bug.
2 changes: 1 addition & 1 deletion cmd/scaleway-csi/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"os"

"github.com/scaleway/scaleway-csi/driver"
"github.com/scaleway/scaleway-csi/pkg/driver"
"k8s.io/klog/v2"
)

Expand Down
Loading

0 comments on commit cce9f72

Please sign in to comment.