Giter Site home page Giter Site logo

Comments (5)

Crumby avatar Crumby commented on August 29, 2024

It's possible to work with CustomResourceDefinition without knowing its type and thus delete it. But I'm not sure that will work for all CustomResources.

from xtf.

mchoma avatar mchoma commented on August 29, 2024

Could you reference some example of working with CustomResourceDefinition ? Anyway it is cluster scoped resource. I would expect OpenShift.clean() cleans only namespace scoped resources.

from xtf.

dsimansk avatar dsimansk commented on August 29, 2024

Some examples can be found in fabric8io/kubernetes-client repository.

Working with CustomResourceDefinitions
https://github.com/fabric8io/kubernetes-client/blob/master/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/CRDLoadExample.java
https://github.com/fabric8io/kubernetes-client/blob/master/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ListCustomResourceDefinitions.java

The first approach with POJOs:
https://github.com/fabric8io/kubernetes-client/blob/master/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/CRDExample.java

The newer API levering raw approach without POJOs:
https://github.com/fabric8io/kubernetes-client/blob/master/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/RawCustomResourceExample.java

AFAIK, there's no definitive and good answer from client devs. They're working on simplifying the whole process. Anyway the former approach required to define POJOs for CustomResources to allow serialization/deserializationa and CRUD operations. There's no way for java client to have a model of custom resource available and the way it's implemented it can manipulate (CRUD) on such resources either.

In Kafka Operator (Java based operator) they do generate class model the same way as in kubernetes-client, because they also leverage the client directly.

IMO the raw approach seems a bit more promising and easier to impl/maintain, but I haven't tried it yet.

Anyway I don't think we can/should add a direct support to XTF for any of the specific CRDs, CRs. That'd make it even more obscure to work with.
@Crumby @maschmid probably something like a clean hook (Java SPI) to be executed afterwards to extend clean capability?

from xtf.

maschmid avatar maschmid commented on August 29, 2024

It should be possible to use a dynamic client (just for deletion), as you don't have to know anything about the CRDs to delete its CRs. You only need to know the Group, Version and Resource to get the list of CRs and to delete them. (so we could have something like

openshift.clean(new GroupVersionResource("cool.io","v1alpha1", "foos"), new GroupVersionResource("cool.io","v1alpha1", "bars"), ...);

To have clean delete all "all"s, it would only have to list all CRDs that list "all" as its category.. (note that it doesn't necessary mean "all CRDs that exist") , not sure if "oc" use some special API for it (as apparently it knows the list even if the user cannot list CRDs... )

from xtf.

Crumby avatar Crumby commented on August 29, 2024

Resolved by #299. Closing.

from xtf.

Related Issues (20)

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.