|
1 | 1 | = postgres Operator Design |
2 | | -v1.4, {docdate} |
| 2 | +v1.5, {docdate} |
3 | 3 |
|
4 | 4 | image::crunchy_logo.png?raw=true[] |
5 | 5 |
|
@@ -111,3 +111,85 @@ PV (persistent volumes) is up to the administrator and insures that |
111 | 111 | no data is deleted by the operator. |
112 | 112 |
|
113 | 113 |
|
| 114 | +== PostgreSQL Operator Deployment Strategies |
| 115 | + |
| 116 | + |
| 117 | +This section describes the various deployment strategies |
| 118 | +offered by the operator. A deployment in this case is |
| 119 | +the set of objects created in Kubernetes when a |
| 120 | +third party resource of type *pgcluster* is created. |
| 121 | +TPRs are created by the pgo client command and acted upon |
| 122 | +by the postgres operator. |
| 123 | + |
| 124 | +=== Strategies |
| 125 | + |
| 126 | +To support different types of deployments, the operator supports |
| 127 | +multiple strategy implementations. Currently there is |
| 128 | +only a default *cluster* strategy. |
| 129 | + |
| 130 | +In the future, more deployment strategies will be supported |
| 131 | +to offer users more customization to what they see deployed |
| 132 | +in their Kube cluster. |
| 133 | + |
| 134 | +Being open source, users can also write their own strategy! |
| 135 | + |
| 136 | +=== Specifying a Strategy |
| 137 | + |
| 138 | +In the pgo client configuration file, there is a |
| 139 | +*CLUSTER.STRATEGY* setting. The current value of the |
| 140 | +default strategy is *1*. If you don't set that value, the |
| 141 | +default strategy is assumed. If you set that value to something |
| 142 | +not supported, the operator will log an error. |
| 143 | + |
| 144 | +=== Strategy Template Files |
| 145 | + |
| 146 | +Each strategy supplies its set of templates used by the operator |
| 147 | +to create new pods, services, etc. |
| 148 | + |
| 149 | +When the operator is deployed, part of the deployment process |
| 150 | +is to copy the required strategy templates into a ConfigMap (*operator-conf*) |
| 151 | +that gets mounted into */operator-conf* within the operator pod. |
| 152 | + |
| 153 | +The directory structure of the strategy templates is as |
| 154 | +follows: |
| 155 | +.... |
| 156 | +├── backup-job.json |
| 157 | +├── cluster |
| 158 | +│ └── 1 |
| 159 | +│ ├── cluster-deployment-1.json |
| 160 | +│ ├── cluster-replica-deployment-1.json |
| 161 | +│ └── cluster-service-1.json |
| 162 | +├── pvc.json |
| 163 | +.... |
| 164 | + |
| 165 | +In this structure, each strategy's templates live in a subdirectory |
| 166 | +that matches the strategy identifier. The default strategy templates |
| 167 | +are denoted by the value of *1* in the directory structure above. |
| 168 | + |
| 169 | +If you add another strategy, the file names *must* be unique within |
| 170 | +the entire strategy directory. This is due to the way the templates |
| 171 | +are stored within the ConfigMap. |
| 172 | + |
| 173 | + |
| 174 | +=== Default Cluster Deployment Strategy (1) |
| 175 | + |
| 176 | +Using the default cluster strategy, a *cluster* when created by the operator will create the |
| 177 | +following on a Kube cluster: |
| 178 | + |
| 179 | +image::operator-diagram-cluster.png?raw=true[] |
| 180 | + |
| 181 | +The default cluster strategy creates the following: |
| 182 | + |
| 183 | + * deployment running a Postgres *master* container with replica count of 1 |
| 184 | + * service mapped to the *master* Postgres database |
| 185 | + * service mapped to the *replica* Postgres database |
| 186 | + * PVC for the *master* will be created if not specified in configuration, this |
| 187 | + assumes you are using a non-shared volume technology (e.g. Amazon EBS), |
| 188 | + if the CLUSTER.PVC_NAME value is set in your configuration then a |
| 189 | + shared volume technology is assumed (e.g. HostPath or NFS), if a PVC |
| 190 | + is created for the master, the naming convention is *clustername-pvc* |
| 191 | + where clustername is the name of your cluster. |
| 192 | + |
| 193 | +If you want to add a Postgres replica to a cluster, you will |
| 194 | +*scale* the cluster, for each *replica-count*, a Deployment |
| 195 | +will be created that acts as a Postgres replica. |
0 commit comments