Skip to content

Commit c9350a7

Browse files
committed
address comments
1 parent 9dd45b7 commit c9350a7

File tree

7 files changed

+431
-137
lines changed

7 files changed

+431
-137
lines changed

api/preview/documentdb_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ type StorageConfiguration struct {
8282

8383
type ClusterReplication struct {
8484
// CrossCloudNetworking determines which type of networking mechanics for the replication
85+
// +kubebuilder:validation:Enum=AzureFleet;Istio;None
8586
CrossCloudNetworkingStrategy string `json:"crossCloudNetworkingStrategy,omitempty"`
8687
// Primary is the name of the primary cluster for replication.
8788
Primary string `json:"primary"`

config/crd/bases/db.microsoft.com_documentdbs.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ spec:
8181
crossCloudNetworkingStrategy:
8282
description: CrossCloudNetworking determines which type of networking
8383
mechanics for the replication
84+
enum:
85+
- AzureFleet
86+
- Istio
87+
- None
8488
type: string
8589
highAvailability:
8690
description: Whether or not to have replicas on the primary cluster.

docs/multi-cloud-deployment-guide.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ possible and will be documented as they are tested.
3131
- Two kubernetes clusters that are network connected to each other. For example using
3232
- [Azure VPN Gatway](https://learn.microsoft.com/en-us/azure/vpn-gateway/vpn-gateway-about-vpngateways)
3333
- [Azure ExpressRoute](https://learn.microsoft.com/en-us/azure/expressroute/expressroute-introduction)
34-
- ENV variables `$AZURE_MEMBER` and `$ON_PREM_MEMBER` with the kubectl context names for your clusters
34+
- ENV variables `$CLOUD_MEMBER` and `$ON_PREM_MEMBER` with the kubectl context names for your clusters
3535
- (e.g. "azure-documentdb-cluster", "k3s-cluster-context")
3636

3737
## Architecture Overview
@@ -94,7 +94,7 @@ Run `kubectl get membercluster -A` again and see `True` under `JOINED` to confir
9494

9595
```bash
9696
# Install on primary
97-
kubectl config use-context $AZURE_MEMBER
97+
kubectl config use-context $CLOUD_MEMBER
9898
helm repo add jetstack https://charts.jetstack.io
9999
helm repo update
100100
helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --set installCRDs=true
@@ -251,7 +251,7 @@ kubectl apply -f ./documentdb-base.yaml
251251
After a few seconds, ensure that the operator is running on both of the clusters
252252

253253
```sh
254-
kubectl config use-context $AZURE_MEMBER
254+
kubectl config use-context $CLOUD_MEMBER
255255
kubectl get deployment -n documentdb-operator
256256
kubectl config use-context $ON_PREM_MEMBER
257257
kubectl get deployment -n documentdb-operator
@@ -274,21 +274,21 @@ Physical replication provides high availability and disaster recovery capabiliti
274274
```bash
275275
kubectl config use-context $ON_PREM_MEMBER
276276
kubectl create configmap cluster-name -n kube-system --from-literal=name=on-prem-cluster-name
277-
kubectl config use-context $AZURE_MEMBER
278-
kubectl create configmap cluster-name -n kube-system --from-literal=name=azure-cluster-name
277+
kubectl config use-context $CLOUD_MEMBER
278+
kubectl create configmap cluster-name -n kube-system --from-literal=name=cloud-cluster-name
279279
```
280280

281281
OR
282282

283283
```bash
284-
cat <<EOF > azure-cluster-name.yaml
284+
cat <<EOF > cloud-cluster-name.yaml
285285
apiVersion: v1
286286
kind: ConfigMap
287287
metadata:
288288
name: cluster-name
289289
namespace: kube-system
290290
data:
291-
name: "azure-cluster-name"
291+
name: "cloud-cluster-name"
292292
EOF
293293

294294
cat <<EOF > on-prem-name.yaml
@@ -301,7 +301,7 @@ data:
301301
name: "on-prem-cluster-name"
302302
EOF
303303

304-
kubectl config use-context $AZURE_MEMBER
304+
kubectl config use-context $CLOUD_MEMBER
305305
kubectl apply -f ./primary-name.yaml
306306
kubectl config use-context $ON_PREM_MEMBER
307307
kubectl apply -f ./replica-name.yaml
@@ -332,9 +332,9 @@ spec:
332332
storage:
333333
pvcSize: 10Gi
334334
clusterReplication:
335-
primary: azure-cluster-name
335+
primary: cloud-cluster-name
336336
clusterList:
337-
- name: azure-cluster-name
337+
- name: cloud-cluster-name
338338
- name: on-prem-cluster-name
339339
exposeViaService:
340340
serviceType: ClusterIP
@@ -364,7 +364,7 @@ kubectl apply -f ./documentdb-resource.yaml
364364
After a few seconds, ensure that the operator is running on both of the clusters
365365

366366
```sh
367-
kubectl config use-context $AZURE_MEMBER
367+
kubectl config use-context $CLOUD_MEMBER
368368
kubectl get pods -n documentdb-operator-ns
369369
kubectl config use-context $ON_PREM_MEMBER
370370
kubectl get pods -n documentdb-operator-ns
@@ -374,16 +374,16 @@ Output:
374374

375375
```text
376376
NAME READY STATUS RESTARTS AGE
377-
azure-cluster-name-1 2/2 Running 0 3m33s
377+
cloud-cluster-name-1 2/2 Running 0 3m33s
378378
```
379379

380380
## Testing and Verification
381381

382382
1. Test connection to DocumentDB:
383383

384384
```bash
385-
# Get the service IP from primary (azure)
386-
kubectl config use-context $AZURE_MEMBER
385+
# Get the service IP from primary (cloud)
386+
kubectl config use-context $CLOUD_MEMBER
387387
service_ip=$(kubectl get service documentdb-service-documentdb-preview -n documentdb-preview-ns -o jsonpath="{.status.loadBalancer.ingress[0].ip}")
388388

389389
# Connect using mongosh

documentdb-chart/crds/db.microsoft.com_documentdbs.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ spec:
8181
crossCloudNetworkingStrategy:
8282
description: CrossCloudNetworking determines which type of networking
8383
mechanics for the replication
84+
enum:
85+
- AzureFleet
86+
- Istio
87+
- None
8488
type: string
8589
highAvailability:
8690
description: Whether or not to have replicas on the primary cluster.

internal/controller/documentdb_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ func Promote(ctx context.Context, cli client.Client,
301301
}
302302

303303
// executeSQLCommand creates a pod to execute SQL commands against the azure-cluster-rw service
304+
// TODO: Should find a less intrusive way to do this with CNPG
304305
func (r *DocumentDBReconciler) executeSQLCommand(ctx context.Context, documentdb *dbpreview.DocumentDB, replicationContext *util.ReplicationContext, sqlCommand, uniqueName string) error {
305306
zero := int32(0)
306307
host := replicationContext.Self + "-rw"

0 commit comments

Comments
 (0)