diff --git a/docs/user.md b/docs/user.md index b032b6c04..e0656d420 100644 --- a/docs/user.md +++ b/docs/user.md @@ -268,7 +268,7 @@ spec: Things to note: - An empty string is provided in s3_wal_path of the standby cluster will result in error and no statefulset will be created. -- If standby is not needed, simply remove the standby_cluster section from the patroni through patronictl edit-config. +- To manually promote the standby_cluster, use patronictl and remove config entry. - There is no way to transform a non-standby cluster to standby cluster through operator. Hence, if a cluster is created without standby section in YAML and later modified by adding that section, there will be no effect on the cluster. However, it can be done through Patroni by adding the standby_cluster section using patronictl edit-config. Note that the transformed standby cluster will not be doing any streaming, rather will just be in standby mode and allow read-only transactions only. ## Sidecar Support diff --git a/manifests/complete-postgres-manifest.yaml b/manifests/complete-postgres-manifest.yaml index b6cda7caa..5bc2e0b56 100644 --- a/manifests/complete-postgres-manifest.yaml +++ b/manifests/complete-postgres-manifest.yaml @@ -11,6 +11,7 @@ spec: teamId: "ACID" volume: size: 1Gi + #storageClass: my-sc numberOfInstances: 2 users: #Application/Robot users zalando: @@ -37,6 +38,7 @@ spec: limits: cpu: 300m memory: 300Mi + # spiloFSGroup: 103 patroni: initdb: encoding: "UTF8" @@ -67,6 +69,23 @@ spec: # Make this a standby cluster and provide the s3 bucket path of source cluster for continuous streaming. # standby: # s3_wal_path: "s3://path/to/bucket/containing/wal/of/source/cluster/" + + # run periodic backups with k8s cron jobs + # enableLogicalBackup: true + # logicalBackupSchedule: "30 00 * * *" maintenanceWindows: - 01:00-06:00 #UTC - Sat:00:00-04:00 + #sidecars: + # - name: "telegraf-sidecar" + # image: "telegraf:latest" + # resources: + # limits: + # cpu: 500m + # memory: 500Mi + # requests: + # cpu: 100m + # memory: 100Mi + # env: + # - name: "USEFUL_VAR" + # value: "perhaps-true" diff --git a/pkg/apis/acid.zalan.do/v1/postgresql_type.go b/pkg/apis/acid.zalan.do/v1/postgresql_type.go index f741861fe..f41fe054e 100644 --- a/pkg/apis/acid.zalan.do/v1/postgresql_type.go +++ b/pkg/apis/acid.zalan.do/v1/postgresql_type.go @@ -30,6 +30,8 @@ type PostgresSpec struct { TeamID string `json:"teamId"` DockerImage string `json:"dockerImage,omitempty"` + SpiloFSGroup *int64 `json:"spiloFSGroup,omitempty"` + // vars that enable load balancers are pointers because it is important to know if any of them is omitted from the Postgres manifest // in that case the var evaluates to nil and the value is taken from the operator config EnableMasterLoadBalancer *bool `json:"enableMasterLoadBalancer,omitempty"` @@ -43,18 +45,20 @@ type PostgresSpec struct { // load balancers' source ranges are the same for master and replica services AllowedSourceRanges []string `json:"allowedSourceRanges"` - NumberOfInstances int32 `json:"numberOfInstances"` - Users map[string]UserFlags `json:"users"` - MaintenanceWindows []MaintenanceWindow `json:"maintenanceWindows,omitempty"` - Clone CloneDescription `json:"clone"` - ClusterName string `json:"-"` - Databases map[string]string `json:"databases,omitempty"` - Tolerations []v1.Toleration `json:"tolerations,omitempty"` - Sidecars []Sidecar `json:"sidecars,omitempty"` - InitContainers []v1.Container `json:"init_containers,omitempty"` - PodPriorityClassName string `json:"pod_priority_class_name,omitempty"` - ShmVolume *bool `json:"enableShmVolume,omitempty"` - StandbyCluster *StandbyDescription `json:"standby"` + NumberOfInstances int32 `json:"numberOfInstances"` + Users map[string]UserFlags `json:"users"` + MaintenanceWindows []MaintenanceWindow `json:"maintenanceWindows,omitempty"` + Clone CloneDescription `json:"clone"` + ClusterName string `json:"-"` + Databases map[string]string `json:"databases,omitempty"` + Tolerations []v1.Toleration `json:"tolerations,omitempty"` + Sidecars []Sidecar `json:"sidecars,omitempty"` + InitContainers []v1.Container `json:"init_containers,omitempty"` + PodPriorityClassName string `json:"pod_priority_class_name,omitempty"` + ShmVolume *bool `json:"enableShmVolume,omitempty"` + EnableLogicalBackup bool `json:"enableLogicalBackup,omitempty"` + LogicalBackupSchedule string `json:"logicalBackupSchedule,omitempty"` + StandbyCluster *StandbyDescription `json:"standby"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/pkg/apis/acid.zalan.do/v1/zz_generated.deepcopy.go b/pkg/apis/acid.zalan.do/v1/zz_generated.deepcopy.go index 84f32b9e4..fe5a435dd 100644 --- a/pkg/apis/acid.zalan.do/v1/zz_generated.deepcopy.go +++ b/pkg/apis/acid.zalan.do/v1/zz_generated.deepcopy.go @@ -385,6 +385,11 @@ func (in *PostgresSpec) DeepCopyInto(out *PostgresSpec) { out.Volume = in.Volume in.Patroni.DeepCopyInto(&out.Patroni) out.Resources = in.Resources + if in.SpiloFSGroup != nil { + in, out := &in.SpiloFSGroup, &out.SpiloFSGroup + *out = new(int64) + **out = **in + } if in.EnableMasterLoadBalancer != nil { in, out := &in.EnableMasterLoadBalancer, &out.EnableMasterLoadBalancer *out = new(bool)