Skip to content

Commit

Permalink
chore: update go references for old repository name (#127)
Browse files Browse the repository at this point in the history
* Update go.mod
* Update package imports
* Update Dockerfiles
* Update docs
* Update scripts
* Update README

Co-authored-by: Mriyam Tamuli <[email protected]>
  • Loading branch information
mugdha-adhav and mbtamuli authored Jan 22, 2024
1 parent 03636ae commit 282bd48
Show file tree
Hide file tree
Showing 18 changed files with 81 additions and 85 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"]
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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.

Expand Down Expand Up @@ -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/).

Expand All @@ -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.)

Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion cmd/plugin/controller_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
17 changes: 8 additions & 9 deletions cmd/plugin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
14 changes: 7 additions & 7 deletions cmd/plugin/node_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/plugin/node_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
20 changes: 10 additions & 10 deletions docs/automation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/<repository-name>`

## 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/<repository-name>` 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`
Expand Down
10 changes: 5 additions & 5 deletions docs/running-locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -28,15 +28,15 @@ 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.
```
$ kubectl get nodes
```
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 \
Expand Down
Loading

0 comments on commit 282bd48

Please sign in to comment.