@@ -5,7 +5,7 @@ The ArangoDB Replication Operator creates and maintains ArangoDB
55This replication specification is a ` CustomResource ` following
66a ` CustomResourceDefinition ` created by the operator.
77
8- Example minimal replication definition:
8+ Example minimal replication definition for 2 ArangoDB cluster with sync in the same Kubernetes cluster :
99
1010``` yaml
1111apiVersion : " replication.database.arangodb.com/v1alpha"
@@ -15,17 +15,46 @@ metadata:
1515spec :
1616 source :
1717 deploymentName : cluster-a
18+ auth :
19+ keyfileSecretName : cluster-a-sync-auth
1820 destination :
1921 deploymentName : cluster-b
20- auth :
21- clientAuthSecretName : client-auth-cert
2222` ` `
2323
2424This definition results in:
2525
2626- the arangosync ` SyncMaster` in deployment `cluster-b` is called to configure a synchronization
27- from `cluster-a` to `cluster-b`, using the client authentication certificate stored in
28- ` Secret` ` client-auth-cert` .
27+ from the syncmasters in `cluster-a` to the syncmasters in `cluster-b`,
28+ using the client authentication certificate stored in `Secret` `cluster-a-sync-auth`.
29+ To access `cluster-a`, the JWT secret found in the deployment of `cluster-a` is used.
30+ To access `cluster-b`, the JWT secret found in the deployment of `cluster-b` is used.
31+
32+ Example replication definition for replicating from a source that is outside the current Kubernetes cluster
33+ to a destination that is in the same Kubernetes cluster :
34+
35+ ` ` ` yaml
36+ apiVersion: "replication.database.arangodb.com/v1alpha"
37+ kind: "ArangoDeploymentReplication"
38+ metadata:
39+ name: "replication-from-a-to-b"
40+ spec:
41+ source:
42+ endpoint: ["https://163.172.149.229:31888", "https://51.15.225.110:31888", "https://51.15.229.133:31888"]
43+ auth:
44+ keyfileSecretName: cluster-a-sync-auth
45+ tls:
46+ caSecretName: cluster-a-sync-ca
47+ destination:
48+ deploymentName: cluster-b
49+ ` ` `
50+
51+ This definition results in :
52+
53+ - the arangosync `SyncMaster` in deployment `cluster-b` is called to configure a synchronization
54+ from the syncmasters located at the given list of endpoint URL's to the syncmasters `cluster-b`,
55+ using the client authentication certificate stored in `Secret` `cluster-a-sync-auth`.
56+ To access `cluster-a`, the keyfile (containing a client authentication certificate) is used.
57+ To access `cluster-b`, the JWT secret found in the deployment of `cluster-b` is used.
2958
3059# # Specification reference
3160
@@ -38,13 +67,7 @@ with sync enabled.
3867
3968This cluster configured as the replication source.
4069
41- # ## `spec.source.deploymentNamespace: string`
42-
43- This setting specifies the Kubernetes namespace of an `ArangoDeployment` resource specified in `spec.source.deploymentName`.
44-
45- If this setting is empty, the namespace of the `ArangoDeploymentReplication` is used.
46-
47- # ## `spec.source.masterEndpoints: []string`
70+ # ## `spec.source.endpoint: []string`
4871
4972This setting specifies zero or more master endpoint URL's of the source cluster.
5073
@@ -53,12 +76,23 @@ that is reachable from the Kubernetes cluster the `ArangoDeploymentReplication`
5376
5477Specifying this setting and `spec.source.deploymentName` at the same time is not allowed.
5578
56- # ## `spec.source.auth.jwtSecretName : string`
79+ # ## `spec.source.auth.keyfileSecretName : string`
5780
58- This setting specifies the name of a `Secret` containing a JWT `token ` used to authenticate
81+ This setting specifies the name of a `Secret` containing a client authentication certificate called `tls.keyfile ` used to authenticate
5982with the SyncMaster at the specified source.
6083
61- This setting is required, unless `spec.source.deploymentName` has been set.
84+ If `spec.source.auth.userSecretName` has not been set,
85+ the client authentication certificate found in the secret with this name is also used to configure
86+ the synchronization and fetch the synchronization status.
87+
88+ This setting is required.
89+
90+ # ## `spec.source.auth.userSecretName: string`
91+
92+ This setting specifies the name of a `Secret` containing a `username` & `password` used to authenticate
93+ with the SyncMaster at the specified source in order to configure synchronization and fetch synchronization status.
94+
95+ The user identified by the username must have write access in the `_system` database of the source ArangoDB cluster.
6296
6397# ## `spec.source.tls.caSecretName: string`
6498
@@ -74,13 +108,7 @@ with sync enabled.
74108
75109This cluster configured as the replication destination.
76110
77- # ## `spec.destination.deploymentNamespace: string`
78-
79- This setting specifies the Kubernetes namespace of an `ArangoDeployment` resource specified in `spec.destination.deploymentName`.
80-
81- If this setting is empty, the namespace of the `ArangoDeploymentReplication` is used.
82-
83- # ## `spec.destination.masterEndpoints: []string`
111+ # ## `spec.destination.endpoint: []string`
84112
85113This setting specifies zero or more master endpoint URL's of the destination cluster.
86114
@@ -89,12 +117,27 @@ that is reachable from the Kubernetes cluster the `ArangoDeploymentReplication`
89117
90118Specifying this setting and `spec.destination.deploymentName` at the same time is not allowed.
91119
92- # ## `spec.destination.auth.jwtSecretName : string`
120+ # ## `spec.destination.auth.keyfileSecretName : string`
93121
94- This setting specifies the name of a `Secret` containing a JWT `token ` used to authenticate
122+ This setting specifies the name of a `Secret` containing a client authentication certificate called `tls.keyfile ` used to authenticate
95123with the SyncMaster at the specified destination.
96124
97- This setting is required, unless `spec.destination.deploymentName` has been set.
125+ If `spec.destination.auth.userSecretName` has not been set,
126+ the client authentication certificate found in the secret with this name is also used to configure
127+ the synchronization and fetch the synchronization status.
128+
129+ This setting is required, unless `spec.destination.deploymentName` or `spec.destination.auth.userSecretName` has been set.
130+
131+ Specifying this setting and `spec.destination.userSecretName` at the same time is not allowed.
132+
133+ # ## `spec.destination.auth.userSecretName: string`
134+
135+ This setting specifies the name of a `Secret` containing a `username` & `password` used to authenticate
136+ with the SyncMaster at the specified destination in order to configure synchronization and fetch synchronization status.
137+
138+ The user identified by the username must have write access in the `_system` database of the destination ArangoDB cluster.
139+
140+ Specifying this setting and `spec.destination.keyfileSecretName` at the same time is not allowed.
98141
99142# ## `spec.destination.tls.caSecretName: string`
100143
@@ -103,8 +146,62 @@ the TLS connection created by the SyncMaster at the specified destination.
103146
104147This setting is required, unless `spec.destination.deploymentName` has been set.
105148
106- # ## `spec.auth.clientAuthSecretName: string`
149+ # # Authentication details
150+
151+ The authentication settings in a `ArangoDeploymentReplication` resource are used for two distinct purposes.
152+
153+ The first use is the authentication of the syncmasters at the destination with the syncmasters at the source.
154+ This is always done using a client authentication certificate which is found in a `tls.keyfile` field
155+ in a secret identified by `spec.source.auth.keyfileSecretName`.
156+
157+ The second use is the authentication of the ArangoDB Replication operator with the syncmasters at the source
158+ or destination. These connections are made to configure synchronization, stop configuration and fetch the status
159+ of the configuration.
160+ The method used for this authentication is derived as follows (where `X` is either `source` or `destination`) :
161+
162+ - If `spec.X.userSecretName` is set, the username + password found in the `Secret` identified by this name is used.
163+ - If `spec.X.keyfileSecretName` is set, the client authentication certificate (keyfile) found in the `Secret` identifier by this name is used.
164+ - If `spec.X.deploymentName` is set, the JWT secret found in the deployment is used.
165+
166+ # # Creating client authentication certificate keyfiles
167+
168+ The client authentication certificates needed for the `Secrets` identified by `spec.source.auth.keyfileSecretName` & `spec.destination.auth.keyfileSecretName`
169+ are normal ArangoDB keyfiles that can be created by the `arangosync create client-auth keyfile` command.
170+ In order to do so, you must have access to the client authentication CA of the source/destination.
171+
172+ If the client authentication CA at the source/destination also contains a private key (`ca.key`), the ArangoDeployment operator
173+ can be used to create such a keyfile for you, without the need to have `arangosync` installed locally.
174+ Read the following paragraphs for instructions on how to do that.
175+
176+ # # Creating and using access packages
177+
178+ An access package is a YAML file that contains :
179+
180+ - A client authentication certificate, wrapped in a `Secret` in a `tls.keyfile` data field.
181+ - A TLS certificate authority public key, wrapped in a `Secret` in a `ca.crt` data field.
182+
183+ The format of the access package is such that it can be inserted into a Kubernetes cluster using the standard `kubectl` tool.
184+
185+ To create an access package that can be used to authenticate with the ArangoDB SyncMasters of an `ArangoDeployment`,
186+ add a name of a non-existing `Secret` to the `spec.sync.externalAccess.accessPackageSecretNames` field of the `ArangoDeployment`.
187+ In response, a `Secret` is created in that Kubernetes cluster, with the given name, that contains a `accessPackage.yaml` data field
188+ that contains a Kubernetes resource specification that can be inserted into the other Kubernetes cluster.
189+
190+ The process for creating and using an access package for authentication at the source cluster is as follows :
191+
192+ - Edit the `ArangoDeployment` resource of the source cluster, set `spec.sync.externalAccess.accessPackageSecretNames` to `["my-access-package"]`
193+ - Wait for the `ArangoDeployment` operator to create a `Secret` named `my-access-package`.
194+ - Extract the access package from the Kubernetes source cluster using :
195+
196+ ` ` ` bash
197+ kubectl get secret my-access-package --template='{{index .data "accessPackage.yaml"}}' | base64 -D > accessPackage.yaml
198+ ` ` `
199+
200+ - Insert the secrets found in the access package in the Kubernetes destination cluster using :
201+
202+ ` ` ` bash
203+ kubectl apply -f accessPackage.yaml
204+ ` ` `
107205
108- This setting specifies the name of a `Secret` containing a client authentication certificate,
109- used to authenticate the SyncMaster in the destination cluster with the SyncMaster in the
110- source cluster.
206+ As a result, the destination Kubernetes cluster will have 2 additional `Secrets`. One contains a client authentication certificate
207+ formatted as a keyfile. Another contains the public key of the TLS CA certificate of the source cluster.
0 commit comments