Skip to content

Commit

Permalink
fix: change csi driver name
Browse files Browse the repository at this point in the history
  • Loading branch information
mugdha-adhav committed Jan 23, 2024
1 parent 90d2006 commit 4ae7de1
Show file tree
Hide file tree
Showing 40 changed files with 172 additions and 172 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RUN make build
RUN make install-util

FROM scratch as install-util
COPY --from=builder /go/src/container-image-csi-driver/_output/warm-metal-container-image-csi-driver-install /
COPY --from=builder /go/src/container-image-csi-driver/_output/container-image-csi-driver-install /

FROM alpine:3.17
RUN apk add --no-cache btrfs-progs-dev lvm2-dev
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ test-deps:
install-util:
GOOS=linux CGO_ENABLED="0" go build \
-ldflags "-X main.Version=$(VERSION) -X main.Registry=$(REGISTRY)" \
-o _output/warm-metal-container-image-csi-driver-install ./cmd/install
-o _output/container-image-csi-driver-install ./cmd/install
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ then mounts images via the snapshot/storage service of the runtime.
## Compatibility matrix
Tested changes on below mentioned versions -

| warm-metal | k8s version | containerd | crio |
| CSI driver | k8s version | containerd | crio |
|------------|-------------|------------|---------|
| 0.6.x | v1.25 | 1.6.8 | v1.20.9 |
| 0.7.x | v1.25 | 1.6.8 | v1.20.9 |
Expand All @@ -52,26 +52,26 @@ Tested changes on below mentioned versions -
## Installation

The driver requires to mount various host paths for different container runtimes.
So, I build a binary utility, `warm-metal-container-image-csi-driver-install`, to reduce the installation complexity.
So, I build a binary utility, `container-image-csi-driver-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/container-image-csi-driver/releases).

```shell script
# To print manifests
warm-metal-container-image-csi-driver-install
container-image-csi-driver-install

# To show the detected configuration
warm-metal-container-image-csi-driver-install --print-detected-instead
container-image-csi-driver-install --print-detected-instead

# To change the default namespace that the driver to be installed in
warm-metal-container-image-csi-driver-install --namespace=foo
container-image-csi-driver-install --namespace=foo

# To set a Secret as the imagepullsecret
warm-metal-container-image-csi-driver-install --pull-image-secret-for-daemonset=foo
container-image-csi-driver-install --pull-image-secret-for-daemonset=foo

# To disable the memroy cache for imagepullsecrets if Secrets are short-lived.
warm-metal-container-image-csi-driver-install --pull-image-secret-for-daemonset=foo --enable-daemon-image-credential-cache=false
container-image-csi-driver-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/container-image-csi-driver/tree/master/sample).
Expand Down Expand Up @@ -116,7 +116,7 @@ spec:
volumes:
- name: target
csi:
driver: container-image.warm-metal.tech
driver: container-image.csi.tech
# nodePublishSecretRef:
# name: "ImagePullSecret name in the same namespace"
volumeAttributes:
Expand All @@ -135,14 +135,14 @@ kind: PersistentVolume
metadata:
name: pv-test-container-image-csi-driver-test-simple-fs
spec:
storageClassName: container-image.warm-metal.tech
storageClassName: container-image.csi.tech
capacity:
storage: 5Gi
accessModes:
- ReadOnlyMany
persistentVolumeReclaimPolicy: Retain
csi:
driver: container-image.warm-metal.tech
driver: container-image.csi.tech
volumeHandle: "docker.io/warmmetal/container-image-csi-driver-test:simple-fs"
# nodePublishSecretRef:
# name: "name of the ImagePullSecret"
Expand All @@ -168,12 +168,12 @@ Otherwise, you need ImagePullSecrets to store your credential. The following lin
- [https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#add-imagepullsecrets-to-a-service-account](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#add-imagepullsecrets-to-a-service-account)

If the secret is desired to be shared by all volumes, you can add it to the ServiceAccount of the driver,
`container-image-warm-metal` by default, and update the Role `container-image-warm-metal` to make sure the daemon has permissions to fetch the secret,
then restart the driver daemon pod. Users can run `warm-metal-container-image-csi-driver-install` to generate new manifests and apply them to update.
`container-image-csi-driver` by default, and update the Role `container-image-csi-driver` to make sure the daemon has permissions to fetch the secret,
then restart the driver daemon pod. Users can run `container-image-csi-driver-install` to generate new manifests and apply them to update.

```shell script
# use secrets foo and bar
warm-metal-container-image-csi-driver-install --pull-image-secret-for-daemonset=foo --pull-image-secret-for-daemonset=bar
container-image-csi-driver-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.
Expand Down
2 changes: 1 addition & 1 deletion charts/warm-metal-csi-driver/templates/csi-driver.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: container-image.warm-metal.tech
name: container-image.csi.tech
labels:
{{- include "warm-metal-csi-driver.labels" . | nindent 4 }}
spec:
Expand Down
6 changes: 3 additions & 3 deletions charts/warm-metal-csi-driver/templates/nodeplugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
- name: node-driver-registrar
args:
- "--csi-address=/csi/csi.sock"
- --kubelet-registration-path={{ .Values.kubeletRoot }}/plugins/container-image.warm-metal.tech/csi.sock
- --kubelet-registration-path={{ .Values.kubeletRoot }}/plugins/container-image.csi.tech/csi.sock
- "-v={{ .Values.logLevel }}"
env:
- name: KUBE_NODE_NAME
Expand All @@ -37,7 +37,7 @@ spec:
command:
- /bin/sh
- -c
- rm -rf /registration/container-image.warm-metal.tech /registration/container-image.warm-metal.tech-reg.sock
- rm -rf /registration/container-image.csi.tech /registration/container-image.csi.tech-reg.sock
{{- with .Values.csiNodeDriverRegistrar.resources }}
resources:
{{- toYaml . | nindent 12 }}
Expand Down Expand Up @@ -126,7 +126,7 @@ spec:
serviceAccountName: {{ include "warm-metal-csi-driver.fullname" . }}-nodeplugin
volumes:
- hostPath:
path: {{ .Values.kubeletRoot }}/plugins/container-image.warm-metal.tech
path: {{ .Values.kubeletRoot }}/plugins/container-image.csi.tech
type: DirectoryOrCreate
name: socket-dir
- hostPath:
Expand Down
28 changes: 14 additions & 14 deletions cmd/install/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ const staticManifests = `---
apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: container-image.warm-metal.tech
name: container-image.csi.tech
spec:
attachRequired: false
podInfoOnMount: true
Expand All @@ -223,7 +223,7 @@ const defaultSAManifests = `---
apiVersion: v1
kind: ServiceAccount
metadata:
name: container-image-warm-metal
name: container-image-csi-driver
namespace: kube-system
---
`
Expand All @@ -232,13 +232,13 @@ const defaultRBACRoleManifests = `---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: container-image-warm-metal
name: container-image-csi-driver
namespace: kube-system
rules:
- apiGroups:
- ""
resourceNames:
- container-image-warm-metal
- container-image-csi-driver
resources:
- serviceaccounts
verbs:
Expand All @@ -250,15 +250,15 @@ const rbacRoleBindingManifests = `---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: container-image-warm-metal
name: container-image-csi-driver
namespace: kube-system
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: container-image-warm-metal
name: container-image-csi-driver
subjects:
- kind: ServiceAccount
name: container-image-warm-metal
name: container-image-csi-driver
namespace: kube-system
---
`
Expand All @@ -267,30 +267,30 @@ const dsTemplate = `---
kind: DaemonSet
apiVersion: apps/v1
metadata:
name: container-image-warm-metal
name: container-image-csi-driver
namespace: kube-system
spec:
selector:
matchLabels:
app: container-image-warm-metal
app: container-image-csi-driver
template:
metadata:
labels:
app: container-image-warm-metal
app: container-image-csi-driver
spec:
hostNetwork: false
serviceAccountName: container-image-warm-metal
serviceAccountName: container-image-csi-driver
containers:
- name: node-driver-registrar
image: quay.io/k8scsi/csi-node-driver-registrar:v1.1.0
imagePullPolicy: IfNotPresent
lifecycle:
preStop:
exec:
command: ["/bin/sh", "-c", "rm -rf /registration/container-image.warm-metal.tech /registration/container-image.warm-metal.tech-reg.sock"]
command: ["/bin/sh", "-c", "rm -rf /registration/container-image.csi.tech /registration/container-image.csi.tech-reg.sock"]
args:
- --csi-address=/csi/csi.sock
- --kubelet-registration-path={{.KubeletRoot}}/plugins/container-image.warm-metal.tech/csi.sock
- --kubelet-registration-path={{.KubeletRoot}}/plugins/container-image.csi.tech/csi.sock
env:
- name: KUBE_NODE_NAME
valueFrom:
Expand Down Expand Up @@ -332,7 +332,7 @@ spec:
name: runtime-socket
volumes:
- hostPath:
path: {{.KubeletRoot}}/plugins/container-image.warm-metal.tech
path: {{.KubeletRoot}}/plugins/container-image.csi.tech
type: DirectoryOrCreate
name: socket-dir
- hostPath:
Expand Down
4 changes: 2 additions & 2 deletions cmd/plugin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
)

const (
driverName = "container-image.warm-metal.tech"
driverName = "container-image.csi.tech"
driverVersion = "v1.0.0"

containerdScheme = "containerd"
Expand Down Expand Up @@ -55,7 +55,7 @@ var (
"Whether to pull images asynchronously (helps prevent timeout for larger images)")
watcherResyncPeriod = flag.Duration("watcher-resync-period", 30*time.Minute, "The resync period of the pvc watcher.")
mode = flag.String("mode", "", "The mode of the driver. Valid values are: node, controller")
nodePluginSA = flag.String("node-plugin-sa", "container-image-warm-metal", "The name of the ServiceAccount used by the node plugin.")
nodePluginSA = flag.String("node-plugin-sa", "container-image-csi-driver", "The name of the ServiceAccount used by the node plugin.")
)

func main() {
Expand Down
11 changes: 5 additions & 6 deletions hack/lib/cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ function lib::start_cluster_docker() {
function lib::gen_manifests() {
local secret=$1
local disableCache=$2
docker cp _output/warm-metal-container-image-csi-driver-install kind-${GITHUB_RUN_ID}-control-plane:/usr/bin/warm-metal-container-image-csi-driver-install
docker cp _output/container-image-csi-driver-install kind-${GITHUB_RUN_ID}-control-plane:/usr/bin/container-image-csi-driver-install
if [[ "${secret}" != "" ]]; then
if [[ "${disableCache}" != "" ]]; then
docker exec kind-${GITHUB_RUN_ID}-control-plane \
warm-metal-container-image-csi-driver-install \
container-image-csi-driver-install \
--enable-daemon-image-credential-cache=false \
--pull-image-secret-for-daemonset=${secret} 2>/dev/null
else
docker exec kind-${GITHUB_RUN_ID}-control-plane \
warm-metal-container-image-csi-driver-install --pull-image-secret-for-daemonset=${secret} 2>/dev/null
container-image-csi-driver-install --pull-image-secret-for-daemonset=${secret} 2>/dev/null
fi
else
docker exec kind-${GITHUB_RUN_ID}-control-plane warm-metal-container-image-csi-driver-install 2>/dev/null
docker exec kind-${GITHUB_RUN_ID}-control-plane container-image-csi-driver-install 2>/dev/null
fi
}

Expand All @@ -72,7 +72,6 @@ function lib::install_driver_from_manifest_file() {
local manifest=$1
kubectl delete --ignore-not-found -f ${manifest}
kubectl apply -f ${manifest}
kubectlwait kube-system -l=app=container-image-warm-metal
}

function lib::install_driver() {
Expand All @@ -84,7 +83,7 @@ function lib::install_driver() {
else
echo "${manifest}" | kubectl apply -f -
fi
kubectlwait kube-system -l=app=container-image-warm-metal
kubectlwait kube-system -l=app=container-image-csi-driver
}

function lib::install_private_registry() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/containerd/containerd.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ func (s snapshotMounter) ListSnapshots(ctx context.Context) (ss []backend.Snapsh
}

const (
labelPrefix = "container-image.warm-metal.tech"
labelPrefix = "container-image.csi.tech"
targetLabelPrefix = labelPrefix + "/target"
volumeIdLabelPrefix = labelPrefix + "/id"
gcLabel = "containerd.io/gc.root"
Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/mounter.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,5 @@ func (s *SnapshotMounter) ImageExists(ctx context.Context, image docker.Named) b
}

func genSnapshotKey(parent string) SnapshotKey {
return SnapshotKey(fmt.Sprintf("container-image.warm-metal.tech-%s", parent))
return SnapshotKey(fmt.Sprintf("container-image.csi.tech-%s", parent))
}
2 changes: 1 addition & 1 deletion sample/ephemeral-volume.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
volumes:
- name: target
csi:
driver: container-image.warm-metal.tech
driver: container-image.csi.tech
volumeAttributes:
image: "docker.io/warmmetal/container-image-csi-driver-test:simple-fs"
# # set pullAlways if you want to ignore local images
Expand Down
Loading

0 comments on commit 4ae7de1

Please sign in to comment.