Skip to content

Commit d832c10

Browse files
committed
Add read replica support for Postgres
Signed-off-by: Tamal Saha <[email protected]>
1 parent aa7ef77 commit d832c10

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

apis/kubedb/v1/postgres_types.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ type PostgresSpec struct {
169169

170170
// +optional
171171
Replication *PostgresReplication `json:"replication,omitempty"`
172+
173+
// +optional
174+
ReadReaplicas []ReadReplicaSpec `json:"readReaplicas,omitempty"`
172175
}
173176

174177
type PostgresConfiguration struct {
@@ -219,6 +222,29 @@ type ArbiterSpec struct {
219222
Tolerations []core.Toleration `json:"tolerations,omitempty"`
220223
}
221224

225+
type ReadReplicaSpec struct {
226+
// Name specifies the name of the read replica
227+
Name string `json:"name"`
228+
// Number of instances to deploy for a Postgres database.
229+
Replicas *int32 `json:"replicas,omitempty"`
230+
// Compute Resources required by the sidecar container.
231+
// +optional
232+
Resources core.ResourceRequirements `json:"resources,omitempty"`
233+
// NodeSelector is a selector which must be true for the pod to fit on a node.
234+
// Selector which must match a node's labels for the pod to be scheduled on that node.
235+
// More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
236+
// +optional
237+
// +mapType=atomic
238+
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
239+
// If specified, the pod's tolerations.
240+
// +optional
241+
Tolerations []core.Toleration `json:"tolerations,omitempty"`
242+
// StorageType can be durable (default) or ephemeral
243+
StorageType StorageType `json:"storageType,omitempty"`
244+
// Storage to specify how storage shall be used.
245+
Storage *core.PersistentVolumeClaimSpec `json:"storage,omitempty"`
246+
}
247+
222248
// PostgreLeaderElectionConfig contains essential attributes of leader election.
223249
type PostgreLeaderElectionConfig struct {
224250
// LeaseDuration is the duration in second that non-leader candidates will

0 commit comments

Comments
 (0)