diff --git a/README.md b/README.md index 9523f97..9a0d335 100644 --- a/README.md +++ b/README.md @@ -58,9 +58,10 @@ For running the controller (runboat itself): - Python 3.10 - `kubectl` -- A `KUBECONFIG` that provides access to the namespace where the builds are deployed, - with permissions to create and delete Service, Job, Deployment, Ingress, Secret and - ConfigMap resources. +- A `KUBECONFIG` or an in-cluster service account that provides access to the namespace + where the builds are deployed, with permissions to create and delete Service, Job, + Deployment, Ingress, Secret and ConfigMap resources as well as read and watch + Deployments and Jobs. - Some sort of reverse proxy to expose the REST API. The controller can be run outside the kubernetes cluster or deployed inside it, or even diff --git a/src/runboat/k8s.py b/src/runboat/k8s.py index 8fdaba3..35abbaa 100644 --- a/src/runboat/k8s.py +++ b/src/runboat/k8s.py @@ -1,5 +1,6 @@ import asyncio import logging +import os import shutil import subprocess import tempfile @@ -31,7 +32,10 @@ def _split_image_name_tag(img: str) -> tuple[str, str]: @sync_to_async def load_kube_config() -> None: - config.load_kube_config() + if "KUBECONFIG" in os.environ: + config.load_kube_config() + else: + config.load_incluster_config() @sync_to_async