kurtosis-tech / kurtosis

A platform for packaging and launching ephemeral backend stacks with a focus on approachability for the average developer.
https://docs.kurtosistech.com/
Apache License 2.0
362 stars 53 forks source link

Execution fails for packages running one off containers in Kubernetes #2089

Open MuhammedIrfan opened 8 months ago

MuhammedIrfan commented 8 months ago

What's your CLI version?

0.86.11

Description & steps to reproduce

After setting up kurtosis in kubernetes, running the below command

kurtosis run github.com/hugobyte/polkadot-kurtosis-package '{ "chain_type": "localnet", "relaychain": { "name": "rococo-local", "nodes": [ { "name": "alice", "node_type": "validator", "prometheus": false }, { "name": "bob", "node_type": "full", "prometheus": true } ] }, "parachains": [ { "name":"frequency", "nodes": [ { "name": "alice", "node_type": "validator", "prometheus": false } ] } ], "explorer": true }'

fails with the error

DEBU[2024-01-26T04:39:57Z][api_container_service.go:runStarlark] Received response line from Starlark runner: 'error:{execution_error:{error_message:"An error occurred executing instruction (number 8) at github.com/hugobyte/polkadot-kurtosis-package/package_io/build-spec.star[19:31]:\nadd_service(name=\"para-slot-registration\", config=ServiceConfig(image=\"hugobyte/parachain-node-modules\", files={\"/app\": \"configs\", \"/build\": \"javascript\"}, entrypoint=[\"/bin/sh\"]))\n --- at /home/circleci/project/core/server/api_container/server/startosis_engine/startosis_executor.go:157 (sendErrorAndFail) ---\nCaused by: Unexpected error occurred starting service 'para-slot-registration'\n --- at /home/circleci/project/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service.go:163 (AddServiceCapabilities.Execute) ---\nCaused by: An error occurred creating pod 'para-slot-registration' using image 'hugobyte/parachain-node-modules'\n --- at /home/circleci/project/container-engine-lib/lib/backend_impls/kubernetes/kubernetes_kurtosis_backend/user_services_functions/start_user_services.go:421 (createStartServiceOperation.func1) ---\nCaused by: An error occurred waiting for pod 'para-slot-registration' to become available\n --- at /home/circleci/project/container-engine-lib/lib/backend_impls/kubernetes/kubernetes_manager/kubernetes_manager.go:1159 (KubernetesManager.CreatePod) ---\nCaused by: Expected state of pod 'para-slot-registration' to arrive at 'Running' but the pod instead landed in 'Succeeded' with the following state:\n>>>>>>>>>>>>>>>>>>>>>>>>>> Pod para-slot-registration <<<<<<<<<<<<<<<<<<<<<<<<<<\nContainer Statuses: - user-service-container (docker.io/hugobyte/parachain-node-modules:latest): TERMINATED with exit code 0 - \n\n-------------------- Container user-service-container Logs --------------------\n\n------------------ End Container user-service-container Logs ---------------------\n>>>>>>>>>>>>>>>>>>>>>>>> End Pod para-slot-registration <<<<<<<<<<<<<<<<<<<<<<<<<<<\n --- at /home/circleci/project/container-engine-lib/lib/backend_impls/kubernetes/kubernetes_manager/kubernetes_manager.go:1871 (KubernetesManager.waitForPodAvailability) ---"}}' 

which is a caused due to execution of one-off container; issue arises from https://github.com/kurtosis-tech/kurtosis/blob/main/container-engine-lib/lib/backend_impls/kubernetes/kubernetes_manager/kubernetes_manager.go#L1869

Desired behavior

The package should complete execution without failure.

What is the severity of this bug?

Critical; I am blocked and Kurtosis is unusable for me because of this bug.

What area of the product does this pertain to?

CLI: the Command Line Interface

mieubrisse commented 8 months ago

Hey @MuhammedIrfan , could you paste which particular line in Starlark is failing? I suspect that this is because a call to plan.add_service is being used where plan.run_sh or plan.run_python would be a better fit (due o the start-and-stop nature the latter is intended for)

MuhammedIrfan commented 8 months ago

Hey @MuhammedIrfan , could you paste which particular line in Starlark is failing? I suspect that this is because a call to plan.add_service is being used where plan.run_sh or plan.run_python would be a better fit (due o the start-and-stop nature the latter is intended for)

@mieubrisse The error arises from here https://github.com/HugoByte/polkadot-kurtosis-package/blob/b9ec43fc48760ed076b8893d57683652dce13f36/parachain/register-para-id.star#L5

 test = build_spec.create_service_for_build_spec(plan, constant.PARA_SLOT_REGISTER_SERVICE_NAME, constant.NODE_IMAGE, "javascript")

where we use a one-off container with the necessary node_module and script within it. As you suggested we will try with plan.run_sh

mieubrisse commented 7 months ago

Hey @MuhammedIrfan , just wanted to verify if switching to plan.run_sh did indeed work for you?