Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

add: translate registry unauthorized error when running a private image (#2101) #2102

Merged
merged 5 commits into from
Aug 22, 2023

Conversation

iwilltry42
Copy link
Contributor

@iwilltry42 iwilltry42 commented Aug 21, 2023

Ref #2101

With this change, ImageDetails will translate HTTP StatusCodes returned by registries to equivalent Kubernetes API Errors that we can interpret client-side to e.g. tell the user to run acorn login first before trying to run a private image.

ImageDetails is first in line to try to access the registry.

Old Text As you can see in the issue text, there is not much common text that we could match on and I hope we don't mask any "Unauthorized" errors coming from somewhere else (that I cannot think of right now). Here are some things that we **could** do:
  1. Catch the Unauthorized error server-side (by status code) and return a common error from there
  2. Also match on the context (registry) in the error message + try to match more variable parts of the message

Checklist

  • The title of this PR would make a good line in Acorn's Release Note's Changelog
  • The title of this PR ends with a link to the main issue being address in parentheses, like: This is a title (#1216). Here's an example
  • All relevant issues are referenced in the PR description. NOTE: don't use GitHub keywords that auto-close issues
  • Commits follow contributing guidance
  • Automated tests added to cover the changes. If tests couldn't be added, an explanation is provided in the Verification and Testing section
  • Changes to user-facing functionality, API, CLI, and upgrade impacts are clearly called out in PR description
  • PR has at least two approvals before merging (or a reasonable exception, like it's just a docs change)

@iwilltry42 iwilltry42 marked this pull request as ready for review August 21, 2023 12:22
@iwilltry42 iwilltry42 changed the title add: translate registry unauthorized error when running a private image (#2102) add: translate registry unauthorized error when running a private image (#2101) Aug 21, 2023
@iwilltry42 iwilltry42 requested a review from g-linville August 21, 2023 14:55
@iwilltry42 iwilltry42 force-pushed the iwilltry42/issue2101 branch from 879edaf to eb5cd78 Compare August 22, 2023 11:07
@iwilltry42 iwilltry42 force-pushed the iwilltry42/issue2101 branch from eb5cd78 to d5d9c05 Compare August 22, 2023 11:08
@iwilltry42 iwilltry42 merged commit bd13da9 into acorn-io:main Aug 22, 2023
@iwilltry42 iwilltry42 deleted the iwilltry42/issue2101 branch August 22, 2023 11:11
cloudnautique pushed a commit to cloudnautique/runtime that referenced this pull request Sep 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants