@@ -10,7 +10,6 @@ import (
10
10
apierr "k8s.io/apimachinery/pkg/api/errors"
11
11
"k8s.io/apimachinery/pkg/api/resource"
12
12
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
13
- "k8s.io/client-go/tools/cache"
14
13
"k8s.io/utils/ptr"
15
14
16
15
"github.com/argoproj/argo-workflows/v3/errors"
@@ -113,16 +112,12 @@ func (woc *wfOperationCtx) createAgentPod(ctx context.Context) (*apiv1.Pod, erro
113
112
podName := woc .getAgentPodName ()
114
113
log := woc .log .WithField ("podName" , podName )
115
114
116
- obj , exists , err := woc .controller .podInformer . GetStore (). Get ( cache . ExplicitKey ( woc .wf .Namespace + "/" + podName ) )
115
+ pod , err := woc .controller .PodController . GetPod ( woc .wf .Namespace , podName )
117
116
if err != nil {
118
117
return nil , fmt .Errorf ("failed to get pod from informer store: %w" , err )
119
118
}
120
- if exists {
121
- existing , ok := obj .(* apiv1.Pod )
122
- if ok {
123
- log .WithField ("podPhase" , existing .Status .Phase ).Debug ("Skipped pod creation: already exists" )
124
- return existing , nil
125
- }
119
+ if pod != nil {
120
+ return pod , nil
126
121
}
127
122
128
123
certVolume , certVolumeMount , err := woc .getCertVolumeMount (ctx , common .CACertificatesVolumeMountName )
@@ -197,7 +192,7 @@ func (woc *wfOperationCtx) createAgentPod(ctx context.Context) (*apiv1.Pod, erro
197
192
agentMainCtr .Name = common .MainContainerName
198
193
agentMainCtr .Args = append ([]string {"agent" , "main" }, woc .getExecutorLogOpts ()... )
199
194
200
- pod : = & apiv1.Pod {
195
+ pod = & apiv1.Pod {
201
196
ObjectMeta : metav1.ObjectMeta {
202
197
Name : podName ,
203
198
Namespace : woc .wf .ObjectMeta .Namespace ,
0 commit comments