javakubernetesintellij-ideafabric8

Kubernetes job creation method showing as deprecated in IntelliJ. I am using Fabric8 Kubernetes Client api


I am using Fabric8 Kubernetes Client library to for Java to create Kubernetes job, but the create method is shown as deprecated. I checked all the available docs and I don't see that its deprecated but IntelliJ IDE is showing as deprecated.

While searching for solution, I found out this link https://github.com/fabric8io/kubernetes-client/issues/3309. I used the same method as defined in the link but IDE still showing it as deprecated.

Here is the screenshot. I am using fabric8 version 6.0.0

enter image description here

Kindly guide me how can I fix this deprecation issue.


Solution

  • Since Fabric8 v6, we've introduced a new resource(T item) DSL method which recieves the resource which is supposed to be operated on. You should be able to access all operations from here.

    So, you need to change your code to this:

    Job job2 = client.batch().v1().jobs().inNamespace("default").resource(job).create();
    

    You can read more about this in Fabric8 v6 Migration guide.