fix: validate referenced volumes in PipelineRun executor before creation - #2341
fix: validate referenced volumes in PipelineRun executor before creation#2341mohit-bhandari45 wants to merge 4 commits into
Conversation
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@mohit-bhandari45 please sign your commits |
Signed-off-by: mohit-bhandari45 <mohitbhandari852@gmail.com>
Signed-off-by: mohit-bhandari45 <mohitbhandari852@gmail.com>
Signed-off-by: mohit-bhandari45 <mohitbhandari852@gmail.com>
Signed-off-by: mohit-bhandari45 <mohitbhandari852@gmail.com>
00f26e5 to
3f480a4
Compare
|
@kaizakin Almost forget, done now. |
Changes
The
PipelineRunexecutor mode did not validate referenced volumes (Secrets, ConfigMaps, Projected volumes) before creating thePipelineRunresource in Kubernetes.During reconciliation,
validateExecutorVolumescalledGetUnderlyingTaskRunson theImageBuildRunner. For aPipelineRun,GetUnderlyingTaskRunsinspectsPipelineRun.Status.ChildReferences. However, before thePipelineRunis created in Kubernetes,Status.ChildReferencesis empty, causingGetUnderlyingTaskRunsto return an empty list and volume validation to be completely skipped.As a result, a
BuildorBuildRunreferencing a non-existent Secret or ConfigMap would proceed to create thePipelineRunin Kubernetes instead of failing early withReason: VolumeDoesNotExist.Solution
CheckVolumesExist(ctx, client, namespace, volumes)inresources/volumes.go.CheckPipelineRunVolumesExist(ctx, client, pipelineRun)to iterate overpipelineRun.Spec.PipelineSpec.Tasks(and.Finally) and validate embedded task volumes directly against Kubernetes before resource creation.validateExecutorVolumesinbuildrun.goto inspect theImageBuildRunnertype and validateTektonPipelineRunWrappervolumes directly.resources/volumes_test.goand reconciler volume validation failure inbuildrun_test.go.Related Issue
Fixes #2325
Type of PR
/kind bug
Submitter Checklist
Release Notes