@@ -25,18 +25,12 @@ import (
2525 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2626)
2727
28- const (
29- // DBSyncCommand -
30- DBSyncCommand = "/usr/local/bin/kolla_set_configs && /usr/local/bin/kolla_start"
31- )
32-
3328// DbSyncJob func
3429func DbSyncJob (
3530 instance * keystonev1.KeystoneAPI ,
3631 labels map [string ]string ,
3732 annotations map [string ]string ,
3833) * batchv1.Job {
39- runAsUser := int64 (0 )
4034
4135 args := []string {"-c" , DBSyncCommand }
4236
@@ -46,13 +40,13 @@ func DbSyncJob(
4640
4741 // create Volume and VolumeMounts
4842 volumes := getVolumes (instance )
49- volumeMounts := getVolumeMounts ()
43+ volumeMounts := getDBSyncVolumeMounts ()
5044
5145 // add CA cert if defined
5246 if instance .Spec .TLS .CaBundleSecretName != "" {
5347 //TODO(afaranha): Why not reuse the 'volumes'?
5448 volumes = append (getVolumes (instance ), instance .Spec .TLS .CreateVolume ())
55- volumeMounts = append (getVolumeMounts (), instance .Spec .TLS .CreateVolumeMounts (nil )... )
49+ volumeMounts = append (getDBSyncVolumeMounts (), instance .Spec .TLS .CreateVolumeMounts (nil )... )
5650 }
5751
5852 job := & batchv1.Job {
@@ -75,13 +69,11 @@ func DbSyncJob(
7569 Command : []string {
7670 "/bin/bash" ,
7771 },
78- Args : args ,
79- Image : instance .Spec .ContainerImage ,
80- SecurityContext : & corev1.SecurityContext {
81- RunAsUser : & runAsUser ,
82- },
83- Env : env .MergeEnvs ([]corev1.EnvVar {}, envVars ),
84- VolumeMounts : volumeMounts ,
72+ Args : args ,
73+ Image : instance .Spec .ContainerImage ,
74+ SecurityContext : dbSyncSecurityContext (),
75+ Env : env .MergeEnvs ([]corev1.EnvVar {}, envVars ),
76+ VolumeMounts : volumeMounts ,
8577 },
8678 },
8779 Volumes : volumes ,
0 commit comments