Skip to content

VolumeID is incorrect when project name contains beta #1302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hoozecn opened this issue Jul 20, 2023 · 2 comments · Fixed by #1304
Closed

VolumeID is incorrect when project name contains beta #1302

hoozecn opened this issue Jul 20, 2023 · 2 comments · Fixed by #1304

Comments

@hoozecn
Copy link

hoozecn commented Jul 20, 2023

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

@hoozecn
Copy link
Author

hoozecn commented Jul 20, 2023

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

func cleanSelfLink(selfLink string) string {

@mattcary
Copy link
Contributor

Great find, thanks for making the PR, I'm looking at it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants