GitLab Runner Kubernetes Executor customizations

Hey all, I’m looking to make some customizations to the GitLab CI runner … specifically, the Kubernetes Executor. Right now, tasks spawned by the kubernetes executor can only have a single Kubernetes Service account associated with them.

However, I’d like to add some logic to make it so I can choose the service account dynamically (based on a gitlab CI variable actually).

But from the look of it, it’s an all or nothing change. If I want to make that sort of change to the code, I need to create a custom executor and re-implement pretty much all of the Kubernetes executor logic just to make a single change. Or perhaps I can fork the entire Kubernetes Runner just to make changes to the Kubernetes executor. I’d really hate to fork the whole codebase, and I don’t know Go, so that would be very difficult as well.

Are there any “hooks” or plugin mechanisms that I’m missing that might allow me to accomplish this without a massive fork or custom executor? Is it possible to fork just the Kubernetes Executor code and use it as a custom executor, or are the build-in executors implemented completely differently than the custom ones (since the custom executors seem to require you to specify custom scripts, but the built-in ones have their own specific configuration).

Wondering if you have any advice. Thanks for reading and really appreciate any advice you might have.