Skip to content

Conversation

@Sapd
Copy link
Contributor

@Sapd Sapd commented Aug 29, 2025

Description

Proper error when trying to resize volume.

Return properly FAILED_PRECODITION: https://github.com/kubernetes-csi/external-resizer/blob/f28f38ba2a7a3375c279d041973ddcb1d76e9bc4/pkg/controller/controller.go#L681

I also added a Podman build file. I could not use Docker for licensing reasons and the Docker Podman compatibility layer does not support buildX.
Without buildx or (in podman) --platform parameter, resizing does not work fully when the container was compiled on Mac, because then the ext4 resize tools are then in ARM64 form and make an error. (So the GOARCH parameter is not enough, the container itself has to use amd64).

Checklist

(For exoscale contributors)

  • Changelog updated (under Unreleased block)
  • Integration tests OK

Testing

Testing Steps:

  1. kubectl apply -f test-volume-resize.yaml
  2. kubectl patch pvc test-volume-resize-new -p '{"spec":{"resources":{"requests":{"storage":"30Gi"}}}}'
  3. kubectl describe pvc test-volume-resize-new # See error messages
  4. kubectl scale deployment test-resize-app --replicas=0 # Detach volume
  5. kubectl get pvc test-volume-resize-new # Should show 30Gi after resize completes. This might take a bit until Kubernetes retries.
  6. kubectl delete -f test-volume-resize.yaml # Cleanup

Test logs:

  Normal   FileSystemResizeSuccessful  2m44s (x4 over 47m)    kubelet                            MountVolume.NodeExpandVolume succeeded for volume "pvc-5c72c766-9481-4540-84f6-5f9a80fef405" pool-c2319-rjnin
  Normal   ExternalExpanding           2m28s (x3 over 99m)    volume_expand                      waiting for an external controller to expand this PVC
  Warning  VolumeResizeFailed          2m21s (x4 over 2m27s)  external-resizer csi.exoscale.com  Unable to expand default/test-resize-pvc because CSI driver csi.exoscale.com only supports offline expansion and volume is currently in-use
  Warning  VolumeResizeFailed          2m13s (x2 over 2m28s)  external-resizer csi.exoscale.com  resize volume "pvc-5c72c766-9481-4540-84f6-5f9a80fef405" by resizer "csi.exoscale.com" failed: rpc error: code = FailedPrecondition desc = Volume must be detached before expanding (attached to instance ae72b31a-313a-4b2e-9195-bc52f4eb3281). Scale down workloads using this PVC, then resize will complete automatically once Kubernetes retries.
  Normal   Resizing                    101s (x3 over 2m29s)   external-resizer csi.exoscale.com  External resizer is resizing volume pvc-5c72c766-9481-4540-84f6-5f9a80fef405
  Normal   FileSystemResizeRequired    101s                   external-resizer csi.exoscale.com  Require file system resize of volume on node

VolumeResizeFailed will still loop, but use the kubernetes backing off timer, which should be fine.

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: test-volume-resize-new
  namespace: default
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: exoscale-sbs
  resources:
    requests:
      storage: 15Gi

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-resize-app
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: test-resize-app
  template:
    metadata:
      labels:
        app: test-resize-app
    spec:
      containers:
      - name: test-app
        image: nginx:alpine
        volumeMounts:
        - name: test-volume
          mountPath: /data
        - name: temp-volume  
          mountPath: /tmp
        resources:
          requests:
            memory: "64Mi"
            cpu: "50m"
          limits:
            memory: "128Mi" 
            cpu: "100m"
        # Write some data to the volume for testing
        lifecycle:
          postStart:
            exec:
              command:
              - /bin/sh
              - -c
              - |
                echo "Test data written at $(date)" > /data/test-file.txt
                df -h /data
      volumes:
      - name: test-volume
        persistentVolumeClaim:
          claimName: test-volume-resize-new
      - name: temp-volume
        emptyDir: {}

+ podman build files
@Sapd Sapd force-pushed the csi-offline-resize branch from 8b51076 to 9ed565e Compare August 29, 2025 13:26
@pierre-emmanuelJ pierre-emmanuelJ requested a review from a team September 2, 2025 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant