I am in the process of developing a CI/CD tool that would be running on kubernetes. The application would be responsible for creating a k8s job object which would be treated as a slave in order to run a pipeline.
The image, the slave would be running is entirely up to the user, so I do not have any control over it except for the fact that it would be running in the same local network as the CI/CD application.
My question is; in this scenario, how can I make communication possible between the CI/CD tool and the slave?
To add more context to this, I want to create something similar to Jenkins. Jenkins, together with kubernetes plugin, runs on kubernetes and creates pods which are treated as slaves(agents) in order to run a pipeline. The image which would be running in the slave is entirely up to the user. The slaves have a JNLP as a side-car container which is used to establish the connection. How can I achieve the same architecture in golang or python?
What have I done so far?
I have tried researching on this and came across that Jenkins uses sockets to establish a connection. But, in order to use sockets I have to have sockets on both sides; on the server-side and as well as on the client-side. As far as I know, Jenkins uses the image that I, as the user, gave it to use in the slave, and it does NOT have server-side socket. So how is it able to establish the connection?
Since Kubernetes is natively Go, I think this could be achieved easily with a Golang solution. This is a list of some of the things worthy of research time that I can think about out of the box are, assuming that you are running your solution as a Kubernetes service: