Skip to content

feat: return auth error#1001

Open
guilhem wants to merge 3 commits intolinode:mainfrom
guilhem:autherror
Open

feat: return auth error#1001
guilhem wants to merge 3 commits intolinode:mainfrom
guilhem:autherror

Conversation

@guilhem
Copy link
Copy Markdown
Contributor

@guilhem guilhem commented Jan 8, 2026

What this PR does / why we need it:

If the controller encounters an auth error (token invalid), the error stays silent to the user.

log error example:

2026-01-08T14:14:06Z	ERROR	LinodeMachineReconciler	unknown Linode API error	{"controller": "linodemachine", "controllerGroup": "infrastructure.cluster.x-k8s.io", "controllerKind": "LinodeMachine", "LinodeMachine": {"name":"test-workload-cp-cjhrp","namespace":"default"}, "namespace": "default", "name": "test-workload-cp-cjhrp", "reconcileID": "7822f2fb-8d6e-439c-b7b5-133587bdfa73", "name": "default/test-workload-cp-cjhrp", "LinodeMachine": "test-workload-cp-cjhrp", "LinodeCluster": "test-workload", "error": "[401] Invalid Token"}

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests
  • adds or updates e2e tests

If controller encounter a auth error (token invalid), error stay silent
to user
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 14, 2026

Codecov Report

❌ Patch coverage is 79.16667% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.00%. Comparing base (4961b50) to head (01388cd).

Files with missing lines Patch % Lines
internal/controller/linodemachine_controller.go 60.00% 3 Missing and 1 partial ⚠️
internal/controller/linodecluster_controller.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1001      +/-   ##
==========================================
+ Coverage   66.97%   67.00%   +0.02%     
==========================================
  Files          71       71              
  Lines        6380     6391      +11     
==========================================
+ Hits         4273     4282       +9     
- Misses       1814     1815       +1     
- Partials      293      294       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

// Only set failure reason if the error is not retryable.
if linodego.ErrHasStatus(err, http.StatusBadRequest) {
// Set specific failure reason for authentication errors
if util.IsAuthenticationError(err) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we want to use a Ready=false condition with a message over setting the failure reason

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.

2 participants