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

PATCH isn't working through the Che Server kubernetes api #18863

Closed
5 of 22 tasks
JPinkney opened this issue Jan 22, 2021 · 1 comment
Closed
5 of 22 tasks

PATCH isn't working through the Che Server kubernetes api #18863

JPinkney opened this issue Jan 22, 2021 · 1 comment
Labels
area/che-server kind/bug Outline of a bug - must adhere to the bug report template. severity/P1 Has a major impact to usage or development of the system.

Comments

@JPinkney
Copy link
Contributor

Describe the bug

When trying to PATCH a devworkspace through the regular kubernetes api everything works successfully, but if you try and PATCH the same devworkspace through the Che Server kubernetes api you get:

{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {
    
  },
  "status": "Failure",
  "message": "unexpected end of JSON input",
  "reason": "BadRequest",
  "code": 400
}

Che version

  • latest 7.24.0
  • nightly
  • other: please specify

Steps to reproduce

First, make sure Che and the devworkspace operator are installed on the same cluster
Then create a namespace called sample and run oc project sample so that the below devworkspace will be created there
Next, oc create -f https://raw.githubusercontent.com/devfile/devworkspace-operator/master/samples/theia-nodejs.yaml
Next, proxy kubernetes api to port 8080

kubectl proxy --port=8080

Then, make a request to the kubernetes api regularly:

curl --data "[{\"path\": \"/spec/started\",\"op\": \"replace\", \"value\": true}]" -X PATCH -H "Content-Type: application/json-patch+json" localhost:8080/apis/workspace.devfile.io/v1alpha2/namespaces/sample/devworkspaces/theia-nodejs

And see that the devworkspace theia-nodejs has been correctly stopped.

Then, try and make the same request to the Che Server kubernetes API:

curl -k -v -H "Authorization: Bearer $TOKEN" --data "[{\"path\": \"/spec/started\",\"op\": \"replace\", \"value\": false}]" -X PATCH -H "Content-Type: application/json-patch+json" https://che-che.apps-crc.testing/api/unsupported/k8s/apis/workspace.devfile.io/v1alpha2/namespaces/sample/devworkspaces/theia-nodejs

and see that you end up getting:

{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {
    
  },
  "status": "Failure",
  "message": "unexpected end of JSON input",
  "reason": "BadRequest",
  "code": 400
}

Expected behavior

You should not get an error when using PATCH against the che server kubernetes api and the devworkspace should be patched then returned

Runtime

  • kubernetes (include output of kubectl version)
  • Openshift (include output of oc version)
  • minikube (include output of minikube version and kubectl version)
  • minishift (include output of minishift version and oc version)
  • docker-desktop + K8S (include output of docker version and kubectl version)
  • other: (please specify)
    Openshift 4.6.6

Screenshots

Installation method

  • chectl
    • provide a full command that was used to deploy Eclipse Che (including the output)
    • provide an output of chectl version command
  • OperatorHub
  • I don't know
    chectl server:deploy -p crc

Environment

  • my computer
    • Windows
    • Linux
    • macOS
  • Cloud
    • Amazon
    • Azure
    • GCE
    • other (please specify)
  • other: please specify

Eclipse Che Logs

Additional context

This is related to: #18858. In order to stop/start a DevWorkspace you need to use PATCH

@JPinkney JPinkney added kind/bug Outline of a bug - must adhere to the bug report template. severity/P1 Has a major impact to usage or development of the system. area/che-server labels Jan 22, 2021
@JPinkney
Copy link
Contributor Author

Closing because the fix is provided in #18893

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/che-server kind/bug Outline of a bug - must adhere to the bug report template. severity/P1 Has a major impact to usage or development of the system.
Projects
None yet
Development

No branches or pull requests

1 participant