Skip to content

Commit

Permalink
fix(vector): fix the issue that data volume name of vector is not cor…
Browse files Browse the repository at this point in the history
…rect (#289)
  • Loading branch information
lwpk110 authored Dec 18, 2024
1 parent 0e1e10d commit 7f74bf2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions pkg/builder/vector.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ import (
)

const (
VectorContainerName = "vector"

VectorContainerName = "vector"
VectorConfigVolumeName = "vector-config"
vectorDataVolumeName = "vector-data"
LogDataVolumeName = "log"
Expand Down Expand Up @@ -148,7 +147,7 @@ func (v *Vector) GetVolumes() []corev1.Volume {

objs := []corev1.Volume{
{
Name: vectorDataDir,
Name: vectorDataVolumeName,
VolumeSource: corev1.VolumeSource{
EmptyDir: &corev1.EmptyDirVolumeSource{SizeLimit: v.vectorDataSize},
},
Expand All @@ -158,13 +157,14 @@ func (v *Vector) GetVolumes() []corev1.Volume {
}

func (v *Vector) getVolumeMounts() []corev1.VolumeMount {

objs := []corev1.VolumeMount{
{
Name: v.LogDataVolumeName,
MountPath: constants.KubedoopLogDir,
},
{
Name: VectorConfigVolumeName,
Name: v.VectorConfigVolumeName,
MountPath: constants.KubedoopConfigDir,
},
{
Expand Down
9 changes: 5 additions & 4 deletions pkg/builder/vector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ func TestVector_GetVolumes(t *testing.T) {
volumes := vector.GetVolumes()

assert.Len(t, volumes, 1)
assert.Equal(t, vectorDataDir, volumes[0].Name)
assert.Equal(t, "vector-data", volumes[0].Name)
assert.NotNil(t, volumes[0].EmptyDir)
assert.Equal(t, customSize, volumes[0].EmptyDir.SizeLimit)

}

func TestVector_getVolumeMounts(t *testing.T) {
Expand All @@ -87,9 +88,9 @@ func TestVector_getVolumeMounts(t *testing.T) {

assert.Len(t, mounts, 3)
expectedMounts := map[string]string{
vector.LogDataVolumeName: constants.KubedoopLogDir,
VectorConfigVolumeName: constants.KubedoopConfigDir,
vectorDataVolumeName: vectorDataDir,
"log-volume": constants.KubedoopLogDir,
"config-volume": constants.KubedoopConfigDir,
"vector-data": vectorDataDir,
}

for _, mount := range mounts {
Expand Down

0 comments on commit 7f74bf2

Please sign in to comment.