-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
Description
Expected Behavior
When a PipelineRun uses a volumeClaimTemplate workspace without specifying storageClassName, the created PVC should omit the storageClassName field entirely. This allows Kubernetes to use the cluster default StorageClass.
Actual Behavior
The PVC is created with storageClassName: '' (empty string). Kubernetes interprets an empty string as "explicitly no StorageClass", which prevents the PVC from binding to a PV.
# Created PVC (broken)
spec:
storageClassName: '' # Should be absent, not empty stringSteps to Reproduce the Problem
- Create a Pipeline with a workspace:
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: test-pipeline
spec:
workspaces:
- name: shared-data
tasks:
- name: test-task
workspaces:
- name: shared-data
taskSpec:
workspaces:
- name: shared-data
steps:
- name: test
image: busybox
script: echo "test"- Create a PipelineRun with
volumeClaimTemplate(nostorageClassName):
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: test-run
spec:
pipelineRef:
name: test-pipeline
workspaces:
- name: shared-data
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi- Inspect the created PVC:
kubectl get pvc -o yaml | grep storageClassName- Observe
storageClassName: ''instead of the field being absent
Additional Info
- Kubernetes version:
1.27+
- Tekton Pipeline version:
Regression between v0.56.x (working) and v0.59.x (broken)
Possible root cause:
The StorageClassName field in PersistentVolumeClaimSpec is a *string. When the pointer is:
nil→ field omitted from JSON (correct)- points to
""→ serialized asstorageClassName: ""(bug)
The PVC creation logic in pkg/reconciler/volumeclaim/pvchandler.go or the deepcopy may be inadvertently setting an empty string pointer instead of preserving nil.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
Type
Projects
Status
Todo