Returns: * errCtx - gathered information about ETL context * podName - non-empty if at least one attempt of creating pod was executed * svcName - non-empty if at least one attempt of creating service was executed * err - any error occurred which should be passed further.
(t cluster.Target, msg InitSpecMsg, opts StartOpts)
| 218 | // * svcName - non-empty if at least one attempt of creating service was executed |
| 219 | // * err - any error occurred which should be passed further. |
| 220 | func tryStart(t cluster.Target, msg InitSpecMsg, opts StartOpts) (errCtx *cmn.ETLErrorContext, |
| 221 | podName, svcName string, err error) { |
| 222 | cos.Assert(k8s.NodeName != "") // Corresponding 'if' done at the beginning of the request. |
| 223 | |
| 224 | errCtx = &cmn.ETLErrorContext{ |
| 225 | TID: t.SID(), |
| 226 | UUID: msg.IDX, |
| 227 | } |
| 228 | |
| 229 | b := &etlBootstraper{ |
| 230 | errCtx: errCtx, |
| 231 | t: t, |
| 232 | msg: msg, |
| 233 | env: opts.Env, |
| 234 | } |
| 235 | |
| 236 | // Parse spec template and fill Pod object with necessary fields. |
| 237 | if err = b.createPodSpec(); err != nil { |
| 238 | return |
| 239 | } |
| 240 | |
| 241 | b.createServiceSpec() |
| 242 | |
| 243 | // 1. Cleanup previously started entities (if any). |
| 244 | errCleanup := cleanupEntities(errCtx, b.pod.Name, b.svc.Name) |
| 245 | debug.AssertNoErr(errCleanup) |
| 246 | |
| 247 | // 2. Creating service. |
| 248 | svcName = b.svc.GetName() |
| 249 | if err = b.createEntity(k8s.Svc); err != nil { |
| 250 | return |
| 251 | } |
| 252 | |
| 253 | // 3. Creating pod. |
| 254 | podName = b.pod.GetName() |
| 255 | if err = b.createEntity(k8s.Pod); err != nil { |
| 256 | return |
| 257 | } |
| 258 | |
| 259 | if err = b.waitPodReady(); err != nil { |
| 260 | return |
| 261 | } |
| 262 | |
| 263 | if err = b.setupConnection(); err != nil { |
| 264 | return |
| 265 | } |
| 266 | |
| 267 | b.setupXaction() |
| 268 | |
| 269 | c := makeCommunicator(commArgs{ |
| 270 | listener: newAborter(t, msg.IDX), |
| 271 | bootstraper: b, |
| 272 | }) |
| 273 | // NOTE: Communicator is put to registry only if the whole tryStart was successful. |
| 274 | if err = reg.put(msg.IDX, c); err != nil { |
| 275 | return |
| 276 | } |
| 277 | t.Sowner().Listeners().Reg(c) |
no test coverage detected