Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix remote buildkit error: [415: Unsupported Media Type] #2893

Merged
merged 4 commits into from
Sep 19, 2024

Conversation

lizardruss
Copy link
Collaborator

Issue describe

since legacy kube api not support server-side apply, when use remote buildkit will get the error:

local-registry: Starting Local Image Registry
build_images: build images: create builder: get or create local registry: ensure deployment: 415: Unsupported Media Type
fatal exit status 1

this pr will resolve the compatibility issue

The pr summary

What issue type does this pull request address? (keep at least one, remove the others)
/kind bugfix

Please provide a short message that should be published in the DevSpace release notes
fix remote buildkit error: [415: Unsupported Media Type], compatibility legacy kube api server which not support server-side apply

reproduce

$ curl -Lo ~/bin/devspace-linux-amd64-6.3.12 https://github.com/devspace-sh/devspace/releases/download/v6.3.12/devspace-linux-amd64
$ chmod u+x ~/bin/devspace-linux-amd64-6.3.12

$ ~/bin/devspace-linux-amd64-6.3.12  version
DevSpace version : 6.3.12

$ kubectl version --short
Client Version: v1.26.7
Kustomize Version: v4.5.7
Server Version: v1.15.11

$ devspace-linux-amd64-6.3.12 build --skip-push
info Using namespace 'devspace'
info Using kube context 'devspace@dev'
Couldn't find a running docker daemon. Will fallback to local registry
local-registry: Starting Local Image Registry
build_images: build images: create builder: get or create local registry: ensure deployment: 415: Unsupported Media Type
fatal exit status 1

…e], compatibility legacy kube api server which not support server-side apply

Signed-off-by: wurenny <[email protected]>
Copy link

netlify bot commented Sep 18, 2024

Deploy Preview for devspace-docs canceled.

Name Link
🔨 Latest commit 8d05efe
🔍 Latest deploy log https://app.netlify.com/sites/devspace-docs/deploys/66ec24cc077ee00008dad7ab

Signed-off-by: Russell Centanni <[email protected]>
@lizardruss lizardruss force-pushed the fix-415-server-side-apply branch from c05afea to e84bd0b Compare September 18, 2024 19:09
@lizardruss lizardruss force-pushed the fix-415-server-side-apply branch from a3b7334 to d84d605 Compare September 18, 2024 19:43
@lizardruss
Copy link
Collaborator Author

@wurenny This is a re-creation of your original PR with some linting & test fixes.

Comment on lines 17 to 19
"net/http"
"os"
"time"

Choose a reason for hiding this comment

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

Those stdlib imports should be at the top, below fmt.

func IsIncompatibleServerError(err error) bool {
// 415: Unsupported media type means we're talking to a server which doesn't support server-side apply.
// Also included the apiserver enabled feature: ServerSideApply=false option
if _, ok := err.(*kerrors.StatusError); !ok {

Choose a reason for hiding this comment

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

We might want to use an error.As here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just used kerrors.IsUnsupportedMediaType(err) instead.

Signed-off-by: Russell Centanni <[email protected]>
@lizardruss lizardruss merged commit 964f505 into main Sep 19, 2024
18 checks passed
@lizardruss lizardruss deleted the fix-415-server-side-apply branch September 19, 2024 15:37
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.

3 participants