@@ -229,3 +229,183 @@ func getGaleraLogMount() corev1.VolumeMount {
229229 SubPath : "log" ,
230230 }
231231}
232+
233+ func getGaleraVolumes (g * mariadbv1.Galera ) []corev1.Volume {
234+ configTemplates := []corev1.KeyToPath {
235+ {
236+ Key : "my.cnf.in" ,
237+ Path : ".my.cnf.in" ,
238+ },
239+ {
240+ Key : "galera.cnf.in" ,
241+ Path : "galera.cnf.in" ,
242+ },
243+ {
244+ Key : mariadbv1 .CustomServiceConfigFile ,
245+ Path : mariadbv1 .CustomServiceConfigFile ,
246+ },
247+ }
248+
249+ if g .Spec .SST == mariadbv1 .MariaBackup {
250+ configTemplates = append (configTemplates , corev1.KeyToPath {
251+ Key : "galera_sst_mariabackup.cnf.in" ,
252+ Path : "galera_sst_mariabackup.cnf.in" ,
253+ })
254+ }
255+
256+ volumes := []corev1.Volume {
257+ {
258+ Name : "secrets" ,
259+ VolumeSource : corev1.VolumeSource {
260+ Secret : & corev1.SecretVolumeSource {
261+ SecretName : g .Spec .Secret ,
262+ Items : []corev1.KeyToPath {
263+ {
264+ Key : "DbRootPassword" ,
265+ Path : "dbpassword" ,
266+ },
267+ },
268+ },
269+ },
270+ },
271+ {
272+ Name : "kolla-config" ,
273+ VolumeSource : corev1.VolumeSource {
274+ ConfigMap : & corev1.ConfigMapVolumeSource {
275+ LocalObjectReference : corev1.LocalObjectReference {
276+ Name : g .Name + "-config-data" ,
277+ },
278+ Items : []corev1.KeyToPath {
279+ {
280+ Key : "config.json" ,
281+ Path : "config.json" ,
282+ },
283+ },
284+ },
285+ },
286+ },
287+ {
288+ Name : "kolla-config-init" ,
289+ VolumeSource : corev1.VolumeSource {
290+ ConfigMap : & corev1.ConfigMapVolumeSource {
291+ LocalObjectReference : corev1.LocalObjectReference {
292+ Name : g .Name + "-config-data" ,
293+ },
294+ Items : []corev1.KeyToPath {
295+ {
296+ Key : "init_config.json" ,
297+ Path : "config.json" ,
298+ },
299+ },
300+ },
301+ },
302+ },
303+ {
304+ Name : "pod-config-data" ,
305+ VolumeSource : corev1.VolumeSource {
306+ EmptyDir : & corev1.EmptyDirVolumeSource {},
307+ },
308+ },
309+ {
310+ Name : "config-data" ,
311+ VolumeSource : corev1.VolumeSource {
312+ ConfigMap : & corev1.ConfigMapVolumeSource {
313+ LocalObjectReference : corev1.LocalObjectReference {
314+ Name : g .Name + "-config-data" ,
315+ },
316+ Items : configTemplates ,
317+ },
318+ },
319+ },
320+ {
321+ Name : "operator-scripts" ,
322+ VolumeSource : corev1.VolumeSource {
323+ ConfigMap : & corev1.ConfigMapVolumeSource {
324+ LocalObjectReference : corev1.LocalObjectReference {
325+ Name : g .Name + "-scripts" ,
326+ },
327+ Items : []corev1.KeyToPath {
328+ {
329+ Key : "mysql_bootstrap.sh" ,
330+ Path : "mysql_bootstrap.sh" ,
331+ },
332+ {
333+ Key : "mysql_probe.sh" ,
334+ Path : "mysql_probe.sh" ,
335+ },
336+ {
337+ Key : "detect_last_commit.sh" ,
338+ Path : "detect_last_commit.sh" ,
339+ },
340+ {
341+ Key : "detect_gcomm_and_start.sh" ,
342+ Path : "detect_gcomm_and_start.sh" ,
343+ },
344+ },
345+ },
346+ },
347+ },
348+ }
349+
350+ return volumes
351+ }
352+
353+ func getGaleraVolumeMounts (g * mariadbv1.Galera ) []corev1.VolumeMount {
354+ volumeMounts := []corev1.VolumeMount {
355+ {
356+ MountPath : "/var/lib/mysql" ,
357+ Name : "mysql-db" ,
358+ }, {
359+ MountPath : "/var/lib/config-data" ,
360+ ReadOnly : true ,
361+ Name : "config-data" ,
362+ }, {
363+ MountPath : "/var/lib/pod-config-data" ,
364+ Name : "pod-config-data" ,
365+ }, {
366+ MountPath : "/var/lib/secrets" ,
367+ ReadOnly : true ,
368+ Name : "secrets" ,
369+ }, {
370+ MountPath : "/var/lib/operator-scripts" ,
371+ ReadOnly : true ,
372+ Name : "operator-scripts" ,
373+ }, {
374+ MountPath : "/var/lib/kolla/config_files" ,
375+ ReadOnly : true ,
376+ Name : "kolla-config" ,
377+ },
378+ }
379+
380+ return volumeMounts
381+ }
382+
383+ func getGaleraInitVolumeMounts (g * mariadbv1.Galera ) []corev1.VolumeMount {
384+ volumeMounts := []corev1.VolumeMount {
385+ {
386+ MountPath : "/var/lib/mysql" ,
387+ Name : "mysql-db" ,
388+ }, {
389+ MountPath : "/var/lib/config-data" ,
390+ ReadOnly : true ,
391+ Name : "config-data" ,
392+ }, {
393+ MountPath : "/var/lib/pod-config-data" ,
394+ Name : "pod-config-data" ,
395+ }, {
396+ MountPath : "/var/lib/secrets" ,
397+ ReadOnly : true ,
398+ Name : "secrets" ,
399+ }, {
400+ MountPath : "/var/lib/operator-scripts" ,
401+ ReadOnly : true ,
402+ Name : "operator-scripts" ,
403+ }, {
404+ MountPath : "/var/lib/kolla/config_files" ,
405+ ReadOnly : true ,
406+ Name : "kolla-config-init" ,
407+ },
408+ }
409+
410+ return volumeMounts
411+ }
0 commit comments