|
|
|
|
@ -1,10 +1,9 @@ |
|
|
|
|
package manifests |
|
|
|
|
package storage_test |
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
"testing" |
|
|
|
|
|
|
|
|
|
lokiv1beta1 "github.com/grafana/loki/operator/api/v1beta1" |
|
|
|
|
"github.com/grafana/loki/operator/internal/manifests/internal/config" |
|
|
|
|
"github.com/grafana/loki/operator/internal/manifests/storage" |
|
|
|
|
"github.com/stretchr/testify/require" |
|
|
|
|
appsv1 "k8s.io/api/apps/v1" |
|
|
|
|
@ -13,18 +12,19 @@ import ( |
|
|
|
|
|
|
|
|
|
func TestConfigureDeploymentForStorageType(t *testing.T) { |
|
|
|
|
type tt struct { |
|
|
|
|
desc string |
|
|
|
|
storageType lokiv1beta1.ObjectStorageSecretType |
|
|
|
|
secretName string |
|
|
|
|
dpl *appsv1.Deployment |
|
|
|
|
want *appsv1.Deployment |
|
|
|
|
desc string |
|
|
|
|
opts storage.Options |
|
|
|
|
dpl *appsv1.Deployment |
|
|
|
|
want *appsv1.Deployment |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
tc := []tt{ |
|
|
|
|
{ |
|
|
|
|
desc: "object storage other than GCS", |
|
|
|
|
storageType: lokiv1beta1.ObjectStorageSecretS3, |
|
|
|
|
secretName: "test", |
|
|
|
|
desc: "object storage other than GCS", |
|
|
|
|
opts: storage.Options{ |
|
|
|
|
SecretName: "test", |
|
|
|
|
SharedStore: lokiv1beta1.ObjectStorageSecretS3, |
|
|
|
|
}, |
|
|
|
|
dpl: &appsv1.Deployment{ |
|
|
|
|
Spec: appsv1.DeploymentSpec{ |
|
|
|
|
Template: corev1.PodTemplateSpec{ |
|
|
|
|
@ -32,26 +32,6 @@ func TestConfigureDeploymentForStorageType(t *testing.T) { |
|
|
|
|
Containers: []corev1.Container{ |
|
|
|
|
{ |
|
|
|
|
Name: "loki-ingester", |
|
|
|
|
VolumeMounts: []corev1.VolumeMount{ |
|
|
|
|
{ |
|
|
|
|
Name: configVolumeName, |
|
|
|
|
ReadOnly: false, |
|
|
|
|
MountPath: config.LokiConfigMountDir, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Volumes: []corev1.Volume{ |
|
|
|
|
{ |
|
|
|
|
Name: configVolumeName, |
|
|
|
|
VolumeSource: corev1.VolumeSource{ |
|
|
|
|
ConfigMap: &corev1.ConfigMapVolumeSource{ |
|
|
|
|
DefaultMode: &defaultConfigMapMode, |
|
|
|
|
LocalObjectReference: corev1.LocalObjectReference{ |
|
|
|
|
Name: lokiConfigMapName("stack-name"), |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
@ -65,26 +45,6 @@ func TestConfigureDeploymentForStorageType(t *testing.T) { |
|
|
|
|
Containers: []corev1.Container{ |
|
|
|
|
{ |
|
|
|
|
Name: "loki-ingester", |
|
|
|
|
VolumeMounts: []corev1.VolumeMount{ |
|
|
|
|
{ |
|
|
|
|
Name: configVolumeName, |
|
|
|
|
ReadOnly: false, |
|
|
|
|
MountPath: config.LokiConfigMountDir, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Volumes: []corev1.Volume{ |
|
|
|
|
{ |
|
|
|
|
Name: configVolumeName, |
|
|
|
|
VolumeSource: corev1.VolumeSource{ |
|
|
|
|
ConfigMap: &corev1.ConfigMapVolumeSource{ |
|
|
|
|
DefaultMode: &defaultConfigMapMode, |
|
|
|
|
LocalObjectReference: corev1.LocalObjectReference{ |
|
|
|
|
Name: lokiConfigMapName("stack-name"), |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
@ -93,9 +53,11 @@ func TestConfigureDeploymentForStorageType(t *testing.T) { |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
desc: "object storage GCS", |
|
|
|
|
storageType: lokiv1beta1.ObjectStorageSecretGCS, |
|
|
|
|
secretName: "test", |
|
|
|
|
desc: "object storage GCS", |
|
|
|
|
opts: storage.Options{ |
|
|
|
|
SecretName: "test", |
|
|
|
|
SharedStore: lokiv1beta1.ObjectStorageSecretGCS, |
|
|
|
|
}, |
|
|
|
|
dpl: &appsv1.Deployment{ |
|
|
|
|
Spec: appsv1.DeploymentSpec{ |
|
|
|
|
Template: corev1.PodTemplateSpec{ |
|
|
|
|
@ -103,26 +65,6 @@ func TestConfigureDeploymentForStorageType(t *testing.T) { |
|
|
|
|
Containers: []corev1.Container{ |
|
|
|
|
{ |
|
|
|
|
Name: "loki-ingester", |
|
|
|
|
VolumeMounts: []corev1.VolumeMount{ |
|
|
|
|
{ |
|
|
|
|
Name: configVolumeName, |
|
|
|
|
ReadOnly: false, |
|
|
|
|
MountPath: config.LokiConfigMountDir, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Volumes: []corev1.Volume{ |
|
|
|
|
{ |
|
|
|
|
Name: configVolumeName, |
|
|
|
|
VolumeSource: corev1.VolumeSource{ |
|
|
|
|
ConfigMap: &corev1.ConfigMapVolumeSource{ |
|
|
|
|
DefaultMode: &defaultConfigMapMode, |
|
|
|
|
LocalObjectReference: corev1.LocalObjectReference{ |
|
|
|
|
Name: lokiConfigMapName("stack-name"), |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
@ -137,11 +79,7 @@ func TestConfigureDeploymentForStorageType(t *testing.T) { |
|
|
|
|
{ |
|
|
|
|
Name: "loki-ingester", |
|
|
|
|
VolumeMounts: []corev1.VolumeMount{ |
|
|
|
|
{ |
|
|
|
|
Name: configVolumeName, |
|
|
|
|
ReadOnly: false, |
|
|
|
|
MountPath: config.LokiConfigMountDir, |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
Name: "test", |
|
|
|
|
ReadOnly: false, |
|
|
|
|
@ -157,17 +95,6 @@ func TestConfigureDeploymentForStorageType(t *testing.T) { |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Volumes: []corev1.Volume{ |
|
|
|
|
{ |
|
|
|
|
Name: configVolumeName, |
|
|
|
|
VolumeSource: corev1.VolumeSource{ |
|
|
|
|
ConfigMap: &corev1.ConfigMapVolumeSource{ |
|
|
|
|
DefaultMode: &defaultConfigMapMode, |
|
|
|
|
LocalObjectReference: corev1.LocalObjectReference{ |
|
|
|
|
Name: lokiConfigMapName("stack-name"), |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Name: "test", |
|
|
|
|
VolumeSource: corev1.VolumeSource{ |
|
|
|
|
@ -188,7 +115,7 @@ func TestConfigureDeploymentForStorageType(t *testing.T) { |
|
|
|
|
tc := tc |
|
|
|
|
t.Run(tc.desc, func(t *testing.T) { |
|
|
|
|
t.Parallel() |
|
|
|
|
err := configureDeploymentForStorageType(tc.dpl, tc.storageType, tc.secretName) |
|
|
|
|
err := storage.ConfigureDeployment(tc.dpl, tc.opts) |
|
|
|
|
require.NoError(t, err) |
|
|
|
|
require.Equal(t, tc.want, tc.dpl) |
|
|
|
|
}) |
|
|
|
|
@ -197,18 +124,19 @@ func TestConfigureDeploymentForStorageType(t *testing.T) { |
|
|
|
|
|
|
|
|
|
func TestConfigureStatefulSetForStorageType(t *testing.T) { |
|
|
|
|
type tt struct { |
|
|
|
|
desc string |
|
|
|
|
storageType lokiv1beta1.ObjectStorageSecretType |
|
|
|
|
secretName string |
|
|
|
|
sts *appsv1.StatefulSet |
|
|
|
|
want *appsv1.StatefulSet |
|
|
|
|
desc string |
|
|
|
|
opts storage.Options |
|
|
|
|
sts *appsv1.StatefulSet |
|
|
|
|
want *appsv1.StatefulSet |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
tc := []tt{ |
|
|
|
|
{ |
|
|
|
|
desc: "object storage other than GCS", |
|
|
|
|
storageType: lokiv1beta1.ObjectStorageSecretS3, |
|
|
|
|
secretName: "test", |
|
|
|
|
desc: "object storage other than GCS", |
|
|
|
|
opts: storage.Options{ |
|
|
|
|
SecretName: "test", |
|
|
|
|
SharedStore: lokiv1beta1.ObjectStorageSecretS3, |
|
|
|
|
}, |
|
|
|
|
sts: &appsv1.StatefulSet{ |
|
|
|
|
Spec: appsv1.StatefulSetSpec{ |
|
|
|
|
Template: corev1.PodTemplateSpec{ |
|
|
|
|
@ -216,26 +144,39 @@ func TestConfigureStatefulSetForStorageType(t *testing.T) { |
|
|
|
|
Containers: []corev1.Container{ |
|
|
|
|
{ |
|
|
|
|
Name: "loki-ingester", |
|
|
|
|
VolumeMounts: []corev1.VolumeMount{ |
|
|
|
|
{ |
|
|
|
|
Name: configVolumeName, |
|
|
|
|
ReadOnly: false, |
|
|
|
|
MountPath: config.LokiConfigMountDir, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Volumes: []corev1.Volume{ |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
want: &appsv1.StatefulSet{ |
|
|
|
|
Spec: appsv1.StatefulSetSpec{ |
|
|
|
|
Template: corev1.PodTemplateSpec{ |
|
|
|
|
Spec: corev1.PodSpec{ |
|
|
|
|
Containers: []corev1.Container{ |
|
|
|
|
{ |
|
|
|
|
Name: configVolumeName, |
|
|
|
|
VolumeSource: corev1.VolumeSource{ |
|
|
|
|
ConfigMap: &corev1.ConfigMapVolumeSource{ |
|
|
|
|
DefaultMode: &defaultConfigMapMode, |
|
|
|
|
LocalObjectReference: corev1.LocalObjectReference{ |
|
|
|
|
Name: lokiConfigMapName("stack-name"), |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Name: "loki-ingester", |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
desc: "object storage GCS", |
|
|
|
|
opts: storage.Options{ |
|
|
|
|
SecretName: "test", |
|
|
|
|
SharedStore: lokiv1beta1.ObjectStorageSecretGCS, |
|
|
|
|
}, |
|
|
|
|
sts: &appsv1.StatefulSet{ |
|
|
|
|
Spec: appsv1.StatefulSetSpec{ |
|
|
|
|
Template: corev1.PodTemplateSpec{ |
|
|
|
|
Spec: corev1.PodSpec{ |
|
|
|
|
Containers: []corev1.Container{ |
|
|
|
|
{ |
|
|
|
|
Name: "loki-ingester", |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
@ -251,22 +192,25 @@ func TestConfigureStatefulSetForStorageType(t *testing.T) { |
|
|
|
|
Name: "loki-ingester", |
|
|
|
|
VolumeMounts: []corev1.VolumeMount{ |
|
|
|
|
{ |
|
|
|
|
Name: configVolumeName, |
|
|
|
|
Name: "test", |
|
|
|
|
ReadOnly: false, |
|
|
|
|
MountPath: config.LokiConfigMountDir, |
|
|
|
|
MountPath: "/etc/storage/secrets", |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Env: []corev1.EnvVar{ |
|
|
|
|
{ |
|
|
|
|
Name: storage.EnvGoogleApplicationCredentials, |
|
|
|
|
Value: "/etc/storage/secrets/key.json", |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Volumes: []corev1.Volume{ |
|
|
|
|
{ |
|
|
|
|
Name: configVolumeName, |
|
|
|
|
Name: "test", |
|
|
|
|
VolumeSource: corev1.VolumeSource{ |
|
|
|
|
ConfigMap: &corev1.ConfigMapVolumeSource{ |
|
|
|
|
DefaultMode: &defaultConfigMapMode, |
|
|
|
|
LocalObjectReference: corev1.LocalObjectReference{ |
|
|
|
|
Name: lokiConfigMapName("stack-name"), |
|
|
|
|
}, |
|
|
|
|
Secret: &corev1.SecretVolumeSource{ |
|
|
|
|
SecretName: "test", |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
@ -276,34 +220,109 @@ func TestConfigureStatefulSetForStorageType(t *testing.T) { |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for _, tc := range tc { |
|
|
|
|
tc := tc |
|
|
|
|
t.Run(tc.desc, func(t *testing.T) { |
|
|
|
|
t.Parallel() |
|
|
|
|
err := storage.ConfigureStatefulSet(tc.sts, tc.opts) |
|
|
|
|
require.NoError(t, err) |
|
|
|
|
require.Equal(t, tc.want, tc.sts) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func TestConfigureDeploymentForStorageCA(t *testing.T) { |
|
|
|
|
type tt struct { |
|
|
|
|
desc string |
|
|
|
|
opts storage.Options |
|
|
|
|
dpl *appsv1.Deployment |
|
|
|
|
want *appsv1.Deployment |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
tc := []tt{ |
|
|
|
|
{ |
|
|
|
|
desc: "object storage GCS", |
|
|
|
|
storageType: lokiv1beta1.ObjectStorageSecretGCS, |
|
|
|
|
secretName: "test", |
|
|
|
|
sts: &appsv1.StatefulSet{ |
|
|
|
|
Spec: appsv1.StatefulSetSpec{ |
|
|
|
|
desc: "object storage other than S3", |
|
|
|
|
opts: storage.Options{ |
|
|
|
|
SecretName: "test", |
|
|
|
|
SharedStore: lokiv1beta1.ObjectStorageSecretAzure, |
|
|
|
|
}, |
|
|
|
|
dpl: &appsv1.Deployment{ |
|
|
|
|
Spec: appsv1.DeploymentSpec{ |
|
|
|
|
Template: corev1.PodTemplateSpec{ |
|
|
|
|
Spec: corev1.PodSpec{ |
|
|
|
|
Containers: []corev1.Container{ |
|
|
|
|
{ |
|
|
|
|
Name: "loki-ingester", |
|
|
|
|
Name: "loki-querier", |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
want: &appsv1.Deployment{ |
|
|
|
|
Spec: appsv1.DeploymentSpec{ |
|
|
|
|
Template: corev1.PodTemplateSpec{ |
|
|
|
|
Spec: corev1.PodSpec{ |
|
|
|
|
Containers: []corev1.Container{ |
|
|
|
|
{ |
|
|
|
|
Name: "loki-querier", |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
desc: "object storage S3", |
|
|
|
|
opts: storage.Options{ |
|
|
|
|
SecretName: "test", |
|
|
|
|
SharedStore: lokiv1beta1.ObjectStorageSecretS3, |
|
|
|
|
TLS: &storage.TLSConfig{ |
|
|
|
|
CA: "test", |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
dpl: &appsv1.Deployment{ |
|
|
|
|
Spec: appsv1.DeploymentSpec{ |
|
|
|
|
Template: corev1.PodTemplateSpec{ |
|
|
|
|
Spec: corev1.PodSpec{ |
|
|
|
|
Containers: []corev1.Container{ |
|
|
|
|
{ |
|
|
|
|
Name: "loki-querier", |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
want: &appsv1.Deployment{ |
|
|
|
|
Spec: appsv1.DeploymentSpec{ |
|
|
|
|
Template: corev1.PodTemplateSpec{ |
|
|
|
|
Spec: corev1.PodSpec{ |
|
|
|
|
Containers: []corev1.Container{ |
|
|
|
|
{ |
|
|
|
|
Name: "loki-querier", |
|
|
|
|
VolumeMounts: []corev1.VolumeMount{ |
|
|
|
|
{ |
|
|
|
|
Name: configVolumeName, |
|
|
|
|
Name: "test", |
|
|
|
|
ReadOnly: false, |
|
|
|
|
MountPath: config.LokiConfigMountDir, |
|
|
|
|
MountPath: "/etc/storage/ca", |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Args: []string{ |
|
|
|
|
"-s3.http.ca-file=/etc/storage/ca/service-ca.crt", |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Volumes: []corev1.Volume{ |
|
|
|
|
{ |
|
|
|
|
Name: configVolumeName, |
|
|
|
|
Name: "test", |
|
|
|
|
VolumeSource: corev1.VolumeSource{ |
|
|
|
|
ConfigMap: &corev1.ConfigMapVolumeSource{ |
|
|
|
|
DefaultMode: &defaultConfigMapMode, |
|
|
|
|
LocalObjectReference: corev1.LocalObjectReference{ |
|
|
|
|
Name: lokiConfigMapName("stack-name"), |
|
|
|
|
Name: "test", |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
@ -313,6 +332,87 @@ func TestConfigureStatefulSetForStorageType(t *testing.T) { |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for _, tc := range tc { |
|
|
|
|
tc := tc |
|
|
|
|
t.Run(tc.desc, func(t *testing.T) { |
|
|
|
|
t.Parallel() |
|
|
|
|
err := storage.ConfigureDeployment(tc.dpl, tc.opts) |
|
|
|
|
require.NoError(t, err) |
|
|
|
|
require.Equal(t, tc.want, tc.dpl) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func TestConfigureStatefulSetForStorageCA(t *testing.T) { |
|
|
|
|
type tt struct { |
|
|
|
|
desc string |
|
|
|
|
opts storage.Options |
|
|
|
|
sts *appsv1.StatefulSet |
|
|
|
|
want *appsv1.StatefulSet |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
tc := []tt{ |
|
|
|
|
{ |
|
|
|
|
desc: "object storage other than S3", |
|
|
|
|
opts: storage.Options{ |
|
|
|
|
SecretName: "test", |
|
|
|
|
SharedStore: lokiv1beta1.ObjectStorageSecretAzure, |
|
|
|
|
TLS: &storage.TLSConfig{ |
|
|
|
|
CA: "test", |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
sts: &appsv1.StatefulSet{ |
|
|
|
|
Spec: appsv1.StatefulSetSpec{ |
|
|
|
|
Template: corev1.PodTemplateSpec{ |
|
|
|
|
Spec: corev1.PodSpec{ |
|
|
|
|
Containers: []corev1.Container{ |
|
|
|
|
{ |
|
|
|
|
Name: "loki-ingester", |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
want: &appsv1.StatefulSet{ |
|
|
|
|
Spec: appsv1.StatefulSetSpec{ |
|
|
|
|
Template: corev1.PodTemplateSpec{ |
|
|
|
|
Spec: corev1.PodSpec{ |
|
|
|
|
Containers: []corev1.Container{ |
|
|
|
|
{ |
|
|
|
|
Name: "loki-ingester", |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
desc: "object storage S3", |
|
|
|
|
opts: storage.Options{ |
|
|
|
|
SecretName: "test", |
|
|
|
|
SharedStore: lokiv1beta1.ObjectStorageSecretS3, |
|
|
|
|
TLS: &storage.TLSConfig{ |
|
|
|
|
CA: "test", |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
sts: &appsv1.StatefulSet{ |
|
|
|
|
Spec: appsv1.StatefulSetSpec{ |
|
|
|
|
Template: corev1.PodTemplateSpec{ |
|
|
|
|
Spec: corev1.PodSpec{ |
|
|
|
|
Containers: []corev1.Container{ |
|
|
|
|
{ |
|
|
|
|
Name: "loki-ingester", |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
want: &appsv1.StatefulSet{ |
|
|
|
|
Spec: appsv1.StatefulSetSpec{ |
|
|
|
|
Template: corev1.PodTemplateSpec{ |
|
|
|
|
@ -321,45 +421,28 @@ func TestConfigureStatefulSetForStorageType(t *testing.T) { |
|
|
|
|
{ |
|
|
|
|
Name: "loki-ingester", |
|
|
|
|
VolumeMounts: []corev1.VolumeMount{ |
|
|
|
|
{ |
|
|
|
|
Name: configVolumeName, |
|
|
|
|
ReadOnly: false, |
|
|
|
|
MountPath: config.LokiConfigMountDir, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Name: "test", |
|
|
|
|
ReadOnly: false, |
|
|
|
|
MountPath: "/etc/storage/secrets", |
|
|
|
|
MountPath: "/etc/storage/ca", |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Env: []corev1.EnvVar{ |
|
|
|
|
{ |
|
|
|
|
Name: storage.EnvGoogleApplicationCredentials, |
|
|
|
|
Value: "/etc/storage/secrets/key.json", |
|
|
|
|
}, |
|
|
|
|
Args: []string{ |
|
|
|
|
"-s3.http.ca-file=/etc/storage/ca/service-ca.crt", |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Volumes: []corev1.Volume{ |
|
|
|
|
{ |
|
|
|
|
Name: configVolumeName, |
|
|
|
|
Name: "test", |
|
|
|
|
VolumeSource: corev1.VolumeSource{ |
|
|
|
|
ConfigMap: &corev1.ConfigMapVolumeSource{ |
|
|
|
|
DefaultMode: &defaultConfigMapMode, |
|
|
|
|
LocalObjectReference: corev1.LocalObjectReference{ |
|
|
|
|
Name: lokiConfigMapName("stack-name"), |
|
|
|
|
Name: "test", |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Name: "test", |
|
|
|
|
VolumeSource: corev1.VolumeSource{ |
|
|
|
|
Secret: &corev1.SecretVolumeSource{ |
|
|
|
|
SecretName: "test", |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
@ -372,7 +455,7 @@ func TestConfigureStatefulSetForStorageType(t *testing.T) { |
|
|
|
|
tc := tc |
|
|
|
|
t.Run(tc.desc, func(t *testing.T) { |
|
|
|
|
t.Parallel() |
|
|
|
|
err := configureStatefulSetForStorageType(tc.sts, tc.storageType, tc.secretName) |
|
|
|
|
err := storage.ConfigureStatefulSet(tc.sts, tc.opts) |
|
|
|
|
require.NoError(t, err) |
|
|
|
|
require.Equal(t, tc.want, tc.sts) |
|
|
|
|
}) |