-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM golang:1.21-alpine as builder | ||
ARG VERSION=0.0.0-dev | ||
|
||
WORKDIR /go/src/github.com/vultr/vultr-csi | ||
COPY --from=src . /go/src/github.com/vultr/vultr-csi | ||
RUN CGO_ENABLED=0 go build -ldflags "-X main.version=${VERSION}" -o csi-vultr-plugin ./cmd/csi-vultr-driver | ||
|
||
FROM alpine:3.18 | ||
|
||
RUN apk add --no-cache ca-certificates e2fsprogs findmnt bind-tools e2fsprogs-extra xfsprogs xfsprogs-extra blkid | ||
|
||
COPY --from=builder /go/src/github.com/vultr/vultr-csi/csi-vultr-plugin / | ||
COPY entrypoint.sh / | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
PLUGIN_NAME = vultr/vultr-csi | ||
PLUGIN_TAG = latest | ||
PLUGIN_ARCH = amd64 | ||
|
||
all: clean rootfs create | ||
|
||
clean: | ||
@echo "### rm ./plugin" | ||
@rm -rf ./plugin | ||
|
||
rootfs: | ||
@echo "### docker build: rootfs image with ${PLUGIN_NAME}" | ||
@docker build --build-context src=../../ --platform linux/${PLUGIN_ARCH} -t ${PLUGIN_NAME}:rootfs . | ||
@echo "### create rootfs directory in ./plugin/rootfs" | ||
@mkdir -p ./plugin/rootfs | ||
@docker create --name tmp ${PLUGIN_NAME}:rootfs | ||
@docker export tmp | tar -x -C ./plugin/rootfs | ||
@echo "### copy config.json to ./plugin/" | ||
@cp config.json ./plugin/ | ||
@docker rm -vf tmp | ||
|
||
create: | ||
@echo "### remove existing plugin ${PLUGIN_NAME}:${PLUGIN_TAG} if exists" | ||
@docker plugin rm -f ${PLUGIN_NAME}:${PLUGIN_TAG} || true | ||
@echo "### create new plugin ${PLUGIN_NAME}:${PLUGIN_TAG} from ./plugin" | ||
@docker plugin create ${PLUGIN_NAME}:${PLUGIN_TAG} ./plugin | ||
|
||
enable: | ||
@echo "### enable plugin ${PLUGIN_NAME}:${PLUGIN_TAG}" | ||
@docker plugin enable ${PLUGIN_NAME}:${PLUGIN_TAG} | ||
|
||
push: clean rootfs create enable | ||
@echo "### push plugin ${PLUGIN_NAME}:${PLUGIN_TAG}" | ||
@docker plugin push ${PLUGIN_NAME}:${PLUGIN_TAG} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"description": "Vultr csi plugin for Docker", | ||
"documentation": "https://github.com/moby/moby/blob/master/docs/cluster_volumes.md", | ||
"entrypoint": [ | ||
"/entrypoint.sh" | ||
], | ||
"env": [ | ||
{ | ||
"name": "VULTR_API_URL", | ||
"settable": [ | ||
"value" | ||
], | ||
"value": "" | ||
}, | ||
{ | ||
"name": "VULTR_API_TOKEN", | ||
"settable": [ | ||
"value" | ||
], | ||
"value": "" | ||
} | ||
], | ||
"interface": { | ||
"socket": "csi-vultr.sock", | ||
"types": [ | ||
"docker.csicontroller/1.0", | ||
"docker.csinode/1.0" | ||
] | ||
}, | ||
"linux": { | ||
"allowAllDevices": true, | ||
"capabilities": [ | ||
"CAP_SYS_ADMIN" | ||
] | ||
}, | ||
"mounts": [ | ||
{ | ||
"destination": "/dev", | ||
"options": [ | ||
"rbind" | ||
], | ||
"source": "/dev", | ||
"type": "bind" | ||
} | ||
], | ||
"network": { | ||
"type": "host" | ||
}, | ||
"propagatedMount": "/data/published" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
|
||
exec /csi-vultr-plugin \ | ||
-endpoint "unix:///run/docker/plugins/csi-vultr.sock" \ | ||
-api-url "${VULTR_API_URL}" \ | ||
-token "${VULTR_API_TOKEN}" |