Skip to content

Add DocumentDB DC-DR types (status.disasterRecovery, distributed, per-DC HorizontalScaling) - #1805

Open
tamalsaha wants to merge 1 commit into
masterfrom
dc-dr-documentdb
Open

tamalsaha wants to merge 1 commit into
masterfrom
dc-dr-documentdb

Conversation

@tamalsaha

Copy link
Copy Markdown
Member

Summary

This is the DocumentDB fan-out of the Postgres cross data center disaster recovery (DC-DR) design. It adds the apimachinery types DocumentDB needs so the operator and coordinator can express distributed multi-DC clusters and report their DR state.

apis/kubedb/v1alpha2/documentdb_types.go

  • DocumentDBSpec.Distributed bool (json distributed). When true, the operator expands the CR into per-DC manifestwork objects instead of raw resources.
  • DocumentDBSpec.PodPlacementPolicy *core.LocalObjectReference (json podPlacementPolicy, defaults to {name:"default"}).
  • DocumentDBStatus.DisasterRecovery *DocumentDBDisasterRecoveryStatus (json disasterRecovery), the cross-DC view reflected onto the single Database object.
  • New types: DocumentDBDRPhase (consts Steady, FailingOver, FailingBack, Degraded), DocumentDBDisasterRecoveryStatus (ActiveDC, Phase, DataCenters, LastTransitionTime), and DocumentDBDCStatus (ClusterName, Role, Leader, Writable, LagBytes, Healthy).

apis/ops/v1alpha1/documentdb_ops_types.go

  • DocumentDBHorizontalScalingSpec.DataCenters []DocumentDBHorizontalScalingDC (json dataCenters), for scaling each DC's local node count independently.
  • New type DocumentDBHorizontalScalingDC (ClusterName, Replicas).

Deepcopy

Hand-edited zz_generated.deepcopy.go in both packages to match the shapes the Postgres generated funcs use (pointer alloc for LagBytes and LastTransitionTime, range copy for DataCenters, LocalObjectReference and DisasterRecovery pointer deepcopy).

Verification

go build ./apis/... and go vet ./apis/kubedb/v1alpha2/... ./apis/ops/v1alpha1/... both pass.

Notes

  • CRD and openapi regeneration is intentionally deferred to CI make gen, so status.disasterRecovery and the new spec fields are not yet in the generated schema.
  • This is staging step 1 of the DocumentDB DC-DR rollout. It must merge and release before the DocumentDB operator will compile against these types.

Signed-off-by: Tamal Saha <tamal@appscode.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant