The Infinispan CLI currently has two modes: command-line and interactive. To improve the user experience when using the Infinispan Operator we can enhance the CLI to add Kubernetes capabilities.
Using Quarkus we can build the CLI as a native executable for the three most common platforms: Linux x86_64, OS X, Windows.
Installing the executable as kubectl-infinispan
allows invocation as a kubectl/oc
plugin, e.g.:
kubectl infinispan …
Using the Fabric8 Kubernetes Client we can automatically detect the existence of a Kubernetes configuration (default to ~/.kube/config
) and automatically connect to the Kubernetes cluster.
The Infinispan Kubernetes CLI plugin uses the default namespace for all operations, unless overridden with the --namespace
parameter.
kubectl infinispan install [-n namespace]
Install the Infinispan Operator in the specified namespace. This should also install the relevant OLM subscription and operator group so that the operator can be updated.
kubectl infinispan create cluster [-n namespace] [-r replicas] [--expose-type=type] [--expose-port=port] [--expose-host=hostname] [name]
Creates an Infinispan cluster:
* -n namespace
overrides the namespace.
* -r replicas
selects the initial number of replicas. Defaults to 1.
* --expose-type=LoadBalancer|NodePort|Route
selects how the service should be exposed.
* --expose-port=port
specifies the exposed port for LoadBalancer and NodePort types.
* --expose-host=hostname
specifies the exposed hostname for the Route type.
* --security-secret=secretname
specifies the secret to use for endpoint authentication.
* --security-cert-secret=secretname
the secret that contains a service certificate, tls.crt, and key, tls.key, in PEM format.
* --security-cert-service=servicename
the Red Hat OpenShift certificate service name.
kubectl infinispan scale -r replicas [servicename]
Scale an Infinispan cluster to the specified number of replicas
kubectl infinispan delete cluster [-n namespace] [servicename]
Stops and removes an Infinispan service.