File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,12 +60,12 @@ func BootstrapJob(
6060 }
6161
6262 // create Volume and VolumeMounts
63- volumes := getVolumes (instance . Name )
63+ volumes := getVolumes (instance )
6464 volumeMounts := getVolumeMounts ()
6565
6666 // add CA cert if defined
6767 if instance .Spec .TLS .CaBundleSecretName != "" {
68- volumes = append (getVolumes (instance . Name ), instance .Spec .TLS .CreateVolume ())
68+ volumes = append (getVolumes (instance ), instance .Spec .TLS .CreateVolume ())
6969 volumeMounts = append (getVolumeMounts (), instance .Spec .TLS .CreateVolumeMounts (nil )... )
7070 }
7171
Original file line number Diff line number Diff line change @@ -46,12 +46,12 @@ func CronJob(
4646 completions := int32 (1 )
4747
4848 // create Volume and VolumeMounts
49- volumes := getVolumes (instance . Name )
49+ volumes := getVolumes (instance )
5050 volumeMounts := getVolumeMounts ()
5151
5252 // add CA cert if defined
5353 if instance .Spec .TLS .CaBundleSecretName != "" {
54- volumes = append (getVolumes (instance . Name ), instance .Spec .TLS .CreateVolume ())
54+ volumes = append (getVolumes (instance ), instance .Spec .TLS .CreateVolume ())
5555 volumeMounts = append (getVolumeMounts (), instance .Spec .TLS .CreateVolumeMounts (nil )... )
5656 }
5757
Original file line number Diff line number Diff line change @@ -45,12 +45,13 @@ func DbSyncJob(
4545 envVars ["KOLLA_BOOTSTRAP" ] = env .SetValue ("true" )
4646
4747 // create Volume and VolumeMounts
48- volumes := getVolumes (instance . Name )
48+ volumes := getVolumes (instance )
4949 volumeMounts := getVolumeMounts ()
5050
5151 // add CA cert if defined
5252 if instance .Spec .TLS .CaBundleSecretName != "" {
53- volumes = append (getVolumes (instance .Name ), instance .Spec .TLS .CreateVolume ())
53+ //TODO(afaranha): Why not reuse the 'volumes'?
54+ volumes = append (getVolumes (instance ), instance .Spec .TLS .CreateVolume ())
5455 volumeMounts = append (getVolumeMounts (), instance .Spec .TLS .CreateVolumeMounts (nil )... )
5556 }
5657
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ func Deployment(
8080 envVars ["CONFIG_HASH" ] = env .SetValue (configHash )
8181
8282 // create Volume and VolumeMounts
83- volumes := getVolumes (instance . Name )
83+ volumes := getVolumes (instance )
8484 volumeMounts := getVolumeMounts ()
8585
8686 // add CA cert if defined
Original file line number Diff line number Diff line change @@ -20,10 +20,16 @@ import (
2020)
2121
2222// getVolumes - service volumes
23- func getVolumes (name string ) []corev1.Volume {
23+ func getVolumes (instance * keystonev1.KeystoneAPI ) []corev1.Volume {
24+ name := instance .Name
2425 var scriptsVolumeDefaultMode int32 = 0755
2526 var config0640AccessMode int32 = 0640
2627
28+ fernetKeys := []corev1.KeyToPath {}
29+ for i := range instance .Spec .FernetKeys {
30+ fernetKeys = append (fernetKeys , fmt .Sprintf ("FernetKeys%d" , i ))
31+ }
32+
2733 return []corev1.Volume {
2834 {
2935 Name : "scripts" ,
@@ -48,16 +54,7 @@ func getVolumes(name string) []corev1.Volume {
4854 VolumeSource : corev1.VolumeSource {
4955 Secret : & corev1.SecretVolumeSource {
5056 SecretName : ServiceName ,
51- Items : []corev1.KeyToPath {
52- {
53- Key : "FernetKeys0" ,
54- Path : "0" ,
55- },
56- {
57- Key : "FernetKeys1" ,
58- Path : "1" ,
59- },
60- },
57+ Items : fernetKeys ,
6158 },
6259 },
6360 },
You can’t perform that action at this time.
0 commit comments