Coder Social home page Coder Social logo

client-java's People

Contributors

dependabot[bot] avatar fillzpp avatar kuromesi avatar veophi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

client-java's Issues

Patch body examples for CustomObjectsApi.patchNamespacedCustomObject()

I like to patch a cloneset using the CustomObjectsApi.patchNamespacedCustomObject() Java API to update the number of replicas with podsToDelete. Like the patch_file.yaml example below:

spec:
  replicas: 5
  scaleStrategy:
    podsToDelete:
    - node-0f03b-kcgbt

The kubectl --patch command below works fine:

> kubectl patch clone/mycloneset --type merge --patch "$(cat patch_file.yaml)"

I am trying to figure out how to do it through the Java API. Code below works to update the replicas to be 5.

 String jsonPatchStr="[{\"op\":\"replace\",\"path\":\"/spec/replicas\",\"value\":5}]";
 V1Patch body = new V1Patch(jsonPatchStr);
 customObjectsApi.patchNamespacedCustomObject(
      "apps.kruise.io",     // group
      "v1alpha1",           // version
      cluster,              // namespace
      "clonesets",          // plural
      cloneset,             // name
      body,                 // Object body
      null,                 // dryRun
      null,                 // fieldManager
      null                  // force
  );

How do I include the podsToDelete into the jsonPatchStr? Or is there another simpler way to prepare the body parameter given patch_file.yaml?

Update model to be compatible with newer io.kubernetes client-java

The models included, like KruiseAppsV1alpha1CloneSet, are compatible with io.kubernetes client-java 5.0.0. It will lead to error like java.lang.ClassNotFoundException: io.kubernetes.client.models.V1ObjectMeta if later version of io.kubernetes client-java is used.

Comments in the model code suggest they were generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen. However I don't see clear instructions on how to re-generate the models based on newer version of io.kubernetes client-java, like 11.0.0.

How to generate new models that are compatible with more recent io.kubernetes client-java?

JsonSyntaxException related to status.conditions[0].lastTransitionTime

Hit following error to parse getNamespacedCustomObject() result into KruiseAppsV1alpha1CloneSet (gson 2.8.9).

com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at path $.status.conditions[0].lastTransitionTime

unfortunately I don't have the status.conditions[0].lastTransitionTime field as it does not normally exists in the cloneset object and we didn't save a copy when it happened (I will add an example if this happens again in the future). I wonder whether there is a possible mismatch between the expected and real format of the field. Or like to know if there is a better way to obtain KruiseAppsV1alpha1CloneSet from the returned obj.

    ApiClient client = Config.defaultClient();
    Configuration.setDefaultApiClient(client);
    CustomObjectsApi customObjectsApi = new CustomObjectsApi(client);
    Object obj = customObjectsApi.getNamespacedCustomObject(
        "apps.kruise.io",                 // group
        "v1alpha1",                       // version
        K8sCommon.getNamespaceFromEnv(),  // namespace
        "clonesets",                      // plural
        cloneset                          // name
    );

    Gson gson = new JSON().getGson();
    KruiseAppsV1alpha1CloneSet v1cs = gson.fromJson(
        gson.toJsonTree(obj).getAsJsonObject(), KruiseAppsV1alpha1CloneSet.class);

Build with k8s.client.version 14.0.0 failed with CustomObjectsApiTest error

I have motivation to use more recent io.kubernetes client-java 14.0.0 and try to build the project with <k8s.client.version>14.0.0</k8s.client.version> in pom.xml. It failed with following test error:

CustomObjectsApiTest.java:[185,30] method listClusterCustomObject in class io.kubernetes.client.openapi.apis.CustomObjectsApi cannot be applied to given types ...

Such error appears to be superficial as no code in the package is calling listClusterCustomObject any more. So please consider removing such tests as well.

java client使用问题

你好,请问下openkruise的java client项目是否一直在维护呢?我们平台是用java开发的,目前想接入openkruise,所以想问一下Java client和Golang client的维护情况,谢谢!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.