-
Notifications
You must be signed in to change notification settings - Fork 53
Add DocumentDB guides #935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # Base DocumentDB for COMPUTE autoscaling tests. | ||
| # Resources are deliberately LOW (cpu 500m / memory 1Gi) so a compute autoscaler | ||
| # with minAllowed above these values deterministically recommends a scale-UP to | ||
| # minAllowed (the recommendation floor), which creates a VerticalScaling ops request. | ||
| # local-path is fine for compute tests (no volume expansion involved). | ||
| apiVersion: kubedb.com/v1alpha2 | ||
| kind: DocumentDB | ||
| metadata: | ||
| name: dcdb | ||
| namespace: demo | ||
| spec: | ||
| version: 'pg17-0.109.0' | ||
| storageType: Durable | ||
| deletionPolicy: Delete | ||
| replicas: 3 | ||
| podTemplate: | ||
| spec: | ||
| containers: | ||
| - name: documentdb | ||
| resources: | ||
| requests: | ||
| cpu: 500m | ||
| memory: 1Gi | ||
| limits: | ||
| cpu: 500m | ||
| memory: 1Gi | ||
| storage: | ||
| storageClassName: "local-path" | ||
| accessModes: | ||
| - ReadWriteOnce | ||
| resources: | ||
| requests: | ||
| storage: 5Gi | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # COMPUTE (vertical) autoscaler for DocumentDB. | ||
| # The compute loop creates a VPA named after the DB's petset (= db name "dcdb"), | ||
| # polls VPA recommendations, and when the recommendation differs from the current | ||
| # request by more than resourceDiffPercentage (and the pod is older than | ||
| # podLifeTimeThreshold, OR the current request is outside the min/max band), | ||
| # it creates a VerticalScaling DocumentDBOpsRequest named dcops-dcdb-<rand>. | ||
| # | ||
| # Deterministic scale-UP: the base DB requests 500m/1Gi which is BELOW minAllowed | ||
| # (600m/1.5Gi) here, so the recommendation floor pushes it up to minAllowed. | ||
| apiVersion: autoscaling.kubedb.com/v1alpha1 | ||
| kind: DocumentDBAutoscaler | ||
| metadata: | ||
| name: dcdb-compute-autoscaler | ||
| namespace: demo | ||
| spec: | ||
| databaseRef: | ||
| name: dcdb | ||
| opsRequestOptions: | ||
| timeout: 5m | ||
| apply: IfReady # IfReady | Always | ||
| compute: | ||
| documentdb: | ||
| trigger: "On" # "On" | "Off" | ||
| podLifeTimeThreshold: 1m | ||
| resourceDiffPercentage: 5 | ||
| minAllowed: | ||
| cpu: 600m | ||
| memory: 1.5Gi | ||
| maxAllowed: | ||
| cpu: "2" | ||
| memory: 3Gi | ||
| controlledResources: ["cpu", "memory"] | ||
| containerControlledValues: "RequestsAndLimits" # RequestsAndLimits | RequestsOnly |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # Base DocumentDB for STORAGE autoscaling tests. | ||
| # Storage autoscaling issues a VolumeExpansion ops request, which REQUIRES an | ||
| # expandable StorageClass (allowVolumeExpansion: true). local-path is NOT | ||
| # expandable, so use longhorn (installed in this cluster). Start small (2Gi) so | ||
| # the volume fills past usageThreshold quickly when you write data. | ||
| apiVersion: kubedb.com/v1alpha2 | ||
| kind: DocumentDB | ||
| metadata: | ||
| name: dcdb | ||
| namespace: demo | ||
| spec: | ||
| version: 'pg17-0.109.0' | ||
| storageType: Durable | ||
| deletionPolicy: Delete | ||
| replicas: 3 | ||
| podTemplate: | ||
| spec: | ||
| containers: | ||
| - name: documentdb | ||
| resources: | ||
| requests: | ||
| cpu: 500m | ||
| memory: 1Gi | ||
| limits: | ||
| cpu: 500m | ||
| memory: 1Gi | ||
| storage: | ||
| storageClassName: "longhorn" | ||
| accessModes: | ||
| - ReadWriteOnce | ||
| resources: | ||
| requests: | ||
| storage: 2Gi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # STORAGE autoscaler for DocumentDB. | ||
| # The storage loop reads PVC usage from the custom-metrics API (volume_used_percentage) | ||
| # for the DB's pods. When usage% > usageThreshold, it computes a new size from | ||
| # scalingRules and creates a VolumeExpansion DocumentDBOpsRequest (capped at upperBound) | ||
| # using expansionMode. | ||
| # | ||
| # IMPORTANT: the DocumentDB storage autoscaler computes the scaled size ONLY from | ||
| # `scalingRules[].threshold` (see GetVolumeForOpsReq) -- the simpler top-level | ||
| # `scalingThreshold` field is NOT read by this controller path. You MUST provide | ||
| # scalingRules or NO ops request is ever created. A single rule with empty | ||
| # appliesUpto applies to all sizes; threshold "50%" grows capacity by 50%. | ||
|
Comment on lines
+7
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Align the documented growth math with the captured output. This example says Also applies to: 29-31 🤖 Prompt for AI Agents |
||
| # | ||
| # REQUIRES: an expandable StorageClass (provision the DB with autoscaling-storage-object.yaml) | ||
| # AND the custom.metrics.k8s.io API (storage-metrics-apiserver) -- metrics-server | ||
| # alone is NOT enough. The autoscaler ServiceAccount also needs get/list on | ||
| # custom.metrics.k8s.io (added to ClusterRole kubedb-kubedb-autoscaler). | ||
| apiVersion: autoscaling.kubedb.com/v1alpha1 | ||
| kind: DocumentDBAutoscaler | ||
| metadata: | ||
| name: dcdb-storage-autoscaler | ||
| namespace: demo | ||
| spec: | ||
| databaseRef: | ||
| name: dcdb | ||
| storage: | ||
| documentdb: | ||
| trigger: "On" # "On" | "Off" | ||
| usageThreshold: 60 # scale when PVC usage% is > 60 | ||
| scalingRules: # REQUIRED: drives the new size (scalingThreshold is ignored here) | ||
| - appliesUpto: "" # empty = applies to all current sizes | ||
| threshold: 50% # grow capacity by 50% (e.g. 2Gi -> 3Gi) | ||
| expansionMode: "Online" # Online | Offline (Online needs online-resize-capable CSI) | ||
| upperBound: 10Gi # never grow past this | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,27 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| apiVersion: kubedb.com/v1alpha2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| kind: DocumentDB | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| metadata: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: documentdb-cls-sample | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| namespace: demo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| spec: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| version: 'pg17-0.109.0' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| storageType: Durable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| deletionPolicy: Delete | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| replicas: 3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| configuration: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| secretName: documentdb-custom-config | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| podTemplate: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| spec: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| containers: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: documentdb | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| resources: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| requests: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cpu: 500m | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| memory: 2Gi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| storage: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| storageClassName: "local-path" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| accessModes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - ReadWriteOnce | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| resources: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| requests: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| storage: 5Gi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🔴 Critical | 🏗️ Heavy lift DocumentDB CR specifies PostgreSQL version string DocumentDB is a MongoDB-compatible database; the version should reflect a MongoDB/DocumentDB version (e.g., 🛠️ Suggested correction- version: 'pg17-0.109.0'
+ version: '5.1.0' # or appropriate KubeDB DocumentDB version📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: documentdb-custom-config | ||
| namespace: demo | ||
| stringData: | ||
| user.conf: | | ||
| max_connections=250 | ||
| work_mem=8MB | ||
|
Comment on lines
+1
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🔴 Critical | 🏗️ Heavy lift DocumentDB config Secret contains PostgreSQL settings, not DocumentDB/MongoDB settings. The This appears to be a copy-paste carryover from the Postgres guides that was not adapted for DocumentDB. 🛠️ Proposed fix (illustrative DocumentDB parameters)stringData:
user.conf: |
net.maxIncomingConnections=250
storage.wiredTiger.engineConfig.cacheSizeGB=0.5
operationProfiling.slowOpThresholdMs=100🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| apiVersion: kubedb.com/v1alpha2 | ||
| kind: DocumentDB | ||
| metadata: | ||
| name: documentdb-sa-sample | ||
| namespace: demo | ||
| spec: | ||
| version: 'pg17-0.109.0' | ||
| storageType: Durable | ||
| deletionPolicy: Delete | ||
| replicas: 1 | ||
| configuration: | ||
| inline: | ||
| user.conf: | | ||
| max_connections=300 | ||
| work_mem=16MB | ||
| podTemplate: | ||
| spec: | ||
| containers: | ||
| - name: documentdb | ||
| resources: | ||
| requests: | ||
| cpu: 500m | ||
| memory: 2Gi | ||
| storage: | ||
| storageClassName: "local-path" | ||
| accessModes: | ||
| - ReadWriteOnce | ||
| resources: | ||
| requests: | ||
| storage: 5Gi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| apiVersion: kubedb.com/v1alpha2 | ||
| kind: DocumentDB | ||
| metadata: | ||
| name: documentdb-sa-sample | ||
| namespace: demo | ||
| spec: | ||
| version: 'pg17-0.109.0' | ||
| storageType: Durable | ||
| deletionPolicy: Delete | ||
| replicas: 1 | ||
| configuration: | ||
| secretName: documentdb-custom-config | ||
|
Comment on lines
+7
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Standalone bootstrap issue noted in PR objectives. The PR objectives explicitly state "standalone ( 🤖 Prompt for AI Agents |
||
| podTemplate: | ||
| spec: | ||
| containers: | ||
| - name: documentdb | ||
| resources: | ||
| requests: | ||
| cpu: 500m | ||
| memory: 2Gi | ||
| storage: | ||
| storageClassName: "local-path" | ||
| accessModes: | ||
| - ReadWriteOnce | ||
| resources: | ||
| requests: | ||
| storage: 5Gi | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| apiVersion: kubedb.com/v1alpha2 | ||
| kind: DocumentDB | ||
| metadata: | ||
| name: documentdb-sa-sample | ||
| namespace: demo | ||
| spec: | ||
| version: 'pg17-0.109.0' | ||
| storageType: Durable | ||
| deletionPolicy: Delete | ||
| replicas: 1 | ||
| configuration: | ||
| tuning: | ||
| profile: oltp # web | oltp | dw | mixed | desktop | ||
| storageType: ssd # ssd | hdd | san | ||
| maxConnections: 200 | ||
| disableAutoTune: false | ||
| podTemplate: | ||
| spec: | ||
| containers: | ||
| - name: documentdb | ||
| resources: | ||
| requests: | ||
| cpu: 500m | ||
| memory: 2Gi | ||
| storage: | ||
| storageClassName: "local-path" | ||
| accessModes: | ||
| - ReadWriteOnce | ||
| resources: | ||
| requests: | ||
| storage: 5Gi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| apiVersion: ops.kubedb.com/v1alpha1 | ||
| kind: DocumentDBOpsRequest | ||
| metadata: | ||
| name: documentdb-cls-reconfigure-remove | ||
| namespace: demo | ||
| spec: | ||
| type: Reconfigure | ||
| databaseRef: | ||
| name: documentdb-cls-sample | ||
| configuration: | ||
| removeCustomConfig: true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| apiVersion: ops.kubedb.com/v1alpha1 | ||
| kind: DocumentDBOpsRequest | ||
| metadata: | ||
| name: documentdb-cls-reconfigure | ||
| namespace: demo | ||
| spec: | ||
| type: Reconfigure | ||
| databaseRef: | ||
| name: documentdb-cls-sample | ||
| configuration: | ||
| applyConfig: | ||
| user.conf: | | ||
| max_connections=250 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| apiVersion: ops.kubedb.com/v1alpha1 | ||
| kind: DocumentDBOpsRequest | ||
| metadata: | ||
| name: documentdb-sa-reconfigure | ||
| namespace: demo | ||
| spec: | ||
| type: Reconfigure | ||
| databaseRef: | ||
| name: documentdb-sa-sample | ||
| configuration: | ||
| applyConfig: | ||
| user.conf: | | ||
| max_connections=250 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| apiVersion: kubedb.com/v1alpha2 | ||
| kind: DocumentDB | ||
| metadata: | ||
| name: documentdb-cls-sample | ||
| namespace: demo | ||
| spec: | ||
| version: 'pg17-0.109.0' | ||
| storageType: Durable | ||
| deletionPolicy: Delete | ||
| replicas: 3 | ||
| podTemplate: | ||
| spec: | ||
| containers: | ||
| - name: documentdb | ||
| resources: | ||
| requests: | ||
| cpu: 500m | ||
| memory: 2Gi | ||
| storage: | ||
| storageClassName: "longhorn" | ||
| accessModes: | ||
| - ReadWriteOnce | ||
| resources: | ||
| requests: | ||
| storage: 5Gi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| apiVersion: ops.kubedb.com/v1alpha1 | ||
| kind: DocumentDBOpsRequest | ||
| metadata: | ||
| name: documentdb-cls-restart | ||
| namespace: demo | ||
| spec: | ||
| type: Restart | ||
| databaseRef: | ||
| name: documentdb-cls-sample |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| apiVersion: kubedb.com/v1alpha2 | ||
| kind: DocumentDB | ||
| metadata: | ||
| name: documentdb-cls-sample | ||
| namespace: demo | ||
| spec: | ||
| version: 'pg17-0.109.0' | ||
| storageType: Durable | ||
| deletionPolicy: Delete | ||
| replicas: 3 | ||
| podTemplate: | ||
| spec: | ||
| containers: | ||
| - name: documentdb | ||
| resources: | ||
| requests: | ||
| cpu: 500m | ||
| memory: 2Gi | ||
| storage: | ||
| storageClassName: "local-path" | ||
|
Comment on lines
+10
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Don't use The PR notes that multi-replica DocumentDB clusters on 🤖 Prompt for AI Agents |
||
| accessModes: | ||
| - ReadWriteOnce | ||
| resources: | ||
| requests: | ||
| storage: 5Gi | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| apiVersion: ops.kubedb.com/v1alpha1 | ||
| kind: DocumentDBOpsRequest | ||
| metadata: | ||
| name: documentdb-sa-restart | ||
| namespace: demo | ||
| spec: | ||
| type: Restart | ||
| databaseRef: | ||
| name: documentdb-sa-sample |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
This example uses a storage/topology combination the PR already calls out as broken.
The PR notes that multi-replica DocumentDB clusters on
local-pathstayReady=False, but this manifest setsreplicas: 3withstorageClassName: local-pathand even says that combination is fine. Because compute autoscaling needs a Ready database first, readers following this example will get stuck before anyVerticalScalingOpsRequest is created.Also applies to: 15-28
🤖 Prompt for AI Agents