infinispan / infinispan-helm-charts

Apache License 2.0
13 stars 26 forks source link

any possibility to include a cache .json with a schema during pod launch? #84

Open makdeniss opened 12 months ago

makdeniss commented 12 months ago

So I have a quarkus pod that is starting after my infinispan pod is successfully up. I would like infinispan to have a specific cache schema already in place when its created / restarted / whatever. Is there a property in chart I can use to supply a json structure / file to do this?

ryanemerson commented 12 months ago

@makdeniss By Cache schema do you mean a cache instance, e.g. distributed-cache, replicated-cache, that will be available on server startup?

If so, it's possible to define these in the values.yaml under deploy.infinispan. For example:

deploy:
  ...
  infinispan:
    cacheContainer:
      # [USER] Add cache, template, and counter configuration.
      name: default
      # [USER] Specify `security: null` to disable security authorization.
      security:
        authorization: {}
      transport:
        cluster: ${infinispan.cluster.name:cluster}
        node-name: ${infinispan.node.name:}
        stack: kubernetes
      # Define one or more caches
      caches:
        mycacheone:
          distributedCache:
            mode: "ASYNC"
        mycachetwo:
          distributedCache:
            mode: "SYNC"
    server:
      ...

The defined caches will be created on server startup.

makdeniss commented 11 months ago

@ryanemerson thanks for the reply. And what about protobuf schemas? is it possible to pre-create these through chart on pod startup?

ryanemerson commented 11 months ago

@makdeniss Proto schemas can be registered with an infinispan server on startup by adding a .jar containing SerializationContextInitializer implementations to the server's server/lib directory.

In the helm charts the easiest way to do this is to provide the artifacts via deploy.container.libraries, e.g. deploy.container.libraries=org.postgresql:postgresql:42.3.1. This property allows artifacts to be downloaded via maven, http or ftp.