multus: revise kube config/client loading

The previous client loader routine assumed KUBECONFIG would be set in
CLI environments. Instead, now take this approach:

1. If KUBECONFIG is set, that is the de-facto override that informs the
   tool it is being run in a CLI environment.
2. Otherwise, try creating a client from the default kube config file.
3. If that fails, assume the tool is running in a Kubernetes Pod.

This will continue supporting dev/test environments so that building the
rook container is not necessary for development. It also allows support
for highly opinionated environments (like deployed by OpenShift CSVs)
where it's not possible to install the Rook operator without also
deploying a CephCluster.

Signed-off-by: Blaine Gardner <blaine.gardner@ibm.com>
This commit is contained in:
Blaine Gardner
2023-07-28 09:50:00 -06:00
parent aac58f2b31
commit cc9514ad6c
6 changed files with 88 additions and 19 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ on:
- release-*
pull_request:
paths:
- cmd/userfacing/**
- cmd/rook/userfacing/**
- pkg/daemon/multus/**
- .github/workflows/multus.yaml