diff --git a/pkg/pod/pod.go b/pkg/pod/pod.go index d2af9a8cb23..97cb7567ca1 100644 --- a/pkg/pod/pod.go +++ b/pkg/pod/pod.go @@ -152,7 +152,7 @@ func (b *Builder) Build(ctx context.Context, taskRun *v1.TaskRun, taskSpec v1.Ta defaultForbiddenEnv := config.FromContextOrDefaults(ctx).Defaults.DefaultForbiddenEnv alphaAPIEnabled := featureFlags.EnableAPIFields == config.AlphaAPIFields sidecarLogsResultsEnabled := config.FromContextOrDefaults(ctx).FeatureFlags.ResultExtractionMethod == config.ResultExtractionMethodSidecarLogs - enableKeepPodOnCancel := alphaAPIEnabled && featureFlags.EnableKeepPodOnCancel + enableKeepPodOnCancel := featureFlags.EnableKeepPodOnCancel setSecurityContext := config.FromContextOrDefaults(ctx).FeatureFlags.SetSecurityContext // Add our implicit volumes first, so they can be overridden by the user if they prefer. diff --git a/pkg/pod/pod_test.go b/pkg/pod/pod_test.go index 68a9c79ffb5..05afd2ffa9e 100644 --- a/pkg/pod/pod_test.go +++ b/pkg/pod/pod_test.go @@ -2266,7 +2266,7 @@ _EOF_ FieldRef: &corev1.ObjectFieldSelector{ FieldPath: fmt.Sprintf("metadata.annotations['%s']", readyAnnotation), }, - }}, + }, downwardCancelVolumeItem}, }, }, }, corev1.Volume{ diff --git a/pkg/reconciler/taskrun/taskrun.go b/pkg/reconciler/taskrun/taskrun.go index fdbe78cb993..e4e55371502 100644 --- a/pkg/reconciler/taskrun/taskrun.go +++ b/pkg/reconciler/taskrun/taskrun.go @@ -522,7 +522,6 @@ func (c *Reconciler) reconcile(ctx context.Context, tr *v1.TaskRun, rtr *resourc // current labels may not be set on a previously created Pod. labelSelector := labels.Set{pipeline.TaskRunLabelKey: tr.Name} pos, err := c.podLister.Pods(tr.Namespace).List(labelSelector.AsSelector()) - if err != nil { logger.Errorf("Error listing pods: %v", err) return err @@ -722,8 +721,7 @@ func (c *Reconciler) failTaskRun(ctx context.Context, tr *v1.TaskRun, reason v1. } var err error - if reason == v1.TaskRunReasonCancelled && - (config.FromContextOrDefaults(ctx).FeatureFlags.EnableKeepPodOnCancel && config.FromContextOrDefaults(ctx).FeatureFlags.EnableAPIFields == config.AlphaAPIFields) { + if reason == v1.TaskRunReasonCancelled && (config.FromContextOrDefaults(ctx).FeatureFlags.EnableKeepPodOnCancel) { logger.Infof("Canceling task run %q by entrypoint", tr.Name) err = podconvert.CancelPod(ctx, c.KubeClientSet, tr.Namespace, tr.Status.PodName) } else {