feat: add Kubernetes backend for native pod-based job execution #1472
No reviewers
Labels
No labels
FreeBSD
Kind/Breaking
Kind/Bug
Kind/Chore
Kind/DependencyUpdate
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
Windows
linux-powerpc64le
linux-riscv64
linux-s390x
run-end-to-end-tests
run-forgejo-tests
run-multi-platform-tests
No milestone
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
forgejo/runner!1472
Loading…
Reference in a new issue
No description provided.
Delete branch "eleboucher/runner:feat/k8s-backend"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds a Kubernetes backend that executes workflow jobs as Pods in a K8s cluster, similar to GitLab CI Runner's Kubernetes executor and Woodpecker CI's Kubernetes backend.
Instead of requiring Docker-in-Docker to run the runner itself in Kubernetes (the current examples/kubernetes/dind-docker.yaml approach), this backend creates one Pod per job and executes steps via kubectl exec into the main container. Service
containers run as sidecars in the same Pod, sharing localhost.
Usage
PodSpec templates give full control over resources, node selectors, tolerations, security context, and DinD sidecars. The runner waits for all containers (including native K8s init container sidecars) to be ready before running steps.
Limitations
ae319fa666a18f0d2808a18f0d28086b75559371Thank you for you interest in making Forgejo Runner better. We currently do not accept new back-ends for Forgejo Runner, see forgejo/forgejo-actions-feature-requests#4 (comment) and forgejo/forgejo-actions-feature-requests#4 (comment) for the reasoning and what has to happen before new back-ends could be added.
New features without a previous design discussion are a tough sell, too. They usually happen in https://code.forgejo.org/forgejo/forgejo-actions-feature-requests.
Are you aware of https://codeberg.org/forgejo/discussions/issues/66, especially https://codeberg.org/forgejo/discussions/issues/66#issuecomment-9829238?
And while we're at it, there's also Forgejo's AI Agreement, just in case.
A potential way forward for this feature is to live in a fork to gather community feedback and to flesh out the design while working on extension points in Forgejo Runner that enable plug-ins. Let us know if that would be interesting to you.
6b7555937126a4ce1e34@aahlenst wrote in #1472 (comment):
Thank you for your quick reply! I also think that adding many backend would make it complicated to contribute and QA the actions. Meanwhile missing kubernetes native support is a pity and hurt adoptability.
I was aware of issue 66 that's why i did this work. about this the code is outdate and use an old version of the runner v9 and has many memory leaks and race condition that didn't make it suitable for production usage.
hopefully you can reconsider adding at least k8s backend until you can work out on a plugin-style.
AI usage was limited to research, no code was generated appart from auto complete.
about your community fork: i agree this might be a good solution in the meantime. the code will live there and mirror to this instance.
@eleboucher wrote in #1472 (comment):
As already said, it needs a design discussion, time for community feedback, and the willingness to help shape the plug-in architecture. Merging a new feature is the last step that can happen once we're reasonable confident that we have built the right thing.
Would you like to do that? That would be terrific.
@aahlenst wrote in #1472 (comment):
Yes that's something that i can work on!
@eleboucher wrote in #1472 (comment):
Splendid! But before you start, wait for @mfenniak to chime in and greenlight the endeavour.
My proposal would be:
In that scenario, Forgejo Runner would not be concerned with the design of the Kubernetes-native Runner plug-in itself. From my point of view, no design discussion would then be necessary.
Yes, I'd be interested in discussions about a plugin architecture for these backends, and if we can align on a design I'd be happy to merge a plugin system. We can take the details to a different discussion, but they key design goals for me are:
@aahlenst @mfenniak Hey thanks for the feedbacks, i submitted the fork to the community https://codeberg.org/forgejo/discussions/issues/66#issuecomment-12615426 and i'm also testing it with my home-ops community as well. Regarding the ADR i made a quick pass on it and made the feature request forgejo/forgejo-actions-feature-requests#107 even though i'm more drawn to the second option to be closer like tekton, i guess the first option is what you had in mind
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.