mirror of
https://github.com/actions/runner-container-hooks.git
synced 2025-12-14 16:46:43 +00:00
* Add option to use kube scheduler This should only be used when rwx volumes are supported or when using a single node cluster. * Add option to set timeout for prepare job If the kube scheduler is used to hold jobs until sufficient resources are available, then prepare job needs to wait for a longer period until the workflow pod is running. This timeout will mostly need an increase in cases where many jobs are triggered which together exceed the resources available in the cluster. The workflows can then be gracefully handled later when sufficient resources become available again. * Skip name override warning when names match or job extension * Add guard for positive timeouts with a warning * Write out ReadWriteMany in full
K8s Hooks
Description
This implementation provides a way to dynamically spin up jobs to run container workflows, rather then relying on the default docker implementation. It is meant to be used when the runner itself is running in k8s, for example when using the Actions Runner Controller
Pre-requisites
Some things are expected to be set when using these hooks
- The runner itself should be running in a pod, with a service account with the following permissions
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: default
name: runner-role
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "create", "delete"]
- apiGroups: [""]
resources: ["pods/exec"]
verbs: ["get", "create"]
- apiGroups: [""]
resources: ["pods/log"]
verbs: ["get", "list", "watch",]
- apiGroups: ["batch"]
resources: ["jobs"]
verbs: ["get", "list", "create", "delete"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "list", "create", "delete"]
- The
ACTIONS_RUNNER_POD_NAMEenv should be set to the name of the pod - The
ACTIONS_RUNNER_REQUIRE_JOB_CONTAINERenv should be set to true to prevent the runner from running any jobs outside of a container - The runner pod should map a persistent volume claim into the
_workdirectory- The
ACTIONS_RUNNER_CLAIM_NAMEenv should be set to the persistent volume claim that contains the runner's working directory, otherwise it defaults to${ACTIONS_RUNNER_POD_NAME}-work
- The
- Some actions runner env's are expected to be set. These are set automatically by the runner.
RUNNER_WORKSPACEis expected to be set to the workspace of the runnerGITHUB_WORKSPACEis expected to be set to the workspace of the job
Limitations
- A job containers will be required for all jobs
- Building container actions from a dockerfile is not supported at this time
- Container actions will not have access to the services network or job container network
- Docker create options are not supported