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

BatchV1Api throw IllegalStateException. #305

Conversation

takashima0411
Copy link
Contributor

BatchV1Api#deleteNamespacedJob throws Exception below.

com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 67 column 14 path $.status
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220)
	at com.google.gson.Gson.fromJson(Gson.java:879)
	at com.google.gson.Gson.fromJson(Gson.java:844)
	at com.google.gson.Gson.fromJson(Gson.java:793)
	at io.kubernetes.client.JSON.deserialize(JSON.java:110)
	at io.kubernetes.client.ApiClient.deserialize(ApiClient.java:668)
	at io.kubernetes.client.ApiClient.handleResponse(ApiClient.java:871)
	at io.kubernetes.client.ApiClient.execute(ApiClient.java:798)
	at io.kubernetes.client.apis.BatchV1Api.deleteNamespacedJobWithHttpInfo(BatchV1Api.java:511)
	at io.kubernetes.client.apis.BatchV1Api.deleteNamespacedJob(BatchV1Api.java:491)
	at jp.co.septeni_original.k8sop.CreateJobOperatorFactory.main(CreateJobOperatorFactory.java:99)
Caused by: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 67 column 14 path $.status
	at com.google.gson.stream.JsonReader.nextString(JsonReader.java:831)
	at com.google.gson.internal.bind.TypeAdapters$16.read(TypeAdapters.java:422)
	at com.google.gson.internal.bind.TypeAdapters$16.read(TypeAdapters.java:410)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:116)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:216)
	... 10 common frames omitted

Maybe K8S returns V1JobStatus.(Not V1Status)
response example.

{
    ...
    "status": {
        "conditions": [
            {
                "type": "Complete",
                "status": "True",
                "lastProbeTime": "2018-07-10T06:19:46Z",
                "lastTransitionTime": "2018-07-10T06:19:46Z"
            }
        ],
        "startTime": "2018-07-10T06:19:24Z",
        "completionTime": "2018-07-10T06:19:46Z",
        "succeeded": 1
    }
}

my test environment(GKE)

Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.2", GitCommit:"81753b10df112992bf51bbc2c2f85208aad78335", GitTreeState:"clean", BuildDate:"2018-05-12T04:12:12Z", GoVersion:"go1.9.6", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"8+", GitVersion:"v1.8.12-gke.1", GitCommit:"f47fa5292f604d07539ddbf7e5840b77d686051b", GitTreeState:"clean", BuildDate:"2018-05-11T16:56:15Z", GoVersion:"go1.8.3b4", Compiler:"gc", Platform:"linux/amd64"}

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 10, 2018
@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please sign in with your organization's credentials at https://identity.linuxfoundation.org/projects/cncf to be authorized.
  • If you have done the above and are still having issues with the CLA being reported as unsigned, please email the CNCF helpdesk: [email protected]

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jul 10, 2018
@takashima0411 takashima0411 force-pushed the fix_incorrect_object_mapping branch from a31c221 to 8b1a695 Compare July 10, 2018 08:13
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jul 10, 2018
@brendandburns
Copy link
Contributor

Sadly this is caused by this issue here:

#86

And we can't edit the generated code without introducing incompatible diffs. The main problem is that the Kubernetes API can return two different types and generated Swagger can't express that (yet)

I'm going to close this as we can't merge this, since it modifies auto-generated code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants