Load in-cluster config is KUBECONFIG is not set
This commit is contained in:
parent
f012651501
commit
92c1d7da96
2 changed files with 9 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
if "KUBECONFIG" in os.environ:
|
||||
config.load_kube_config()
|
||||
else:
|
||||
config.load_incluster_config()
|
||||
|
||||
|
||||
@sync_to_async
|
||||
|
|
|
|||
Loading…
Reference in a new issue