Skip to content

Commit 10be754

Browse files
committed
Driver version 0.9.7
Clean up the deploy and examples folder. Switch to use ghcr.io registry. Add GitHub actions.
1 parent fa779ce commit 10be754

27 files changed

+249
-593
lines changed
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: Build and publish moosefs-csi driver Docker image
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
8+
env:
9+
REGISTRY_IMAGE: moosefs/moosefs-csi
10+
MFS_CLIENT: 4.56.6
11+
CSI_VERSION: 0.9.7
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
platform:
20+
- linux/amd64
21+
- linux/arm64
22+
- linux/arm/v7
23+
steps:
24+
- name: Prepare
25+
run: |
26+
platform=${{ matrix.platform }}
27+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
28+
29+
- name: Docker meta
30+
id: meta
31+
uses: docker/metadata-action@v5
32+
with:
33+
images: ${{ env.REGISTRY_IMAGE }}
34+
tags: |
35+
type=ref,event=branch
36+
type=raw,value=${{ env.CSI_VERSION }}-${{ env.MFS_CLIENT }}
37+
type=raw,value=${{ env.CSI_VERSION }}-{{branch}}
38+
39+
- name: Set up QEMU
40+
uses: docker/setup-qemu-action@v3
41+
42+
- name: Set up Docker Buildx
43+
uses: docker/setup-buildx-action@v3
44+
45+
- name: Login to GitHub Container Registry
46+
uses: docker/login-action@v3
47+
with:
48+
registry: ghcr.io
49+
username: ${{ github.actor }}
50+
password: ${{ secrets.GHCR_TOKEN }}
51+
52+
- name: Build and push by digest MooseFS Client v4
53+
id: build
54+
uses: docker/build-push-action@v6
55+
with:
56+
file: ./cmd/moosefs-csi-plugin/Dockerfile
57+
platforms: ${{ matrix.platform }}
58+
labels: ${{ steps.meta.outputs.labels }}
59+
outputs: type=image,name=ghcr.io/${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
60+
build-args: |
61+
MFS_TAG=v${{ env.MFS_CLIENT }}
62+
CSI_TAG=dev
63+
64+
- name: Export digest
65+
run: |
66+
mkdir -p /tmp/digests
67+
digest="${{ steps.build.outputs.digest }}"
68+
touch "/tmp/digests/${digest#sha256:}"
69+
70+
- name: Upload digest
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: digests-${{ env.PLATFORM_PAIR }}
74+
path: /tmp/digests/*
75+
if-no-files-found: error
76+
retention-days: 1
77+
78+
merge:
79+
runs-on: ubuntu-latest
80+
needs:
81+
- build
82+
steps:
83+
- name: Download digests
84+
uses: actions/download-artifact@v4
85+
with:
86+
path: /tmp/digests
87+
pattern: digests-*
88+
merge-multiple: true
89+
90+
- name: Set up Docker Buildx
91+
uses: docker/setup-buildx-action@v3
92+
93+
- name: Docker meta
94+
id: meta
95+
uses: docker/metadata-action@v5
96+
with:
97+
images: ghcr.io/${{ env.REGISTRY_IMAGE }}
98+
tags: |
99+
type=ref,event=branch
100+
type=raw,value=${{ env.CSI_VERSION }}-${{ env.MFS_CLIENT }}
101+
type=raw,value=${{ env.CSI_VERSION }}-{{branch}}
102+
103+
- name: Login to GitHub Container Registry
104+
uses: docker/login-action@v3
105+
with:
106+
registry: ghcr.io
107+
username: ${{ github.actor }}
108+
password: ${{ secrets.GHCR_TOKEN }}
109+
110+
- name: Create manifest list and push
111+
working-directory: /tmp/digests
112+
run: |
113+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
114+
$(printf 'ghcr.io/${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
115+
116+
- name: Inspect image
117+
run: |
118+
docker buildx imagetools inspect ghcr.io/${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
same "printed page" as the copyright notice for easier
188188
identification within third-party archives.
189189

190-
Copyright (c) 2023 Saglabs SA. All Rights Reserved.
190+
Copyright (c) 2024 Saglabs SA. All Rights Reserved.
191191

192192
Licensed under the Apache License, Version 2.0 (the "License");
193193
you may not use this file except in compliance with the License.

Makefile

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2023 Saglabs SA. All Rights Reserved.
1+
# Copyright (c) 2024 Saglabs SA. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -12,44 +12,46 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
MFS3VER=3.0.117
16-
MFS4VER=4.44.4
17-
DRIVER_VERSION ?= 0.9.6
18-
MFS3TAGCE=$(DRIVER_VERSION)-$(MFS3VER)
19-
MFS3TAGPRO=$(DRIVER_VERSION)-$(MFS3VER)-pro
20-
MFS4TAGPRO=$(DRIVER_VERSION)-$(MFS4VER)-pro
21-
DEVTAG=$(DRIVER_VERSION)-dev
15+
MFS_VERSION = "4.56.6"
16+
CSI_VERSION ?= "0.9.7"
2217

23-
NAME=moosefs-csi-plugin
24-
DOCKER_REGISTRY=registry.moosefs.com
18+
MFS_TAG=$(CSI_VERSION)-$(MFS_VERSION)
19+
DEV_TAG=$(CSI_VERSION)-dev
2520

26-
ready: clean compile
27-
publish-dev: clean compile build-dev push-dev
21+
NAME=moosefs-csi
22+
23+
csi: clean compile
24+
dev: build-dev push-dev
25+
prod: build-prod push-prod
2826

2927
compile:
30-
@echo "==> Building the project"
28+
@echo "==> Building the CSI driver"
3129
@env CGO_ENABLED=0 GOCACHE=/tmp/go-cache GOOS=linux GOARCH=amd64 go build -a -o cmd/moosefs-csi-plugin/${NAME} cmd/moosefs-csi-plugin/main.go
3230

3331
build-dev:
34-
@echo "==> Building DEV docker images"
35-
@docker build -t $(DOCKER_REGISTRY)/moosefs-csi-plugin:$(DEVTAG) cmd/moosefs-csi-plugin
36-
@docker build -t $(DOCKER_REGISTRY)/moosefs-csi-plugin:latest-dev cmd/moosefs-csi-plugin
32+
@echo "==> Building DEV CSI images"
33+
@docker build --no-cache -t moosefs/$(NAME):dev -t moosefs/$(NAME):$(DEV_TAG) --build-arg MFS_TAG=v$(MFS_VERSION) --build-arg CSI_TAG=dev cmd/moosefs-csi-plugin
3734

3835
push-dev:
39-
@echo "==> Publishing DEV $(DOCKER_REGISTRY)/moosefs-csi-plugin:$(DEVTAG)"
40-
@docker push $(DOCKER_REGISTRY)/moosefs-csi-plugin:$(DEVTAG)
41-
@docker push $(DOCKER_REGISTRY)/moosefs-csi-plugin:latest-dev
42-
@echo "==> Your DEV image is now available at $(DOCKER_REGISTRY)/moosefs-csi-plugin:$(DEVTAG)"
36+
@echo "==> Publishing DEV CSI image on hub.docker.com: moosefs/$(NAME):$(DEV_TAG)"
37+
@docker push moosefs/$(NAME):$(DEV_TAG)
38+
@docker push moosefs/$(NAME):dev
4339

4440
build-prod:
45-
@docker build -t $(DOCKER_REGISTRY)/moosefs-csi-plugin:$(MFS3TAGCE) cmd/moosefs-csi-plugin -f cmd/moosefs-csi-plugin/Dockerfile-mfs3-ce
46-
@docker build -t $(DOCKER_REGISTRY)/moosefs-csi-plugin:$(MFS3TAGPRO) cmd/moosefs-csi-plugin -f cmd/moosefs-csi-plugin/Dockerfile-mfs3-pro
47-
@docker build -t $(DOCKER_REGISTRY)/moosefs-csi-plugin:$(MFS4TAGPRO) cmd/moosefs-csi-plugin -f cmd/moosefs-csi-plugin/Dockerfile-mfs4-pro
41+
@echo "==> Building Production CSI images"
42+
@docker build --no-cache -t moosefs/$(NAME):$(MFS_TAG) --build-arg MFS_TAG=v$(MFS_VERSION) --build-arg CSI_TAG=$(CSI_VERSION) cmd/moosefs-csi-plugin
4843

4944
push-prod:
50-
@docker push $(DOCKER_REGISTRY)/moosefs-csi-plugin:$(MFS3TAGCE)
51-
@docker push $(DOCKER_REGISTRY)/moosefs-csi-plugin:$(MFS3TAGPRO)
52-
@docker push $(DOCKER_REGISTRY)/moosefs-csi-plugin:$(MFS4TAGPRO)
45+
@echo "==> Publishing PRODUCTION CSI image on hub.docker.com: moosefs/$(NAME):$(MFS_TAG)"
46+
@docker push moosefs/$(NAME):$(MFS_TAGCE)
47+
48+
dev-buildx:
49+
@echo "==> Using buildx to build and publish dev image"
50+
@docker buildx build --no-cache --push --platform linux/amd64,linux/arm64,linux/arm/v7 --build-arg MFS_TAG=v$(MFS_VERSION) --build-arg CSI_TAG=dev -t moosefs/$(NAME):dev -t moosefs/$(NAME):$(DEV_TAG) cmd/moosefs-csi-plugin
51+
52+
prod-buildx:
53+
@echo "==> Using buildx to build and publish production image"
54+
@docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7 --build-arg MFS_TAG=v$(MFS_VERSION) --build-arg CSI_TAG=dev -t moosefs/$(NAME):$(MFS_TAG) cmd/moosefs-csi-plugin
5355

5456
clean:
5557
@echo "==> Cleaning releases"

README.md

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ MooseFS source code can be found [on GitHub](https://github.com/moosefs/moosefs)
1010

1111
*Note that a pool of MooseFS Clients that are available for use by containers is created on each node. By default the number of MooseFS Clients in the pool is `1`.*
1212

13+
## Changelog
14+
15+
Driver verson 0.9.7
16+
* Added support for MooseFS 4 client.
17+
* Enabled passing additional mfsmount parameters during the mount process (password and more).
18+
* Support for cross-platform compilation has been enabled.
19+
* Repository images support AMD64, ARM64 and ARMv7 architectures by default.
20+
1321
## Installation on Kubernetes
1422

1523
### Prerequisites
@@ -20,34 +28,40 @@ MooseFS source code can be found [on GitHub](https://github.com/moosefs/moosefs)
2028

2129
### **Deployment**
2230

23-
1. Complete `deploy/kubernetes/csi-moosefs-config.yaml` configuration file with your settings:
31+
1. Edit `deploy/kubernetes/csi-moosefs-config.yaml` config map file with your settings:
2432

2533
* `master_host` – domain name (**recommended**) or IP address of your MooseFS Master Server(s). It is an equivalent to `-H master_host` or `-o mfsmaster=master_host` passed to MooseFS Client.
2634
* `master_port` – port number of your MooseFS Master Server. It is an equivalent to `-P master_port` or `-o mfsport=master_port` passed to MooseFS Client.
2735
* `k8s_root_dir` – each mount's root directory on MooseFS. Each path is relative to this one. Equivalent to `-S k8s_root_dir` or `-o mfssubfolder=k8s_root_dir` passed to MooseFS Client.
2836
* `driver_working_dir` – a driver working directory inside MooseFS where persistent volumes, logs and metadata is stored (actual path is: `k8s_root_dir/driver_working_dir`)
2937
* `mount_count` – number of pre created MooseFS clients running on each node
30-
and apply:
3138
* `mfs_logging` – driver can create logs from each component in `k8s_root_dir/driver_working_dir/logs` directory. Boolean `"true"`/`"false"` value.
3239

40+
2. Apply csi-moosefs-config config map to the cluster:
41+
3342
```
3443
$ kubectl apply -f deploy/kubernetes/csi-moosefs-config.yaml
3544
```
3645
37-
2. ConfigMap should now be created:
46+
Check the config map status:
3847
3948
```
4049
$ kubectl get configmap -n kube-system
4150
NAME DATA AGE
4251
csi-moosefs-config 6 42s
4352
```
4453
45-
3. Update `deploy/kubernetes/csi-moosefs.yaml` file with the image that uses required MooseFS or MooseFS Pro version and MooseFS CSI Plugin version. Default images are the latest version of the plugin and the latest version of MooseFS (Community):
54+
3. Update `deploy/kubernetes/csi-moosefs.yaml` file with the aproprieate image:
55+
56+
The default image consists of the latest version of the CSI plug-in and the latest version of the MooseFS Community Edition client:
4657
47-
* Find plugin named `csi-moosefs-plugin`
48-
* Update the `image` version suffix in the plugin's section accordingly, for example:
49-
* `0.9.4-3.0.117` – for plugin version 0.9.4 and MooseFS Community 3.0.117
50-
* `0.9.4-4.44.4-pro` – for plugin version 0.9.4 and MooseFS Pro 4.44.4
58+
* Locate image definition under the `csi-moosefs-plugin` plugin name(line 230 and line 323)
59+
`mage: registry.moosefs.com/moosefs-csi-plugin:0.9.7-4.56.6`
60+
* Update the `image` version suffix in the plugin's section accordingly:
61+
* `0.9.7-3.0.118` – plugin version 0.9.7 and MooseFS CE 3.0.118
62+
* `0.9.7-4.56.6` – plugin version 0.9.7 and MooseFS CE 4.56.6
63+
* `0.9.7-3.0.118-pro` – plugin version 0.9.7 and MooseFS PRO 3.0.118
64+
* `0.9.7-4.56.6-pro` – plugin version 0.9.7 and MooseFS PRO 4.56.6
5165
5266
You can find a complete list of available images at: \
5367
https://registry.moosefs.com/v2/moosefs-csi-plugin/tags/list.
@@ -104,7 +118,8 @@ MooseFS source code can be found [on GitHub](https://github.com/moosefs/moosefs)
104118
172.17.2.80:9421 4.2T 1.4T 2.8T 33% /data
105119
```
106120
107-
You may take a look at MooseFS CGI Monitoring Interface ("Quotas" tab) to check if a quota for 5 GiB on a newly created volume directory has been set. Dynamically provisioned volumes are stored on MooseFS in `k8s_root_dir/driver_working_dir/volumes` directory.
121+
You may take a look at MooseFS GUI Monitoring Interface ("Quotas" tab) to check if a quota for 5 GiB on a newly created volume directory has been set.
122+
Dynamically provisioned volumes are stored on MooseFS in `k8s_root_dir/driver_working_dir/volumes` directory.
108123
109124
5. Clean up:
110125
@@ -233,12 +248,13 @@ spec:
233248
234249
| Kubernetes | MooseFS CSI Driver |
235250
|:----------:|:------------------:|
236-
| `v1.26.2` | `v0.9.4` |
237-
| `v1.24.2` | `v0.9.4` |
251+
| `v1.26` | `v0.9.7` |
252+
| `-----` | `------` |
253+
| `v1.30` | `v0.9.7` |
238254
239255
## Copyright
240256
241-
Copyright (c) 2020-2023 Saglabs SA
257+
Copyright (c) 2020-2024 Saglabs SA
242258
243259
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0).
244260

cmd/moosefs-csi-plugin/Dockerfile

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2023 Saglabs SA. All Rights Reserved.
1+
# Copyright (c) 2024 Saglabs SA. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -12,22 +12,29 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
FROM debian:buster
15+
ARG CSI_TAG="dev"
16+
ARG MFS_TAG="v4.56.6"
1617

17-
# Install wget, lsb-release and curl
18-
RUN apt update && \
19-
apt install -y wget lsb-release curl fuse libfuse3-dev tree ca-certificates e2fsprogs gnupg2 && \
20-
# security updates
21-
apt install -y apt systemd
18+
#Build MooseFS CSI driver from source
19+
FROM golang:1.23-bookworm AS csibuilder
20+
WORKDIR /build
21+
ARG CSI_TAG
22+
RUN git clone --depth 1 --branch ${CSI_TAG} https://github.com/moosefs/moosefs-csi.git
23+
RUN cd moosefs-csi && CGO_ENABLED=0 GOCACHE=/tmp/go-cache GOOS=linux go build -a -o /build/moosefs-csi-plugin cmd/moosefs-csi-plugin/main.go
2224

23-
# Add key
24-
RUN wget -O - http://repository.moosefs.com/moosefs.key | apt-key add -
25-
RUN echo "deb http://repository.moosefs.com/4.44.4/apt/debian/buster buster main" > /etc/apt/sources.list.d/moosefs.list
26-
27-
# Install MooseFS client
28-
RUN apt update --allow-releaseinfo-change && apt install -y moosefs-pro-client
29-
30-
# Copy the CSI plugin
31-
ADD moosefs-csi-plugin /bin/
25+
#Build MooseFS Client from source
26+
FROM registry.moosefs.com/mfsbuilder-debian12:latest AS mfsbuilder
27+
WORKDIR /moosefs
28+
ARG MFS_TAG
29+
RUN git clone --depth 1 --branch ${MFS_TAG} https://github.com/moosefs/moosefs.git /moosefs
30+
RUN autoreconf -f -i
31+
RUN ./configure --prefix=/usr --mandir=/share/man --sysconfdir=/etc --localstatedir=/var/lib --with-default-user=mfs --with-default-group=mfs --disable-mfsbdev
32+
RUN cd /moosefs/mfsclient && make DESTDIR=/tmp/ install
3233

34+
#Build CSI plugin container
35+
FROM debian:bookworm
36+
RUN apt update && apt install -y libfuse3-3
37+
COPY --from=csibuilder /build/moosefs-csi-plugin /bin/moosefs-csi-plugin
38+
COPY --from=mfsbuilder /tmp/usr/bin /usr/bin
39+
RUN ["ln", "-s", "/usr/bin/mfsmount", "/usr/sbin/mount.moosefs"]
3340
ENTRYPOINT ["/bin/moosefs-csi-plugin"]

cmd/moosefs-csi-plugin/Dockerfile-mfs3-ce

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)