SHARE
TWEET

Untitled

a guest Mar 20th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @ApplicationScoped
  2. @CustomResourceController(MyCustomResource.class)
  3. public class MyCustomResourceController {
  4.  
  5.   @Inject
  6.   NamespacedKubernetesClient client;
  7.   @Inject
  8.   CustomResourceDefinition crd;
  9.   @Inject
  10.   CustomResourceClient<MyCustomResource> myCustomResources;
  11.  
  12.   @POST
  13.   @Path("/my/customresource")
  14.   public JsonNode getCurrentState() {
  15.     MyCustomResource r = myCustomResources.create(new MyCustomResourceBuilder()
  16.         .withName("world")
  17.         .build());
  18.  
  19.     return JsonNodeFactory.instance.objectNode().put("hello", r.getName());
  20.   }
  21.  
  22.   void reconcile(@Observes ResourceReconcileEvent<MyCustomResource> ev) {
  23.     ev.reconcile((prev, next) -> {
  24.       return next;
  25.     });
  26.   }
  27.  
  28.   void added(@Observes ResourceAddedEvent<MyCustomResource> added) {
  29.     added.source().getMetadata().getOwnerReferences();
  30.     added.source().getMetadata().getCreationTimestamp();
  31.     added.source().getName();
  32.   }
  33.  
  34.   void deleted(@Observes ResourceDeletedEvent<MyCustomResource> deleted) {
  35.     deleted.source().getMetadata().getDeletionTimestamp();
  36.   }
  37.  
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top