CreatePostgresVolumeMounts creates the volume mounts that are used by PostgreSQL Pods
(cluster apiv1.Cluster, extensions []apiv1.ExtensionConfiguration)
| 236 | // CreatePostgresVolumeMounts creates the volume mounts that are used |
| 237 | // by PostgreSQL Pods |
| 238 | func CreatePostgresVolumeMounts(cluster apiv1.Cluster, extensions []apiv1.ExtensionConfiguration) []corev1.VolumeMount { |
| 239 | volumeMounts := []corev1.VolumeMount{ |
| 240 | { |
| 241 | Name: pgdataVolumeName, |
| 242 | MountPath: "/var/lib/postgresql/data", |
| 243 | }, |
| 244 | { |
| 245 | Name: "scratch-data", |
| 246 | MountPath: "/run", |
| 247 | }, |
| 248 | { |
| 249 | Name: "scratch-data", |
| 250 | MountPath: postgres.ScratchDataDirectory, |
| 251 | }, |
| 252 | { |
| 253 | Name: "shm", |
| 254 | MountPath: "/dev/shm", |
| 255 | }, |
| 256 | } |
| 257 | |
| 258 | if cluster.ShouldCreateWalArchiveVolume() { |
| 259 | volumeMounts = append(volumeMounts, |
| 260 | corev1.VolumeMount{ |
| 261 | Name: "pg-wal", |
| 262 | MountPath: PgWalVolumePath, |
| 263 | }, |
| 264 | ) |
| 265 | } |
| 266 | |
| 267 | if cluster.ShouldCreateProjectedVolume() { |
| 268 | volumeMounts = append(volumeMounts, |
| 269 | corev1.VolumeMount{ |
| 270 | Name: "projected", |
| 271 | MountPath: postgres.ProjectedVolumeDirectory, |
| 272 | }, |
| 273 | ) |
| 274 | } |
| 275 | |
| 276 | // we should create volumeMounts in fixed sequence as podSpec will store it in annotation and |
| 277 | // later it will be retrieved to do deepEquals |
| 278 | if cluster.ContainsTablespaces() { |
| 279 | tbsNames := getSortedTablespaceList(&cluster) |
| 280 | for i := range tbsNames { |
| 281 | volumeMounts = append(volumeMounts, |
| 282 | corev1.VolumeMount{ |
| 283 | Name: VolumeMountNameForTablespace(tbsNames[i]), |
| 284 | MountPath: MountForTablespace(tbsNames[i]), |
| 285 | }, |
| 286 | ) |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | volumeMounts = append(volumeMounts, CreateExtensionVolumeMounts(extensions)...) |
| 291 | |
| 292 | return volumeMounts |
| 293 | } |
| 294 | |
| 295 | func getSortedTablespaceList(cluster *apiv1.Cluster) []string { |
no test coverage detected