diff --git a/.github/workflows/images-build-and-push.yaml b/.github/workflows/images-build-and-push.yaml index a6123fc..bc857ea 100644 --- a/.github/workflows/images-build-and-push.yaml +++ b/.github/workflows/images-build-and-push.yaml @@ -10,7 +10,7 @@ on: env: BASE_REPOSITORY: warm-metal/container-image-csi-driver BASE_DEFAULT_BRANCH: main - BASE_IMAGE_NAME: warmmetal/csi-image + BASE_IMAGE_NAME: warmmetal/container-image-csi-driver FORK_IMAGE_NAME: ghcr.io/${{ github.repository }} permissions: diff --git a/Dockerfile b/Dockerfile index a91ae27..d4ea9ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM docker.io/library/golang:1.20.4-alpine3.17 as builder RUN apk add --no-cache btrfs-progs-dev lvm2-dev make build-base -WORKDIR /go/src/csi-driver-image +WORKDIR /go/src/container-image-csi-driver COPY go.mod go.sum ./ RUN go mod download COPY cmd ./cmd @@ -10,10 +10,10 @@ RUN make build RUN make install-util FROM scratch as install-util -COPY --from=builder /go/src/csi-driver-image/_output/warm-metal-csi-image-install / +COPY --from=builder /go/src/container-image-csi-driver/_output/warm-metal-csi-image-install / FROM alpine:3.17 RUN apk add --no-cache btrfs-progs-dev lvm2-dev WORKDIR / -COPY --from=builder /go/src/csi-driver-image/_output/csi-image-plugin /usr/bin/ +COPY --from=builder /go/src/container-image-csi-driver/_output/csi-image-plugin /usr/bin/ ENTRYPOINT ["csi-image-plugin"] diff --git a/README.md b/README.md index 5189c15..19cd326 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -[![containerd](https://github.com/warm-metal/csi-driver-image/actions/workflows/containerd.yaml/badge.svg)](https://github.com/warm-metal/csi-driver-image/actions/workflows/containerd.yaml) -[![docker-containerd](https://github.com/warm-metal/csi-driver-image/actions/workflows/docker-containerd.yaml/badge.svg)](https://github.com/warm-metal/csi-driver-image/actions/workflows/docker-containerd.yaml) -[![cri-o](https://github.com/warm-metal/csi-driver-image/actions/workflows/cri-o.yaml/badge.svg)](https://github.com/warm-metal/csi-driver-image/actions/workflows/cri-o.yaml) +[![containerd](https://github.com/warm-metal/container-image-csi-driver/actions/workflows/containerd.yaml/badge.svg)](https://github.com/warm-metal/container-image-csi-driver/actions/workflows/containerd.yaml) +[![docker-containerd](https://github.com/warm-metal/container-image-csi-driver/actions/workflows/docker-containerd.yaml/badge.svg)](https://github.com/warm-metal/container-image-csi-driver/actions/workflows/docker-containerd.yaml) +[![cri-o](https://github.com/warm-metal/container-image-csi-driver/actions/workflows/cri-o.yaml/badge.svg)](https://github.com/warm-metal/container-image-csi-driver/actions/workflows/cri-o.yaml) ![Docker Pulls](https://img.shields.io/docker/pulls/warmmetal/csi-image?color=brightgreen&logo=docker&logoColor=lightgrey&labelColor=black) # :construction_worker_man: :wrench: :construction: RENAMING THE REPOSITORY :construction: :wrench: :construction_worker_man: -We are currently in the process of [changing the repository name](https://github.com/warm-metal/csi-driver-image/issues/105). This alteration may potentially introduce issues during Continuous Integration (CI) runs or while building packages locally. If you encounter any problems, we encourage you to promptly create an issue so that we can assist you in resolving them. +We are currently in the process of [changing the repository name](https://github.com/warm-metal/container-image-csi-driver/issues/105). This alteration may potentially introduce issues during Continuous Integration (CI) runs or while building packages locally. If you encounter any problems, we encourage you to promptly create an issue so that we can assist you in resolving them. ### Note for Forked Repositories: If you have forked this repository before January 21, 2024, we kindly request that you follow the steps outlined in the [GitHub documentation](https://docs.github.com/en/repositories/creating-and-managing-repositories/renaming-a-repository) to update your remote. This ensures that your fork remains synchronized with the latest changes and avoids any disruption to your workflow. @@ -20,11 +20,11 @@ git remote set-head origin -a We appreciate your cooperation and understanding as we work to improve our repository. -# csi-driver-image +# container-image-csi-driver (previously csi-driver-image) This is a CSI driver for mounting images as PVs or ephemeral volumes. -It pulls images via CRI and shares the image store with the container runtime, +It pulls images via CRI and shares the image store with the container runtime, then mounts images via the snapshot/storage service of the runtime. **Read-Only** volumes of the same image share the same snapshot. **Read-Write** volumes keep their own snapshot and changes until pod deletion. @@ -55,7 +55,7 @@ The driver requires to mount various host paths for different container runtimes So, I build a binary utility, `warm-metal-csi-image-install`, to reduce the installation complexity. It supports kubernetes, microk8s and k3s clusters with container runtime **cri-o**, **containerd** or **docker**. Users can run this utility on any nodes in their clusters to generate proper manifests to install the driver. -The download link is available on the [release page](https://github.com/warm-metal/csi-driver-image/releases). +The download link is available on the [release page](https://github.com/warm-metal/container-image-csi-driver/releases). ```shell script # To print manifests @@ -74,13 +74,13 @@ warm-metal-csi-image-install --pull-image-secret-for-daemonset=foo warm-metal-csi-image-install --pull-image-secret-for-daemonset=foo --enable-daemon-image-credential-cache=false ``` -You can found some installation manifests as samples in [examples](https://github.com/warm-metal/csi-driver-image/tree/master/sample). +You can found some installation manifests as samples in [examples](https://github.com/warm-metal/container-image-csi-driver/tree/master/sample). #### Notice for docker Until Docker migrates its [image and snapshot store](https://github.com/moby/moby/issues/38043) to containerd, I recommend you use containerd instead. Otherwise, the driver can't use images managed by Docker daemon. -If your container runtime can't be migrated, you can enable the CRI plugin by clearing +If your container runtime can't be migrated, you can enable the CRI plugin by clearing the containerd config file `/etc/containerd/config.toml`, then restarting the containerd. @@ -105,7 +105,7 @@ spec: spec: containers: - name: ephemeral-volume - image: docker.io/warmmetal/csi-image-test:check-fs + image: docker.io/warmmetal/container-image-csi-driver-test:check-fs env: - name: TARGET value: /target @@ -120,7 +120,7 @@ spec: # nodePublishSecretRef: # name: "ImagePullSecret name in the same namespace" volumeAttributes: - image: "docker.io/warmmetal/csi-image-test:simple-fs" + image: "docker.io/warmmetal/container-image-csi-driver-test:simple-fs" # # set pullAlways if you want to ignore local images # pullAlways: "true" backoffLimit: 0 @@ -143,7 +143,7 @@ spec: persistentVolumeReclaimPolicy: Retain csi: driver: csi-image.warm-metal.tech - volumeHandle: "docker.io/warmmetal/csi-image-test:simple-fs" + volumeHandle: "docker.io/warmmetal/container-image-csi-driver-test:simple-fs" # nodePublishSecretRef: # name: "name of the ImagePullSecret" # namespace: "namespace of the secret" @@ -152,14 +152,14 @@ spec: # pullAlways: "true" ``` -See all [examples](https://github.com/warm-metal/csi-driver-image/tree/master/sample). +See all [examples](https://github.com/warm-metal/container-image-csi-driver/tree/master/sample). #### Private Image -There are several ways to configure credentials for private image pulling. +There are several ways to configure credentials for private image pulling. If your clusters are in cloud, the credential provider are enabled automatically. -If your cloud provider provides a credential provider plugin instead, you can enable it by adding +If your cloud provider provides a credential provider plugin instead, you can enable it by adding both `--image-credential-provider-config` and `--image-credential-provider-bin-dir` flags to the driver. See [credential provider plugin](https://kubernetes.io/docs/tasks/kubelet-credential-provider/kubelet-credential-provider/). @@ -176,7 +176,7 @@ then restart the driver daemon pod. Users can run `warm-metal-csi-image-install` warm-metal-csi-image-install --pull-image-secret-for-daemonset=foo --pull-image-secret-for-daemonset=bar ``` -If the secret works only for particular workloads, you can set via the `nodePublishSecretRef` attribute of ephemeral volumes. +If the secret works only for particular workloads, you can set via the `nodePublishSecretRef` attribute of ephemeral volumes. See the above sample manifest, and notice that secrets and workloads must in the same namespace. (Since version v0.5.1, pulling private images using the ImagePullSecrets which attached to workload service accounts is no longer supported for security reasons.) @@ -186,11 +186,11 @@ You can also set the secret to a PV, then share the PV with multiple workloads. ### Sanity test -See [test/sanity](https://github.com/warm-metal/csi-driver-image/tree/master/test/sanity). +See [test/sanity](https://github.com/warm-metal/container-image-csi-driver/tree/master/test/sanity). ### E2E test -See [test/e2e](https://github.com/warm-metal/csi-driver-image/tree/master/test/e2e). +See [test/e2e](https://github.com/warm-metal/container-image-csi-driver/tree/master/test/e2e). ## Note on logging image size Image sizes are logged after they finish pulling. We've noticed that for smaller images, usually under 1KiB, containerd may report an incorrect image size. An issue has been raised in the containerd github repository: https://github.com/containerd/containerd/issues/9641. diff --git a/charts/warm-metal-csi-driver/values-crio.yaml b/charts/warm-metal-csi-driver/values-crio.yaml index 1cdf403..b306f65 100644 --- a/charts/warm-metal-csi-driver/values-crio.yaml +++ b/charts/warm-metal-csi-driver/values-crio.yaml @@ -13,7 +13,7 @@ csiPlugin: resources: {} image: tag: "" - repository: docker.io/warmmetal/csi-image + repository: docker.io/warmmetal/container-image-csi-driver pullPolicy: IfNotPresent livenessProbe: httpGet: diff --git a/charts/warm-metal-csi-driver/values.yaml b/charts/warm-metal-csi-driver/values.yaml index cf577ff..38196ab 100644 --- a/charts/warm-metal-csi-driver/values.yaml +++ b/charts/warm-metal-csi-driver/values.yaml @@ -13,7 +13,7 @@ csiPlugin: resources: {} image: tag: "" - repository: docker.io/warmmetal/csi-image + repository: docker.io/warmmetal/container-image-csi-driver pullPolicy: IfNotPresent livenessProbe: httpGet: diff --git a/cmd/plugin/controller_server.go b/cmd/plugin/controller_server.go index d72b979..e8e52dc 100644 --- a/cmd/plugin/controller_server.go +++ b/cmd/plugin/controller_server.go @@ -5,7 +5,7 @@ import ( "github.com/container-storage-interface/spec/lib/go/csi" "github.com/pkg/errors" - "github.com/warm-metal/csi-driver-image/pkg/watcher" + "github.com/warm-metal/container-image-csi-driver/pkg/watcher" csicommon "github.com/warm-metal/csi-drivers/pkg/csi-common" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" diff --git a/cmd/plugin/main.go b/cmd/plugin/main.go index 4dbbdd3..28b5e4e 100644 --- a/cmd/plugin/main.go +++ b/cmd/plugin/main.go @@ -5,20 +5,19 @@ import ( goflag "flag" "fmt" "net/url" + "time" "github.com/container-storage-interface/spec/lib/go/csi" flag "github.com/spf13/pflag" - "github.com/warm-metal/csi-driver-image/pkg/backend" - "github.com/warm-metal/csi-driver-image/pkg/backend/containerd" - "github.com/warm-metal/csi-driver-image/pkg/backend/crio" - "github.com/warm-metal/csi-driver-image/pkg/cri" - "github.com/warm-metal/csi-driver-image/pkg/metrics" - "github.com/warm-metal/csi-driver-image/pkg/secret" - "github.com/warm-metal/csi-driver-image/pkg/watcher" + "github.com/warm-metal/container-image-csi-driver/pkg/backend" + "github.com/warm-metal/container-image-csi-driver/pkg/backend/containerd" + "github.com/warm-metal/container-image-csi-driver/pkg/backend/crio" + "github.com/warm-metal/container-image-csi-driver/pkg/cri" + "github.com/warm-metal/container-image-csi-driver/pkg/metrics" + "github.com/warm-metal/container-image-csi-driver/pkg/secret" + "github.com/warm-metal/container-image-csi-driver/pkg/watcher" csicommon "github.com/warm-metal/csi-drivers/pkg/csi-common" "k8s.io/klog/v2" - - "time" ) const ( diff --git a/cmd/plugin/node_server.go b/cmd/plugin/node_server.go index a134a81..84baf1a 100644 --- a/cmd/plugin/node_server.go +++ b/cmd/plugin/node_server.go @@ -8,12 +8,12 @@ import ( "github.com/container-storage-interface/spec/lib/go/csi" "github.com/containerd/containerd/reference/docker" "github.com/google/uuid" - "github.com/warm-metal/csi-driver-image/pkg/backend" - "github.com/warm-metal/csi-driver-image/pkg/metrics" - "github.com/warm-metal/csi-driver-image/pkg/mountexecutor" - "github.com/warm-metal/csi-driver-image/pkg/mountstatus" - "github.com/warm-metal/csi-driver-image/pkg/pullexecutor" - "github.com/warm-metal/csi-driver-image/pkg/secret" + "github.com/warm-metal/container-image-csi-driver/pkg/backend" + "github.com/warm-metal/container-image-csi-driver/pkg/metrics" + "github.com/warm-metal/container-image-csi-driver/pkg/mountexecutor" + "github.com/warm-metal/container-image-csi-driver/pkg/mountstatus" + "github.com/warm-metal/container-image-csi-driver/pkg/pullexecutor" + "github.com/warm-metal/container-image-csi-driver/pkg/secret" csicommon "github.com/warm-metal/csi-drivers/pkg/csi-common" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -101,7 +101,7 @@ func (n NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublishV return } - if err = os.MkdirAll(req.TargetPath, 0755); err != nil { + if err = os.MkdirAll(req.TargetPath, 0o755); err != nil { err = status.Error(codes.Internal, err.Error()) return } diff --git a/cmd/plugin/node_server_test.go b/cmd/plugin/node_server_test.go index c27ef4c..e6aca0b 100644 --- a/cmd/plugin/node_server_test.go +++ b/cmd/plugin/node_server_test.go @@ -15,10 +15,10 @@ import ( "github.com/container-storage-interface/spec/lib/go/csi" "github.com/stretchr/testify/assert" - "github.com/warm-metal/csi-driver-image/pkg/backend" - "github.com/warm-metal/csi-driver-image/pkg/backend/containerd" - "github.com/warm-metal/csi-driver-image/pkg/cri" - "github.com/warm-metal/csi-driver-image/pkg/metrics" + "github.com/warm-metal/container-image-csi-driver/pkg/backend" + "github.com/warm-metal/container-image-csi-driver/pkg/backend/containerd" + "github.com/warm-metal/container-image-csi-driver/pkg/cri" + "github.com/warm-metal/container-image-csi-driver/pkg/metrics" csicommon "github.com/warm-metal/csi-drivers/pkg/csi-common" "google.golang.org/grpc" "k8s.io/apimachinery/pkg/util/wait" diff --git a/docs/automation.md b/docs/automation.md index 89e80d8..12babf3 100644 --- a/docs/automation.md +++ b/docs/automation.md @@ -3,24 +3,24 @@ There are a few [GitHub Workflows](https://docs.github.com/en/actions/using-workflows/about-workflows#about-workflows) that run on this repository. ## Build -- [![Create and publish the container image.](https://github.com/warm-metal/csi-driver-image/actions/workflows/images-build-and-push.yaml/badge.svg)](https://github.com/warm-metal/csi-driver-image/actions/workflows/images-build-and-push.yaml) - - On the main repository - `warm-metal/csi-driver-image`, builds and pushes the container image to Docker Hub [`warmmetal/csi-image`](https://hub.docker.com/r/warmmetal/csi-image) +- [![Create and publish the container image.](https://github.com/warm-metal/container-image-csi-driver/actions/workflows/images-build-and-push.yaml/badge.svg)](https://github.com/warm-metal/container-image-csi-driver/actions/workflows/images-build-and-push.yaml) + - On the main repository - `warm-metal/container-image-csi-driver`, builds and pushes the container image to Docker Hub [`warmmetal/csi-image`](https://hub.docker.com/r/warmmetal/csi-image) - On any forks, builds and pushes the container image to `ghcr.io/` ## Tests -- [![backward-compatibility-5mins](https://github.com/warm-metal/csi-driver-image/actions/workflows/backward-compatibility.yaml/badge.svg)](https://github.com/warm-metal/csi-driver-image/actions/workflows/backward-compatibility.yaml) -- [![containerd-11mins](https://github.com/warm-metal/csi-driver-image/actions/workflows/containerd.yaml/badge.svg)](https://github.com/warm-metal/csi-driver-image/actions/workflows/containerd.yaml) -- [![cri-o-10mins](https://github.com/warm-metal/csi-driver-image/actions/workflows/cri-o.yaml/badge.svg)](https://github.com/warm-metal/csi-driver-image/actions/workflows/cri-o.yaml) -- [![restart-ds-containerd-5mins](https://github.com/warm-metal/csi-driver-image/actions/workflows/restart-ds-containerd.yaml/badge.svg)](https://github.com/warm-metal/csi-driver-image/actions/workflows/restart-ds-containerd.yaml) -- [![restart-ds-crio-8mins](https://github.com/warm-metal/csi-driver-image/actions/workflows/restart-ds-crio.yaml/badge.svg)](https://github.com/warm-metal/csi-driver-image/actions/workflows/restart-ds-crio.yaml) -- [![test-metrics-5m](https://github.com/warm-metal/csi-driver-image/actions/workflows/metrics.yaml/badge.svg)](https://github.com/warm-metal/csi-driver-image/actions/workflows/metrics.yaml) +- [![backward-compatibility-5mins](https://github.com/warm-metal/container-image-csi-driver/actions/workflows/backward-compatibility.yaml/badge.svg)](https://github.com/warm-metal/container-image-csi-driver/actions/workflows/backward-compatibility.yaml) +- [![containerd-11mins](https://github.com/warm-metal/container-image-csi-driver/actions/workflows/containerd.yaml/badge.svg)](https://github.com/warm-metal/container-image-csi-driver/actions/workflows/containerd.yaml) +- [![cri-o-10mins](https://github.com/warm-metal/container-image-csi-driver/actions/workflows/cri-o.yaml/badge.svg)](https://github.com/warm-metal/container-image-csi-driver/actions/workflows/cri-o.yaml) +- [![restart-ds-containerd-5mins](https://github.com/warm-metal/container-image-csi-driver/actions/workflows/restart-ds-containerd.yaml/badge.svg)](https://github.com/warm-metal/container-image-csi-driver/actions/workflows/restart-ds-containerd.yaml) +- [![restart-ds-crio-8mins](https://github.com/warm-metal/container-image-csi-driver/actions/workflows/restart-ds-crio.yaml/badge.svg)](https://github.com/warm-metal/container-image-csi-driver/actions/workflows/restart-ds-crio.yaml) +- [![test-metrics-5m](https://github.com/warm-metal/container-image-csi-driver/actions/workflows/metrics.yaml/badge.svg)](https://github.com/warm-metal/container-image-csi-driver/actions/workflows/metrics.yaml) ## Maintenance -- [![Delete old container images](https://github.com/warm-metal/csi-driver-image/actions/workflows/images-cleanup.yaml/badge.svg)](https://github.com/warm-metal/csi-driver-image/actions/workflows/images-cleanup.yaml) +- [![Delete old container images](https://github.com/warm-metal/container-image-csi-driver/actions/workflows/images-cleanup.yaml/badge.svg)](https://github.com/warm-metal/container-image-csi-driver/actions/workflows/images-cleanup.yaml) - Deletes all `ghcr.io/` image tags, expect `latest` or any semver tags. This workflow will run on forks only. -- [![Close stale issues and PRs](https://github.com/warm-metal/csi-driver-image/actions/workflows/stale.yaml/badge.svg)](https://github.com/warm-metal/csi-driver-image/actions/workflows/stale.yaml) +- [![Close stale issues and PRs](https://github.com/warm-metal/container-image-csi-driver/actions/workflows/stale.yaml/badge.svg)](https://github.com/warm-metal/container-image-csi-driver/actions/workflows/stale.yaml) - [Create a repository variable](https://docs.github.com/en/actions/learn-github-actions/variables#creating-configuration-variables-for-a-repository) `DEBUG_ONLY` with value `true` to run the action in dry-run mode. - Marks issues or PRs as stale after 30 days and closes them after 7 days, except those labeled with any of of the following - `awaiting-approval` diff --git a/docs/running-locally.md b/docs/running-locally.md index cc8bccb..2bfbbc6 100644 --- a/docs/running-locally.md +++ b/docs/running-locally.md @@ -7,12 +7,12 @@ You have two options: ## Development Container -The development container contains all the tools necessary to work with csi-driver-image. +The development container contains all the tools necessary to work with container-image-csi-driver. You can use the development container in a few different ways: -1. [Visual Studio Code](https://code.visualstudio.com/) with [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers). Open the local clone of `csi-driver-image` folder in VSCode and it should offer to use the development container automatically. -1. [`devcontainer` CLI](https://github.com/devcontainers/cli). Once installed, the local clone of `csi-driver-image` folder and run `devcontainer up --workspace-folder .` followed by `devcontainer exec --workspace-folder . /bin/bash` to get a shell where you can build the code. You can use any editor outside the container to edit code; any changes will be mirrored inside the container. +1. [Visual Studio Code](https://code.visualstudio.com/) with [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers). Open the local clone of `container-image-csi-driver` folder in VSCode and it should offer to use the development container automatically. +1. [`devcontainer` CLI](https://github.com/devcontainers/cli). Once installed, the local clone of `container-image-csi-driver` folder and run `devcontainer up --workspace-folder .` followed by `devcontainer exec --workspace-folder . /bin/bash` to get a shell where you can build the code. You can use any editor outside the container to edit code; any changes will be mirrored inside the container. 1. [GitHub Codespaces](https://github.com/codespaces). You can start editing as soon as VSCode is open. Once you have entered the container, continue to [Developing Locally](#developing-locally). @@ -28,7 +28,7 @@ To build on your own machine without using the Dev Container you will need: ## Developing locally -_**Note:** Unless specified otherwise, you need to run all commands after changing your working directory to this repository - `cd /path/to/csi-driver-image-repository`_ +_**Note:** Unless specified otherwise, you need to run all commands after changing your working directory to this repository - `cd /path/to/container-image-csi-driver-repository`_ 1. First, make sure you can connect to the Kubernetes cluster by following the quickstart guide of your chosen local Kubernetes cluster provider. ``` @@ -36,7 +36,7 @@ _**Note:** Unless specified otherwise, you need to run all commands after changi ``` Make sure you don't see any errors in your terminal. If do get error(s), please check the quickstart guide or the local Kubernetes cluster provider's documentation on how to get started. -1. Install the csi-driver-image using the helm chart. +1. Install the container-image-csi-driver using the helm chart. ``` helm upgrade --install wm-csi \ charts/warm-metal-csi-driver \ diff --git a/go.mod b/go.mod index 3b5fb75..d93901d 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/warm-metal/csi-driver-image +module github.com/warm-metal/container-image-csi-driver go 1.19 @@ -8,9 +8,11 @@ require ( github.com/containerd/containerd v1.6.8 github.com/containers/storage v1.43.0 github.com/golang/protobuf v1.5.2 + github.com/google/uuid v1.2.0 github.com/mitchellh/go-ps v1.0.0 github.com/opencontainers/image-spec v1.1.0-rc2 github.com/pkg/errors v0.9.1 + github.com/prometheus/client_golang v1.12.1 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.8.0 github.com/warm-metal/csi-drivers v0.5.0-alpha.0.0.20210404173852-9ec9cb097dd2 @@ -67,7 +69,6 @@ require ( github.com/google/go-cmp v0.5.8 // indirect github.com/google/go-intervals v0.0.2 // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/google/uuid v1.2.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/imdario/mergo v0.3.12 // indirect @@ -93,7 +94,6 @@ require ( github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 // indirect github.com/opencontainers/selinux v1.10.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_golang v1.12.1 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.32.1 // indirect github.com/prometheus/procfs v0.7.3 // indirect diff --git a/hack/ci/build.sh b/hack/ci/build.sh index cf3177d..1dfcd8e 100755 --- a/hack/ci/build.sh +++ b/hack/ci/build.sh @@ -3,7 +3,7 @@ set -e set -x VERSION=$(git rev-parse --short HEAD) -IMG=docker.io/warmmetal/csi-image:${VERSION} +IMG=docker.io/warmmetal/container-image-csi-driver:${VERSION} BUILDER=$(docker buildx ls | grep ci-builderx || true) [ "${BUILDER}" != "" ] || docker buildx create \ --name ci-builderx --driver docker-container \ @@ -13,4 +13,4 @@ docker buildx use ci-builderx docker buildx build -t ${IMG} -o "type=oci,dest=csi-image.tar" . kind load image-archive csi-image.tar -n kind-${GITHUB_RUN_ID} docker buildx build --target install-util -o "type=local,dest=_output/" . -set +e \ No newline at end of file +set +e diff --git a/hack/ci/install_driver.sh b/hack/ci/install_driver.sh index e01a1e4..cfe175f 100755 --- a/hack/ci/install_driver.sh +++ b/hack/ci/install_driver.sh @@ -4,7 +4,7 @@ source $(dirname "$0")/../lib/cluster.sh set -e -IMG=docker.io/warmmetal/csi-image:$(git rev-parse --short HEAD) +IMG=docker.io/warmmetal/container-image-csi-driver:$(git rev-parse --short HEAD) lib::install_driver ${IMG} set +e diff --git a/hack/ci/setup_docker_cluster.sh b/hack/ci/setup_docker_cluster.sh index 916a8ec..d2775a5 100755 --- a/hack/ci/setup_docker_cluster.sh +++ b/hack/ci/setup_docker_cluster.sh @@ -7,7 +7,7 @@ lib::start_cluster_docker $@ set -e echo "Install a private registry" lib::install_private_registry -minikube ssh -p csi-image-test -- sudo ctr -n k8s.io i pull docker.io/warmmetal/csi-image-test:simple-fs -minikube ssh -p csi-image-test -- sudo ctr -n k8s.io i tag --force docker.io/warmmetal/csi-image-test:simple-fs localhost:31000/warmmetal/csi-image-test:simple-fs +minikube ssh -p csi-image-test -- sudo ctr -n k8s.io i pull docker.io/warmmetal/container-image-csi-driver-test:simple-fs +minikube ssh -p csi-image-test -- sudo ctr -n k8s.io i tag --force docker.io/warmmetal/container-image-csi-driver-test:simple-fs localhost:31000/warmmetal/csi-image-test:simple-fs minikube ssh -p csi-image-test -- sudo ctr -n k8s.io i push localhost:31000/warmmetal/csi-image-test:simple-fs --plain-http --user warmmetal:warmmetal set +e diff --git a/hack/ci/setup_private_registry.sh b/hack/ci/setup_private_registry.sh index 138e21c..863cd53 100755 --- a/hack/ci/setup_private_registry.sh +++ b/hack/ci/setup_private_registry.sh @@ -5,8 +5,8 @@ source $(dirname "$0")/../lib/cluster.sh set -e echo "Install a private registry" lib::install_private_registry -docker pull docker.io/warmmetal/csi-image-test:simple-fs -docker tag docker.io/warmmetal/csi-image-test:simple-fs localhost:5000/warmmetal/csi-image-test:simple-fs +docker pull docker.io/warmmetal/container-image-csi-driver-test:simple-fs +docker tag docker.io/warmmetal/container-image-csi-driver-test:simple-fs localhost:5000/warmmetal/csi-image-test:simple-fs docker login -u warmmetal -p warmmetal localhost:5000 docker push localhost:5000/warmmetal/csi-image-test:simple-fs set +e diff --git a/hack/helper/prepare_containerd_cluster.sh b/hack/helper/prepare_containerd_cluster.sh index 7a4cc2e..e8be61a 100755 --- a/hack/helper/prepare_containerd_cluster.sh +++ b/hack/helper/prepare_containerd_cluster.sh @@ -11,9 +11,9 @@ lib::install_driver echo "Install a private registry" lib::install_private_registry -minikube ssh -p csi-image-test -- sudo ctr -n k8s.io i pull docker.io/warmmetal/csi-image-test:simple-fs -minikube ssh -p csi-image-test -- sudo ctr -n k8s.io i tag --force docker.io/warmmetal/csi-image-test:simple-fs localhost:31000/warmmetal/csi-image-test:simple-fs +minikube ssh -p csi-image-test -- sudo ctr -n k8s.io i pull docker.io/warmmetal/container-image-csi-driver-test:simple-fs +minikube ssh -p csi-image-test -- sudo ctr -n k8s.io i tag --force docker.io/warmmetal/container-image-csi-driver-test:simple-fs localhost:31000/warmmetal/csi-image-test:simple-fs minikube ssh -p csi-image-test -- sudo ctr -n k8s.io i push localhost:31000/warmmetal/csi-image-test:simple-fs --plain-http --user warmmetal:warmmetal set +x -set +e \ No newline at end of file +set +e diff --git a/hack/lib/cluster.sh b/hack/lib/cluster.sh index f8ecbea..59c61a8 100755 --- a/hack/lib/cluster.sh +++ b/hack/lib/cluster.sh @@ -80,7 +80,7 @@ function lib::install_driver() { local manifest=$(lib::gen_manifests $2) echo "${manifest}" | kubectl delete --ignore-not-found -f - if [ "${image}" != "" ]; then - echo "${manifest}" | sed "s|image: docker.io/warmmetal/csi-image.*|image: ${image}|" | kubectl apply -f - + echo "${manifest}" | sed "s|image: docker.io/warmmetal/container-image-csi-driver.*|image: ${image}|" | kubectl apply -f - else echo "${manifest}" | kubectl apply -f - fi @@ -101,7 +101,7 @@ function lib::install_private_registry() { if [ "$(docker inspect -f='{{json .NetworkSettings.Networks.kind}}' 'private-registry')" = 'null' ]; then docker network connect "kind" "private-registry" fi - + cat < bash ``` For example: ```shell -$ docker exec -it 7769b9e621f1 bash ~ +$ docker exec -it 7769b9e621f1 bash ~ root@7769b9e621f1:/go# ``` @@ -69,7 +69,7 @@ I1108 10:27:13.225907 19936 mounter.go:45] load 0 snapshots from runtime I1108 10:27:13.235697 19936 server.go:108] Listening for connections on address: &net.UnixAddr{Name:"//csi/csi.sock", Net:"unix"} ... PASS -ok github.com/warm-metal/csi-driver-image/cmd/plugin 46.711s +ok github.com/warm-metal/container-image-csi-driver/cmd/plugin 46.711s ``` **To test `TestPull`**: @@ -78,6 +78,6 @@ ok github.com/warm-metal/csi-driver-image/cmd/plugin 46.711s root@cdf7ee254501:~# cd /code/pkg/remoteimage root@cdf7ee254501:/code/pkg/remoteimage# go test -run 'TestPull' PASS -ok github.com/warm-metal/csi-driver-image/pkg/remoteimage 2.247s +ok github.com/warm-metal/container-image-csi-driver/pkg/remoteimage 2.247s root@cdf7ee254501:/code/pkg/remoteimage# -``` \ No newline at end of file +``` diff --git a/test/integration/test-in-minikube-cri-o.sh b/test/integration/test-in-minikube-cri-o.sh index 6398672..7c85555 100755 --- a/test/integration/test-in-minikube-cri-o.sh +++ b/test/integration/test-in-minikube-cri-o.sh @@ -10,8 +10,8 @@ lib::install_driver echo "Install a private registry" lib::install_private_registry -minikube ssh -p csi-image-test -- sudo podman pull docker.io/warmmetal/csi-image-test:simple-fs -minikube ssh -p csi-image-test -- sudo podman image tag docker.io/warmmetal/csi-image-test:simple-fs localhost:31000/warmmetal/csi-image-test:simple-fs +minikube ssh -p csi-image-test -- sudo podman pull docker.io/warmmetal/container-image-csi-driver-test:simple-fs +minikube ssh -p csi-image-test -- sudo podman image tag docker.io/warmmetal/container-image-csi-driver-test:simple-fs localhost:31000/warmmetal/csi-image-test:simple-fs minikube ssh -p csi-image-test -- sudo podman push localhost:31000/warmmetal/csi-image-test:simple-fs --tls-verify=false --creds warmmetal:warmmetal source $(dirname "${BASH_SOURCE[0]}")/cases.sh @@ -19,4 +19,4 @@ source $(dirname "${BASH_SOURCE[0]}")/cases.sh lib::uninstall_driver echo "Destroying cluster" minikube delete -p csi-image-test -set +e \ No newline at end of file +set +e diff --git a/test/integration/test-in-minikube-docker.sh b/test/integration/test-in-minikube-docker.sh index 3bdcc03..5a2050e 100755 --- a/test/integration/test-in-minikube-docker.sh +++ b/test/integration/test-in-minikube-docker.sh @@ -10,8 +10,8 @@ lib::install_driver echo "Install a private registry" lib::install_private_registry -minikube ssh -p csi-image-test -- sudo ctr -n k8s.io i pull docker.io/warmmetal/csi-image-test:simple-fs -minikube ssh -p csi-image-test -- sudo ctr -n k8s.io i tag --force docker.io/warmmetal/csi-image-test:simple-fs localhost:31000/warmmetal/csi-image-test:simple-fs +minikube ssh -p csi-image-test -- sudo ctr -n k8s.io i pull docker.io/warmmetal/container-image-csi-driver-test:simple-fs +minikube ssh -p csi-image-test -- sudo ctr -n k8s.io i tag --force docker.io/warmmetal/container-image-csi-driver-test:simple-fs localhost:31000/warmmetal/csi-image-test:simple-fs minikube ssh -p csi-image-test -- sudo ctr -n k8s.io i push localhost:31000/warmmetal/csi-image-test:simple-fs --plain-http --user warmmetal:warmmetal source $(dirname "${BASH_SOURCE[0]}")/cases.sh @@ -19,4 +19,4 @@ source $(dirname "${BASH_SOURCE[0]}")/cases.sh lib::uninstall_driver echo "Destroying cluster" minikube delete -p csi-image-test -set +e \ No newline at end of file +set +e diff --git a/test/sanity/Dockerfile b/test/sanity/Dockerfile index d49b704..0d3e419 100644 --- a/test/sanity/Dockerfile +++ b/test/sanity/Dockerfile @@ -1,10 +1,10 @@ FROM docker.io/library/golang:1.16 -WORKDIR /go/src/csi-driver-image +WORKDIR /go/src/container-image-csi-driver COPY go.mod go.sum ./ RUN go mod download COPY sanity_test.go . -CMD go test -v ./... -ginkgo.skip='.*\[Controller\s+Server\].*' \ No newline at end of file +CMD go test -v ./... -ginkgo.skip='.*\[Controller\s+Server\].*'