VolumeID is incorrect when project name contains beta
hoozecn opened this issue · 2 comments
We created a GKE cluster in our project named xxxxx-beta and tried to create a statefulset with persistentvolume.
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: web
spec:
serviceName: "nginx"
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:stable
ports:
- containerPort: 80
volumeMounts:
- name: www
mountPath: /usr/share/nginx/html
volumeClaimTemplates:
- metadata:
name: www
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: "standard-rwo"
resources:
requests:
storage: 10Gi
The PVC and PV were created and bound as expected, but the volume could not be attached to the pod due to the following reason:
AttachVolume.Attach failed for volume "pvc-c970f876-7563-4ef8-ad77-e1aafc02ff69" : rpc error: code = InvalidArgument desc = ControllerPublishVolume volume ID is invalid: failed to get id components. Expected projects/{project}/zones/{zone}/disks/{name}. Got: zones/asia-southeast1-c/disks/pvc-c970f876-7563-4ef8-ad77-e1aafc02ff69
GKE version: 1.27.2-gke.1200
pd-csi version: v1.10.3
After some investigation, we found that the value of .spec.csi.volumeHandle field of PV stared with
zones/asia-southeast1-c
instead of
project/xxxxx-beta.
Seems it's replaced by the regex here
Great find, thanks for making the PR, I'm looking at it now.