Skip to content

fix: point controller at milo via KUBECONFIG env var#10

Merged
ecv merged 1 commit into
mainfrom
fix/issue-9-discovery-kubeconfig
May 28, 2026
Merged

fix: point controller at milo via KUBECONFIG env var#10
ecv merged 1 commit into
mainfrom
fix/issue-9-discovery-kubeconfig

Conversation

@ecv
Copy link
Copy Markdown
Contributor

@ecv ecv commented May 27, 2026

Summary

Set `KUBECONFIG` on the manager container in the `milo-integration` component so the controller reads the mounted discovery kubeconfig instead of falling back to the pod's in-cluster ServiceAccount. client-go honors `KUBECONFIG` natively — no flag, config type, or ConfigMap needed.

The component already mounts `inventory-discovery-kubeconfig` at `/etc/kubernetes/project-discovery/auth`; this just tells client-go to use it.

Fixes #9.

Test plan

  • `kustomize build` of a synthetic overlay including `components/milo-integration` renders the manager container with `KUBECONFIG=/etc/kubernetes/project-discovery/auth/discovery-kubeconfig.yaml`
  • Post-merge: confirm inventory-controller-manager reaches Ready against the Milo apiserver in staging

@ecv ecv requested a review from scotwells May 27, 2026 18:23
@ecv
Copy link
Copy Markdown
Contributor Author

ecv commented May 27, 2026

This can't be the right way to do this @scotwells . Unless…

@ecv ecv marked this pull request as ready for review May 27, 2026 18:23
@scotwells
Copy link
Copy Markdown
Contributor

@ecv that's one way to do it. Could also just set the KUBECONFIG variable to the kubeconfig path to use for connecting to milo's control plane.

@ecv ecv force-pushed the fix/issue-9-discovery-kubeconfig branch 2 times, most recently from 5ab744f to 599b8f5 Compare May 27, 2026 20:20
@ecv
Copy link
Copy Markdown
Contributor Author

ecv commented May 27, 2026

Unless I misunderstand @scotwells this repository lacks the wiring for kubeconfigPath, and this PR (now) creates that wiring w/ a sane default that shouldn't need patching in the infra repo.

It's entirely probable that I misunderstand. Clarifications welcomed.

@scotwells
Copy link
Copy Markdown
Contributor

@ecv by default the k8s libraries will load the config from the KUBECONFIG env variable.

https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#the-kubeconfig-environment-variable

The approach here works too, it's just a more explicit configuration option than the env variable.

Point the controller at the mounted discovery kubeconfig by setting
the KUBECONFIG env var on the manager container. client-go honors
KUBECONFIG natively, so no flag, config type, or ConfigMap is
required.

Fixes #9.
@ecv ecv force-pushed the fix/issue-9-discovery-kubeconfig branch from 599b8f5 to 7878a7d Compare May 28, 2026 15:49
@ecv
Copy link
Copy Markdown
Contributor Author

ecv commented May 28, 2026

Oh. You mean. Like that. @scotwells

@ecv ecv changed the title feat: load REST config from InventoryOperator server-config fix: point controller at milo via KUBECONFIG env var May 28, 2026
@ecv ecv merged commit e1d7176 into main May 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Controller CrashLoops in staging: discovery-kubeconfig mounted but unused

2 participants