-
Notifications
You must be signed in to change notification settings - Fork 668
Open
Labels
lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.Denotes an issue or PR has remained open with no activity and has become stale.
Description
example yaml.
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshot
metadata:
annotations:
snapshot.storage.kubernetes.io/pvc-access-modes: ReadWriteMany
snapshot.storage.kubernetes.io/pvc-storage-class: fa-direct-access
snapshot.storage.kubernetes.io/pvc-volume-mode: Block
resourceVersion: '28282087'
name: pg1.2.px-f5cd27d7-pvc-f11e88b4-09cd-495f-a351-aa8a87dd928c
uid: a76b414e-9f0a-45bd-9bdc-49a80e307f89
creationTimestamp: '2025-10-01T23:16:30Z'
namespace: xyang
finalizers:
- snapshot.storage.kubernetes.io/volumesnapshot-as-source-protection
spec:
source:
volumeSnapshotContentName: snapcontent-pg1.2.px-f5cd27d7-pvc-f11e88b4-09cd-495f-a351-aa8a87dd928c
status:
boundVolumeSnapshotContentName: snapcontent-pg1.2.px-f5cd27d7-pvc-f11e88b4-09cd-495f-a351-aa8a87dd928c
creationTime: '2025-10-01T23:16:30Z'
readyToUse: true
the code assumes these annotations exist
snapshot.storage.kubernetes.io/pvc-access-modes: ReadWriteMany
snapshot.storage.kubernetes.io/pvc-storage-class: fa-direct-access
snapshot.storage.kubernetes.io/pvc-volume-mode: Block
but even if I add these, the modal fails to show up with error
k8s-get-hook.ts:20 TypeError: Cannot read properties of undefined (reading 'title')
at h (access-mode.tsx:63:79)
const [selected, setSelected] = React.useState<string>(
getAccessModeOptions().find((mode) => mode.value === pvcInitialAccessMode[0]).title, <----
);
this is because in restore-pvc-modal.tsx
const [pvcResource, pvcResourceLoaded, pvcResourceLoadError] = useK8sGet<
PersistentVolumeClaimKind
>(PersistentVolumeClaimModel, resource?.spec?.source?.persistentVolumeClaimName, namespace);
this will query a list of PVCs if resource.spec.source.persistentVolumeClaimName doesn't exist, which breaks assumption for all the callers.
const pvcInitialAccessMode = pvcResource
? getPVCAccessModes(pvcResource, 'value')
: availableAccessModes;
getPVCAccessModes(pvcResource, 'value') assumes pvcResouce is a single item, but a list is provided, hence pvcInitialAccessMode is an empty list, causing the undefined error.
Metadata
Metadata
Assignees
Labels
lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.Denotes an issue or PR has remained open with no activity and has become stale.