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] #2864

Closed
wants to merge 0 commits into from

Conversation

wurenny
Copy link
Contributor

@wurenny wurenny commented Jun 10, 2024

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

repreduce

$ 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

Copy link

netlify bot commented Jun 10, 2024

Deploy Preview for devspace-docs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit b773b9b
🔍 Latest deploy log https://app.netlify.com/sites/devspace-docs/deploys/66eaf4eea44562000920e025
😎 Deploy Preview https://deploy-preview-2864--devspace-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Collaborator

@lizardruss lizardruss left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

I might prefer a non-version based approach to solve this. See my comments. If it's not practical, we can discuss.

@@ -58,11 +58,16 @@ func (r *LocalRegistry) ensureDeployment(ctx devspacecontext.Context) (*appsv1.D
return nil, err
}

if !ctx.KubeClient().SupportServerSideApply() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

IIRC, server side apply can also be disabled. Perhaps handling the 415 response and falling back to a Patch operation would be an option that would adapt to more version / configuration combinations?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I proved it, and I would fix it with non-version based approach.

$ kubectl version
Client Version: v1.30.0
Server Version: v1.18.19

$ kubectl -n kube-system get po -l component=kube-apiserver -o yaml | grep -i serversideapply
      - --feature-gates=ServerSideApply=false

$ kubectl apply --server-side=true -f - <<EOF
> apiVersion: v1
> kind: ConfigMap
> metadata:
>   name: ssa-cm
>   namespace: default
> data:
>   foo: bar
> EOF
error: Server-side apply not available on the server: (415: Unsupported Media Type)

@wurenny wurenny force-pushed the main branch 2 times, most recently from 8939624 to b60cfc9 Compare July 15, 2024 02:19
Copy link
Collaborator

@lizardruss lizardruss left a comment

Choose a reason for hiding this comment

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

LGTM

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