Keycloak
54 строки · 1.9 Кб
1<#import "/templates/guide.adoc" as tmpl>
2<#import "/templates/links.adoc" as links>
3
4<@tmpl.guide
5title="Concepts to automate {jdgserver_name} CLI commands"
6summary="{jdgserver_name} CLI commands can be automated by creating a `Batch` CR instance."
7tileVisible="false" >
8
9include::partials/infinispan/infinispan-attributes.adoc[]
10
11When interacting with an external {jdgserver_name} in Kubernetes, the `Batch` CR allows you to automate this using standard `kubectl` commands.
12
13== When to use it
14
15Use this when automating interactions on Kubernetes.
16This avoids providing usernames and passwords and checking shell script outputs and their status.
17
18For human interactions, the CLI shell might still be a better fit.
19
20== Example
21
22The following `Batch` CR takes an {jdgserver_name} site offline as described in the operational procedure <@links.ha id="operate-switch-over" />.
23
24[source,yaml,subs="+attributes"]
25----
26apiVersion: infinispan.org/v2alpha1
27kind: Batch
28metadata:
29name: take-offline
30namespace: {ns} #<1>
31spec:
32cluster: {cluster-name} #<2>
33config: | #<3>
34site take-offline --all-caches --site={site-a-cr}
35site status --all-caches --site={site-a-cr}
36----
37<1> The `Batch` CR must be created in the same namespace as the {jdgserver_name} deployment.
38<2> The name of the Infinispan CR.
39<3> A multiline string containing one or more {jdgserver_name} CLI commands.
40
41Once the CR has been created, wait for the status to show the completion.
42
43[source,bash,subs="+attributes"]
44----
45kubectl -n {ns} wait --for=jsonpath='{.status.phase}'=Succeeded Batch/take-offline
46----
47
48NOTE: 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.
49
50== Further reading
51
52For more information, see the link:{infinispan-operator-docs}#batch-cr[{jdgserver_name} Operator Batch CR documentation].
53
54</@tmpl.guide>
55