Skip to content

feat: make local kubeconfig auto-discovery explicit, countable, and opt-out - #19

Merged
rishibaghel25 merged 3 commits into
bytestrix:mainfrom
jabbott-iii:jabbott-patch
Sep 22, 2026
Merged

rishibaghel25 merged 3 commits into
bytestrix:mainfrom
jabbott-iii:jabbott-patch

Conversation

@jabbott-iii

@jabbott-iii jabbott-iii commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Discovery contract: explicit local kubeconfig telemetry

Added localKubeconfigAutoDiscovery to snapshot metadata and graph payload.
Contract fields:

  • enabled: whether local kubeconfig auto-discovery is allowed
  • ran: whether local kubeconfig discovery logic actually executed
  • discoveredContexts: contexts parsed from local kubeconfig sources
  • connectedContexts: contexts that produced connected local k8s discovery
    Contract is always present in graph snapshot shape.

Resolver refactor: local kubeconfig discovery is now explicit

Introduced a dedicated kubeconfig resolver path (ResolveKubeConfig) that:

  • tries in-cluster config first
  • conditionally runs local kubeconfig discovery (KUBECONFIG path-list and ~/.kube/config)
    Local context counting is derived from parsed kubeconfig data, without cluster calls.

Opt-out controls: CLI + environment

Added --discover-local-kubeconfig to both serve and start (default true).
Added INFRACANVAS_DISCOVER_LOCAL_KUBECONFIG override.
Wired this setting through both:
Kubernetes discovery initialization
Kubernetes action executor initialization
Explicit uploaded Cluster connections (kubeconfig via UI) remain unaffected.

UI: one-time local auto-discovery notice

Added a dismissible first-load notice when local kubeconfig contexts were auto-discovered and connected.
Notice is shown only for local host session and only when ran && discoveredContexts > 0 && connectedContexts > 0.
Dismissal is persisted in localStorage to avoid repeated display across refresh/reconnect.
No notice for disabled discovery, in-cluster-only config, zero contexts, or explicit uploaded Cluster sessions.
Docs/security updates

Updated README and SECURITY docs with:

  1. explicit local kubeconfig auto-discovery behavior
  2. opt-out flag/env
  3. example usage
    Updated command help environment variable sections accordingly.

Type of change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • CI / tooling

Testing

  • make test passes
  • make lint passes
  • Manually tested against a real VM (for agent changes)
  • Frontend builds and UI looks correct (npm run build)

Related issues

closes #15

@rishibaghel25 rishibaghel25 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rishibaghel25
rishibaghel25 merged commit 29acb42 into bytestrix:main Sep 22, 2026
2 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.

Local kubeconfig auto-discovery connects silently with no indication or opt-out

2 participants