kubernetesopenshiftcustom-objectkubernetes-custom-resources

Large payload for Custom Objects


While I can create custom objects just fine, I am wondering how one is supposed to handle large payloads (Gigabytes) for an object.

CRs are mostly used in order to interface with garbage collection/reference counting in Kubernetes.

Adding the payload via YAML does not work, though (out of memory for large payloads):

apiVersion: "data.foo.bar/v1" 
kind: Dump 
metadata:
  name: my-data
  ownerReferences:
    - apiVersion: apps/v1
      kind: Deploy
      name: my-deploy
      uid: d9607a69-f88f-11e7-a518-42010a800195
spec: 
  payload: dfewfawfjr345434hdg4rh4ut34gfgr_and_so_on_...

One could perhaps add the payload to a PV and just reference that path in the CR. Then I have the problem, that it seems like I cannot clean up the payload file, should the CR get finalized (could not find any info about custom Finalizers).

Have no clear idea how to integrate such a concept into Kubernetes lifetimes.


Solution

  • We still went with using the CO. Alongside, we created a Kubernetes Controller, which handles the lifetime in the PV. For us this works fine, since the Controller can be the single writer to the PV, while the actual Services only need read access to the PV. Combined with ownerReference, this makes for a good integration into the Kubernetes lifetime.