Skip to content

Commit 041bdb2

Browse files
author
Peng Zhou
committed
MLE-25101: Fix AdditionalVolumeMount does not mount to Fluent-bit Correctly
1 parent b3ba5f6 commit 041bdb2

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

pkg/k8sutil/statefulset.go

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ func generateContainerDef(name string, containerParams containerParameters) []co
350350
Command: []string{"/fluent-bit/bin/fluent-bit"},
351351
Args: []string{"--config=/fluent-bit/etc/fluent-bit.yaml"},
352352
Env: getFluentBitEnvironmentVariables(),
353-
VolumeMounts: getFluentBitVolumeMount(),
353+
VolumeMounts: getFluentBitVolumeMount(containerParams),
354354
}
355355
if containerParams.LogCollection.Resources != nil {
356356
fulentBitContainerDef.Resources = *containerParams.LogCollection.Resources
@@ -704,14 +704,25 @@ func getVolumeMount(containerParams containerParameters) []corev1.VolumeMount {
704704
return VolumeMounts
705705
}
706706

707-
func getFluentBitVolumeMount() []corev1.VolumeMount {
707+
func getFluentBitVolumeMount(containerParams containerParameters) []corev1.VolumeMount {
708708
var VolumeMountsFluentBit []corev1.VolumeMount
709+
markLogicLogsPath := "/var/opt/MarkLogic/Logs"
710+
logsMount := corev1.VolumeMount{
711+
Name: "datadir",
712+
MountPath: markLogicLogsPath,
713+
}
714+
715+
if containerParams.AdditionalVolumeMounts != nil {
716+
for _, mount := range *containerParams.AdditionalVolumeMounts {
717+
if mount.MountPath == markLogicLogsPath {
718+
logsMount = mount
719+
break
720+
}
721+
}
722+
}
709723

710724
VolumeMountsFluentBit = append(VolumeMountsFluentBit,
711-
corev1.VolumeMount{
712-
Name: "datadir",
713-
MountPath: "/var/opt/MarkLogic/Logs",
714-
},
725+
logsMount,
715726
corev1.VolumeMount{
716727
Name: "fluent-bit",
717728
MountPath: "/fluent-bit/etc/",

0 commit comments

Comments
 (0)