Concepts to automate Infinispan CLI commands

Infinispan CLI commands can be automated by creating a `Batch` CR instance.

When interacting with an external Infinispan in Kubernetes, the Batch CR allows you to automate this using standard kubectl commands.

When to use it

Use this when automating interactions on Kubernetes. This avoids providing usernames and passwords and checking shell script outputs and their status.

For human interactions, the CLI shell might still be a better fit.

Example

The following Batch CR takes a site offline as described in the operational procedure Take site offline.

apiVersion: infinispan.org/v2alpha1
kind: Batch
metadata:
  name: take-offline
  namespace: keycloak (1)
spec:
  cluster: infinispan (2)
  config: | (3)
    site take-offline --all-caches --site=site-a
    site status --all-caches --site=site-a
1 The Batch CR must be created in the same namespace as the Infinispan deployment.
2 The name of the Infinispan CR.
3 A multiline string containing one or more Infinispan CLI commands.

Once the CR has been created, wait for the status to show the completion.

kubectl -n keycloak wait --for=jsonpath='{.status.phase}'=Succeeded Batch/take-offline
Modifying a Batch CR instance has no effect. Batch operations are “one-time” events that modify Infinispan resources. To update .spec fields for the CR, or when a batch operation fails, you must create a new instance of the Batch CR.

Further reading

For more information, see the Infinispan Operator Batch CR documentation.

On this page