diff options
| -rw-r--r-- | .github/workflows/release.yaml | 75 | ||||
| -rw-r--r-- | cmd/seaweedfs-csi-driver/Dockerfile | 20 | ||||
| -rw-r--r-- | cmd/seaweedfs-csi-driver/Dockerfile.dev | 4 | ||||
| -rw-r--r-- | deploy/kubernetes/seaweedfs-csi.yaml | 49 |
4 files changed, 64 insertions, 84 deletions
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 087f461..c18e833 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -26,6 +26,21 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - name: Docker meta + id: docker_meta + uses: docker/metadata-action@v3 + with: + images: | + chrislusf/seaweedfs-csi-driver + tags: | + type=raw,value=dev + flavor: | + latest=true + labels: | + org.opencontainers.image.title=seaweedfs-csi-driver + org.opencontainers.image.description=SeaweedFS is a distributed storage system for blobs, objects, files, and data lake, to store and serve billions of files fast! + org.opencontainers.image.vendor=Chris Lu + - name: Fetch history run: git fetch --prune --unshallow @@ -42,64 +57,24 @@ jobs: - name: Setup Docker Buildx uses: docker/setup-buildx-action@v1 + with: + buildkitd-flags: "--debug" - name: Login to DockerHub - if: ${{ startsWith(github.ref, 'refs/tags/') }} + # if: ${{ startsWith(github.ref, 'refs/tags/') }} uses: docker/login-action@v1 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} + # username: ${{ secrets.DOCKERHUB_USERNAME }} + username: chrislusf password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Login to GitHub Container Registry - if: ${{ startsWith(github.ref, 'refs/tags/') }} - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Annotate Docker images - if: ${{ startsWith(github.ref, 'refs/tags/') }} - id: docker_meta - uses: crazy-max/ghaction-docker-meta@v1 - with: - images: ${{ github.repository }} - - - name: Build Docker image + - name: Build + # if: ${{ startsWith(github.ref, 'refs/tags/') }} uses: docker/build-push-action@v2 with: context: . + push: ${{ github.event_name != 'pull_request' }} file: ./cmd/seaweedfs-csi-driver/Dockerfile - platforms: linux/amd64 - push: false + platforms: linux/amd64, linux/arm, linux/arm64, linux/386 + tags: ${{ steps.docker_meta.outputs.tags }} labels: ${{ steps.docker_meta.outputs.labels }} - tags: ${{ github.repository }}:${{ env.RELEASE_VERSION }} - - - name: Publish Docker image to DockerHub & GitHub Container Registry - uses: docker/build-push-action@v2 - with: - context: . - file: ./cmd/seaweedfs-csi-driver/Dockerfile - platforms: linux/amd64 - push: ${{ startsWith(github.ref, 'refs/tags/') }} - labels: ${{ steps.docker_meta.outputs.labels }} - tags: | - ${{ github.repository }}:${{ env.RELEASE_VERSION }} - ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }} - - - name: Update DockerHub repo description - if: ${{ startsWith(github.ref, 'refs/tags/') }} - uses: peter-evans/dockerhub-description@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} - repository: ${{ github.repository }} - - - name: Create Release - if: ${{ startsWith(github.ref, 'refs/tags/') }} - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ env.RELEASE_VERSION }} diff --git a/cmd/seaweedfs-csi-driver/Dockerfile b/cmd/seaweedfs-csi-driver/Dockerfile index f83e3fa..4cdbf75 100644 --- a/cmd/seaweedfs-csi-driver/Dockerfile +++ b/cmd/seaweedfs-csi-driver/Dockerfile @@ -1,21 +1,19 @@ -FROM amd64/golang:1.16-alpine as builder +FROM golang:1.17-alpine as builder -RUN apk add git go g++ curl jq +RUN apk add git g++ -WORKDIR / +RUN mkdir -p /go/src/github.com/chrislusf/ +RUN git clone https://github.com/chrislusf/seaweedfs /go/src/github.com/chrislusf/seaweedfs +RUN cd /go/src/github.com/chrislusf/seaweedfs/weed && go install -RUN curl -sL \ - $(curl -s https://api.github.com/repos/chrislusf/seaweedfs/releases/latest \ - | jq -r '.assets[]|select(.name=="linux_amd64.tar.gz")|.browser_download_url') \ - | tar xzvf - - -COPY ../../ /src -RUN cd /src && go build -o /seaweedfs-csi-driver ./cmd/seaweedfs-csi-driver/main.go +RUN mkdir -p /go/src/github.com/seaweedfs/ +RUN git clone https://github.com/seaweedfs/seaweedfs-csi-driver /go/src/github.com/seaweedfs/seaweedfs-csi-driver +RUN cd /go/src/github.com/seaweedfs/seaweedfs-csi-driver && go build -o /seaweedfs-csi-driver ./cmd/seaweedfs-csi-driver/main.go FROM alpine AS final RUN apk add fuse LABEL author="Chris Lu" -COPY --from=builder /weed /usr/bin/ +COPY --from=builder /go/bin/weed /usr/bin/ COPY --from=builder /seaweedfs-csi-driver / RUN chmod +x /seaweedfs-csi-driver diff --git a/cmd/seaweedfs-csi-driver/Dockerfile.dev b/cmd/seaweedfs-csi-driver/Dockerfile.dev index ccbc6e3..cdb1969 100644 --- a/cmd/seaweedfs-csi-driver/Dockerfile.dev +++ b/cmd/seaweedfs-csi-driver/Dockerfile.dev @@ -1,5 +1,5 @@ -FROM amd64/golang:1.16-alpine as builder -RUN apk add git go g++ +FROM golang:1.17-alpine as builder +RUN apk add git g++ RUN mkdir -p /go/src/github.com/chrislusf/ RUN git clone https://github.com/chrislusf/seaweedfs /go/src/github.com/chrislusf/seaweedfs diff --git a/deploy/kubernetes/seaweedfs-csi.yaml b/deploy/kubernetes/seaweedfs-csi.yaml index 94040e4..d53cae2 100644 --- a/deploy/kubernetes/seaweedfs-csi.yaml +++ b/deploy/kubernetes/seaweedfs-csi.yaml @@ -1,35 +1,42 @@ --- -apiVersion: apiextensions.k8s.io/v1beta1 +apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: creationTimestamp: null name: csinodeinfos.csi.storage.k8s.io + annotations: + "api-approved.kubernetes.io": "https://github.com/kubernetes/enhancements/pull/1111 - though obvi it's not approved, but that's why" spec: group: csi.storage.k8s.io names: kind: CSINodeInfo plural: csinodeinfos scope: Cluster - validation: - openAPIV3Schema: - properties: - csiDrivers: - description: List of CSI drivers running on the node and their properties. - items: - properties: - driver: - description: The CSI driver that this object refers to. - type: string - nodeID: - description: The node from the driver point of view. - type: string - topologyKeys: - description: List of keys supported by the driver. - items: - type: string - type: array - type: array - version: v1alpha1 + versions: + - name: v1alpha1 + served: true + storage: true + schema: + openAPIV3Schema: + type: object + properties: + csiDrivers: + description: List of CSI drivers running on the node and their properties. + items: + type: object + properties: + driver: + description: The CSI driver that this object refers to. + type: string + nodeID: + description: The node from the driver point of view. + type: string + topologyKeys: + description: List of keys supported by the driver. + items: + type: string + type: array + type: array status: acceptedNames: kind: "" |
