Skip to content

fix: distinguish ErrNotInCluster in probeAPIServer#181

Merged
privateip merged 1 commit into
mainfrom
fix/issue-169
Jun 30, 2026
Merged

fix: distinguish ErrNotInCluster in probeAPIServer#181
privateip merged 1 commit into
mainfrom
fix/issue-169

Conversation

@privateip

Copy link
Copy Markdown
Contributor

probeAPIServer returned nil for any error from ctrl.GetConfig(), silently masking malformed kubeconfig files. Now it distinguishes the "not in-cluster" case from actual kubeconfig load failures, surfacing the latter so STATUS reports the misconfiguration.

  • Extract kubeconfig loading into getKubeconfig variable for testability
  • Check errors.Is against rest.ErrNotInCluster before skipping API check
  • Surface non-cluster kubeconfig errors wrapped with "load kubeconfig"

fixes #169

probeAPIServer returned nil for any error from ctrl.GetConfig(),
silently masking malformed kubeconfig files. Now it distinguishes
the "not in-cluster" case from actual kubeconfig load failures,
surfacing the latter so STATUS reports the misconfiguration.

- Extract kubeconfig loading into getKubeconfig variable for testability
- Check errors.Is against rest.ErrNotInCluster before skipping API check
- Surface non-cluster kubeconfig errors wrapped with "load kubeconfig"

fixes #169
@privateip privateip requested a review from a team as a code owner June 30, 2026 21:33
@privateip privateip requested a review from drewr June 30, 2026 21:33
@privateip privateip merged commit dee0494 into main Jun 30, 2026
5 checks passed
@privateip privateip deleted the fix/issue-169 branch June 30, 2026 21:47
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.

probeAPIServer silently swallows malformed kubeconfig errors

2 participants