No description
  • Go 99.4%
  • Dockerfile 0.6%
Find a file
bot-owl 2116ce73f0
fix(deps): update dependency go (1.26.3 → 1.26.4) (#61)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [go](https://go.dev/) ([source](https://github.com/golang/go)) | toolchain | patch | `1.26.3` → `1.26.4` |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMDEuMSIsInVwZGF0ZWRJblZlciI6IjQzLjEwMS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL3BhdGNoIl19-->

Reviewed-on: https://git.erwanleboucher.dev/eleboucher/runner-k8s-plugin/pulls/61
2026-06-03 17:46:08 +02:00
.forgejo/workflows ci(github-action): update action actions/checkout (v6.0.2 → v6.0.3) (#60) 2026-06-02 18:03:36 +02:00
.gitignore feat: add native k8s plugin 2026-04-05 10:27:33 +02:00
.golangci.yml chore(ci): improve ci 2026-04-06 18:51:27 +02:00
Dockerfile feat(container): update image golang (1.25 → 1.26) (#2) 2026-04-07 20:47:54 +00:00
Dockerfile.v2 feat(container): update image golang (1.25 → 1.26) (#2) 2026-04-07 20:47:54 +00:00
go.mod fix(deps): update dependency go (1.26.3 → 1.26.4) (#61) 2026-06-03 17:46:08 +02:00
go.sum fix(deps): update module git.erwanleboucher.dev/eleboucher/runner/v12 (v12.10.1 → v12.10.2) (#58) 2026-05-28 20:51:51 +02:00
k8s_client.go feat: add native k8s plugin 2026-04-05 10:27:33 +02:00
k8s_factory.go feat: Use Kubernetes Jobs instead of straight up Pods (#57) 2026-05-28 17:42:18 +02:00
k8s_pod.go fix: copy job labels onto pod template so topologySpreadConstraints match 2026-05-30 09:00:46 +02:00
k8s_pod_test.go fix lint 2026-06-03 14:44:41 +02:00
LICENSE docs: update readme 2026-04-06 20:04:40 +02:00
main.go fix: add KeepaliveEnforcementPolicy to prevent rate limit 2026-06-03 14:31:01 +02:00
README.md feat: improve custom label supports 2026-05-01 09:51:06 +02:00
renovate.json update renovate config 2026-04-07 22:50:07 +02:00
server.go feat: Use Kubernetes Jobs instead of straight up Pods (#57) 2026-05-28 17:42:18 +02:00
server_test.go feat: Use Kubernetes Jobs instead of straight up Pods (#57) 2026-05-28 17:42:18 +02:00

Forgejo Runner Kubernetes Plugin

A backend plugin for Forgejo Runner that executes CI/CD jobs as Kubernetes pods. Each job runs in its own pod with optional service containers as sidecars, a shared volume, and custom PodSpec support.

Building

  • Install Go
  • go build -o forgejo-runner-k8s .

Configuration

The plugin supports two transport modes. In both cases, labels use the plugin scheme name (k8s below) and the runner routes jobs to the matching config.

v1: standalone gRPC server

The plugin runs as a sidecar process. The runner connects over a Unix socket or TCP.

./forgejo-runner-k8s --listen unix:///var/run/forgejo-runner-k8s.sock
plugins:
  k8s:
    address: "unix:///var/run/forgejo-runner-k8s.sock"
    options:
      namespace: ci-jobs

v2: go-plugin (binary launch)

The runner launches the plugin binary as a subprocess via go-plugin. No sidecar or socket needed. The binary auto-detects how it was launched.

pluginsv2:
  k8s:
    path: /usr/local/bin/forgejo-runner-k8s
    options:
      namespace: ci-jobs

Labels

server:
  connections:
    main:
      url: https://forgejo.example.com
      labels:
        - "ubuntu-k8s:k8s://config/podspec-default.yaml"
        - "gpu:k8s://config/podspec-gpu.yaml"

Backend options

Set in plugins.<name>.options or pluginsv2.<name>.options:

Option Default Description
namespace default Kubernetes namespace for pods
kubeconfig in-cluster Path to kubeconfig file
poll_timeout 10m Timeout waiting for pod readiness
podspec Default PodSpec path (overridden by label arg)
labels Extra pod labels as k=v,k=v. ${ENV_ID} expands to the per-pod environment ID.

The runner also injects label_arg (per-job label argument, e.g. PodSpec path) and job_timeout automatically.

Pods always carry app.kubernetes.io/managed-by=forgejo-runner, forgejo-runner/environment-id, and forgejo-runner/plugin-instance. Use labels for anything else:

# v1
plugins:
  k8s:
    address: "unix:///var/run/forgejo-runner-k8s.sock"
    options:
      labels: "app.kubernetes.io/name=forgejo-runner,app.kubernetes.io/instance=runner-${ENV_ID}"

# v2
pluginsv2:
  k8s:
    path: /usr/local/bin/forgejo-runner-k8s
    options:
      labels: "app.kubernetes.io/name=forgejo-runner,app.kubernetes.io/instance=runner-${ENV_ID}"

PodSpec files

PodSpec files customize the pod template per label. A container named main is used for step execution. If absent, one is prepended automatically.

containers:
  - name: main
    image: nvidia/cuda:12.0-base
    resources:
      limits:
        nvidia.com/gpu: "1"
nodeSelector:
  gpu: "true"

Migrating from the in-tree backend

The in-tree k8spod backend continues to work. To switch to this plugin:

  1. Deploy the plugin (sidecar for v1, or copy the binary for v2)
  2. Change labels from mylabel:k8spod://podspec.yaml to mylabel:k8s://podspec.yaml
  3. Add the plugin section to the runner config

Testing

go test ./...

License

Same as Forgejo Runner — GPL version 3.0 or any later version.