I want to create a pod and I also want to execute some commands inside the pod/job
as you can see in the argument POST 'http://localhost:4009/src/getEndpount I'm just seeing that the job is created in the console kubectl get jobs -A, but I am not able to see what is going on inside the job or if the Pod is created. I didn't see any pods for this job created kubectl get pods.
fun newJob(uuid: String, githubURL: String?, token: String): V1Job? {
val respondToEndpoint = String.format("%s%s%s", backendUrl, REST_API_BASE_PATH, uuid)
return V1JobBuilder()
.withNewMetadata()
.withName(uuid.toString())
.endMetadata()
.withNewSpec()
.withActiveDeadlineSeconds(120)
.withParallelism(1)
.withNewTemplate().withNewSpec()
.addNewImagePullSecret()
.withName(imagePullSecret)
.endImagePullSecret()
.withRestartPolicy("Never")
.addNewContainer()
.withName(uuid)
.withImage(analystImage)
.withImagePullPolicy("Always")
.addToCommand("/bin/sh", "-c")
.addToArgs(
String.format(
// "git clone %s /tmp/code && cd /tmp/code && r=$(/opt/tools/bin/sca_bom.sh $(pwd) $(git rev-parse HEAD) run 2>/dev/null) && curl --location --request PATCH '%s' -H 'Content-Type: text/plain' -H 'token: %s' --data-raw \"\$r\"",
"curl --location --request POST 'http://localhost:4009/src/getEndpount' -H 'Content-Type: text/plain' -H 'token: %s' --data-raw \"\$r\"",
token
)
)
.endContainer().endSpec().endTemplate().endSpec()
.build()
}
After the job creation I do a nameSpace creation with the next code,
val job: V1Job? = kubeClient.newJob(uuid, repoURL, token)
batchV1Api.createNamespacedJob(namespace, job, null, null, "", "")
My question is if the createNamespacedJob method from the batchV1Api, I am running or creating some Pods, I can't see too much info regarding what is happening behind the scenes.