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..df343d7 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 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. @@ -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/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/pkg/backend/containerd/containerd.go b/pkg/backend/containerd/containerd.go index 6227aaf..7b15463 100644 --- a/pkg/backend/containerd/containerd.go +++ b/pkg/backend/containerd/containerd.go @@ -13,7 +13,7 @@ import ( "github.com/containerd/containerd/reference/docker" "github.com/containerd/containerd/snapshots" "github.com/opencontainers/image-spec/identity" - "github.com/warm-metal/csi-driver-image/pkg/backend" + "github.com/warm-metal/container-image-csi-driver/pkg/backend" "k8s.io/klog/v2" ) diff --git a/pkg/backend/crio/crio.go b/pkg/backend/crio/crio.go index 6c7e3a4..f7bb9b2 100644 --- a/pkg/backend/crio/crio.go +++ b/pkg/backend/crio/crio.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "io" - "net" "net/http" "reflect" @@ -14,7 +13,7 @@ import ( "github.com/containerd/containerd/reference/docker" "github.com/containers/storage" "github.com/containers/storage/types" - "github.com/warm-metal/csi-driver-image/pkg/backend" + "github.com/warm-metal/container-image-csi-driver/pkg/backend" "k8s.io/klog/v2" k8smount "k8s.io/utils/mount" ) diff --git a/pkg/mountexecutor/mountexecutor.go b/pkg/mountexecutor/mountexecutor.go index 62548af..540b8b6 100644 --- a/pkg/mountexecutor/mountexecutor.go +++ b/pkg/mountexecutor/mountexecutor.go @@ -8,10 +8,10 @@ import ( "github.com/container-storage-interface/spec/lib/go/csi" "github.com/containerd/containerd/reference/docker" - "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/mountstatus" - "github.com/warm-metal/csi-driver-image/pkg/pullstatus" + "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/mountstatus" + "github.com/warm-metal/container-image-csi-driver/pkg/pullstatus" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/klog/v2" ) @@ -59,7 +59,6 @@ func NewMountExecutor(o *MountExecutorOptions) *MountExecutor { // StartMounting starts the mounting func (m *MountExecutor) StartMounting(o *MountOptions) error { - o.Logger.Info("Mounting image", "image", o.NamedRef.Name()) if pullstatus.Get(o.NamedRef) != pullstatus.Pulled || mountstatus.Get(o.TargetPath) == mountstatus.StillMounting { o.Logger.Info("Could not mount image because image hasn't finshed pulling or volume is still mounting", diff --git a/pkg/pullexecutor/pullexecutor.go b/pkg/pullexecutor/pullexecutor.go index 301e216..8ca0f73 100644 --- a/pkg/pullexecutor/pullexecutor.go +++ b/pkg/pullexecutor/pullexecutor.go @@ -8,11 +8,11 @@ import ( "github.com/containerd/containerd/reference/docker" "github.com/pkg/errors" - "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/pullstatus" - "github.com/warm-metal/csi-driver-image/pkg/remoteimage" - "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/pullstatus" + "github.com/warm-metal/container-image-csi-driver/pkg/remoteimage" + "github.com/warm-metal/container-image-csi-driver/pkg/secret" "k8s.io/apimachinery/pkg/util/wait" cri "k8s.io/cri-api/pkg/apis/runtime/v1" "k8s.io/klog/v2" @@ -67,7 +67,6 @@ func NewPullExecutor(o *PullExecutorOptions) *PullExecutor { // StartPulling starts pulling the image func (m *PullExecutor) StartPulling(o *PullOptions) error { - keyring, err := m.secretStore.GetDockerKeyring(o.Context, o.PullSecrets) if err != nil { return errors.Errorf("unable to fetch keyring: %s", err) diff --git a/pkg/remoteimage/pull_test.go b/pkg/remoteimage/pull_test.go index 0d8809f..d9b3832 100644 --- a/pkg/remoteimage/pull_test.go +++ b/pkg/remoteimage/pull_test.go @@ -6,7 +6,7 @@ import ( "time" "github.com/stretchr/testify/assert" - "github.com/warm-metal/csi-driver-image/pkg/cri" + "github.com/warm-metal/container-image-csi-driver/pkg/cri" v1 "k8s.io/cri-api/pkg/apis/runtime/v1" ) diff --git a/test/e2e/Dockerfile b/test/e2e/Dockerfile index e9cd0b0..a9a026d 100644 --- a/test/e2e/Dockerfile +++ b/test/e2e/Dockerfile @@ -1,6 +1,6 @@ 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 @@ -11,4 +11,4 @@ COPY id_rsa* /root/.ssh/ COPY *.go . -ENTRYPOINT go run . \ No newline at end of file +ENTRYPOINT go run . diff --git a/test/integration/backward-compatability.sh b/test/integration/backward-compatability.sh index c75fb4d..2a48c76 100755 --- a/test/integration/backward-compatability.sh +++ b/test/integration/backward-compatability.sh @@ -2,7 +2,7 @@ set -e source $(dirname "${BASH_SOURCE[0]}")/../../hack/lib/cluster.sh -lib::install_driver_from_manifest_file 'https://raw.githubusercontent.com/warm-metal/csi-driver-image/v0.4.2/install/cri-containerd.yaml' +lib::install_driver_from_manifest_file 'https://raw.githubusercontent.com/warm-metal/container-image-csi-driver/v0.4.2/install/cri-containerd.yaml' TestBase=$(dirname "${BASH_SOURCE[0]}") kubectl apply -f "${TestBase}/compatible-manifests/ephemeral-volume.yaml" @@ -11,7 +11,7 @@ kubectlwait default compatible-ephemeral-volume kubectl apply -f "${TestBase}/compatible-manifests/pre-provisioned-pv.yaml" kubectlwait default compatible-pre-provisioned-pv -kubectl delete --ignore-not-found -f 'https://raw.githubusercontent.com/warm-metal/csi-driver-image/v0.4.2/install/cri-containerd.yaml' +kubectl delete --ignore-not-found -f 'https://raw.githubusercontent.com/warm-metal/container-image-csi-driver/v0.4.2/install/cri-containerd.yaml' export VALUE_FILE=$(dirname "${BASH_SOURCE[0]}")/../../charts/warm-metal-csi-driver/values.yaml export IMAGE_TAG=$(git rev-parse --short HEAD) @@ -35,4 +35,4 @@ kubectl delete -f "${TestBase}/compatible-manifests/ephemeral-volume.yaml" kubectl delete --ignore-not-found -f "${TestBase}/compatible-manifests/pre-provisioned-pv.yaml" helm uninstall -n kube-system ${HELM_NAME} --wait -set +e \ No newline at end of file +set +e diff --git a/test/integration/node-server/README.md b/test/integration/node-server/README.md index 4e42121..a15c24e 100644 --- a/test/integration/node-server/README.md +++ b/test/integration/node-server/README.md @@ -1,4 +1,4 @@ -## What is this? +## What is this? This directory contains two files: 1. `docker-compose.yaml`: used to mount workspace on image built using `Dockerfile.containerd` 2. `Dockerfile.containerd`: used to run containerd @@ -26,7 +26,7 @@ For example: $ docker-compose up [+] Building 0.0s (0/0) docker:desktop-linux [+] Running 1/0 - ✔ Container node-server-containerd-workspace-1 Recreated 0.0s + ✔ Container node-server-containerd-workspace-1 Recreated 0.0s Attaching to node-server-containerd-workspace-1 node-server-containerd-workspace-1 | time="2023-11-08T09:03:00Z" level=warning msg="containerd config version `1` has been deprecated and will be removed in containerd v2.0, please switch to version `2`, see https://github.com/containerd/containerd/blob/main/docs/PLUGINS.md#version-header" node-server-containerd-workspace-1 | time="2023-11-08T09:03:00.484125750Z" level=info msg="starting containerd" revision=61f9fd88f79f081d64d6fa3bb1a0dc71ec870523 version=1.6.24 @@ -51,7 +51,7 @@ $ docker exec -it 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/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\].*'