Skip to content

[cinder-csi-plugin] cinder-csi-plugin image lacks of /bin/sh #2875

Open
@ybelleguic

Description

@ybelleguic

/kind bug

Hello everyone

What happened:

I'm evaluating openstack-cinder-csi as a CSI provider for my kubernetes cluster and I couldn't resize my PVC.

When looking at the openstack-cinder-csi-nodeplugin pod logs, I found the following error message :

I0404 09:45:04.087521      12 mount_linux.go:542] Checking for issues with fsck on disk: /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_eb7b56ee-343e-40a9-9aa6-313f418d324c
I0404 09:45:04.108998      12 mount_linux.go:555] `fsck` error fsck from util-linux 2.37.2
fsck: /sbin/fsck.xfs: execute failed: No such file or directory

The binary /sbin/fsck.xfs is present on the docker image (see tools/csi-deps-check.sh) but /sbin/fsck.xfs is a shell script asking for /bin/sh :

 ~  file /sbin/fsck.xfs
/sbin/fsck.xfs: POSIX shell script, ASCII text executable
 ~  head /sbin/fsck.xfs
#!/bin/sh -f
#
# Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
#

NAME=$0

# get the right return code for fsck
repair2fsck_code() {
        case $1 in

I created a custom debian based docker image (no distroless, with all the bash/sh utilities) and put the cinder-csi-plugin binary on it and didn't have encounter the problem after that.

What you expected to happen:

My PVC to be resized

How to reproduce it:

Create a XFS storage class, a PVC and a deployment using the PVC :

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: csi-cinder-sc-delete-netapp-xfs
allowVolumeExpansion: true
allowedTopologies:
- matchLabelExpressions:
  - key: topology.cinder.csi.openstack.org/zone
    values:
    - DC1
    - DC2
parameters:
  csi.storage.k8s.io/fstype: xfs
  availability: nova
  type: XXXX
provisioner: cinder.csi.openstack.org
reclaimPolicy: Delete
volumeBindingMode: Immediate
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: httpbin
  namespace: bench-csi
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  storageClassName: csi-cinder-sc-delete-netapp-xfs
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: httpbin
  namespace: bench-csi
spec:
  replicas: 1
  selector:
    matchLabels:
      app: httpbin
  template:
    metadata:
      labels:
        app: httpbin
    spec:
      containers:
      - name: httpbin
        image: kennethreitz/httpbin
        volumeMounts:
        - mountPath: /data
          name: data-volume
        ports:
        - containerPort: 80
        resources:
          requests:
            memory: "1Gi"
            cpu: "1000m"
          limits:
            memory: "2Gi"
            cpu: "2000m"
        livenessProbe:
          httpGet:
            path: /status/200
            port: 80
          initialDelaySeconds: 3
          periodSeconds: 3
      volumes:
      - name: data-volume
        persistentVolumeClaim:
          claimName: httpbin

Run the df -h command into the pod :

kubectl exec -it $(kgp -l app=httpbin --no-headers |awk '{print $1}') -- bash -c "df -h |grep data"
/dev/sdb        960M   39M  922M   5% /data

Patch the PVC size and re run the df -h command :

kubectl patch pvc httpbin -p '{"spec":{"resources":{"requests":{"storage":"5Gi"}}}}'
kubectl exec -it $(kgp -l app=httpbin --no-headers |awk '{print $1}') -- bash -c "df -h |grep data"
/dev/sdb        960M   39M  922M   5% /data

Anything else we need to know?:

Environment:

  • openstack-cloud-controller-manager(or other related binary) version: 2.32.0
  • OpenStack version: Yoga
  • Others:

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions