-
Notifications
You must be signed in to change notification settings - Fork 31
/
volumes.go
52 lines (45 loc) · 1.71 KB
/
volumes.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package cindervolume
import (
"github.com/openstack-k8s-operators/lib-common/modules/storage"
"strings"
cinderv1beta1 "github.com/openstack-k8s-operators/cinder-operator/api/v1beta1"
"github.com/openstack-k8s-operators/cinder-operator/pkg/cinder"
corev1 "k8s.io/api/core/v1"
)
// GetVolumes -
func GetVolumes(parentName string, name string, extraVol []cinderv1beta1.CinderExtraVolMounts) []corev1.Volume {
var config0644AccessMode int32 = 0644
volumes := []corev1.Volume{
{
Name: "config-data-custom",
VolumeSource: corev1.VolumeSource{
Secret: &corev1.SecretVolumeSource{
DefaultMode: &config0644AccessMode,
SecretName: name + "-config-data",
},
},
},
}
// Set the propagation levels for CinderVolume, including the backend name
propagation := append(cinder.CinderVolumePropagation, storage.PropagationType(strings.TrimPrefix(name, "cinder-volume-")))
return append(cinder.GetVolumes(parentName, true, extraVol, propagation), volumes...)
}
// GetVolumeMounts - Cinder Volume VolumeMounts
func GetVolumeMounts(name string, extraVol []cinderv1beta1.CinderExtraVolMounts) []corev1.VolumeMount {
volumeVolumeMounts := []corev1.VolumeMount{
{
Name: "config-data-custom",
MountPath: "/etc/cinder/cinder.conf.d",
ReadOnly: true,
},
{
Name: "config-data",
MountPath: "/var/lib/kolla/config_files/config.json",
SubPath: "cinder-volume-config.json",
ReadOnly: true,
},
}
// Set the propagation levels for CinderVolume, including the backend name
propagation := append(cinder.CinderVolumePropagation, storage.PropagationType(strings.TrimPrefix(name, "cinder-volume-")))
return append(cinder.GetVolumeMounts(true, extraVol, propagation), volumeVolumeMounts...)
}