Allow annotations on volumeClaimTemplate of qdrant statefulset (#63)

Fixes https://github.com/qdrant/qdrant-helm/issues/45

Signed-off-by: Bastian Hofmann <mail@bastianhofmann.de>
This commit is contained in:
Bastian Hofmann
2023-08-29 11:47:13 +02:00
committed by GitHub
parent 1abd33831b
commit ff7e1adc19
3 changed files with 45 additions and 0 deletions

View File

@@ -149,6 +149,10 @@ spec:
name: qdrant-storage
labels:
app: {{ template "qdrant.name" . }}
{{- with .Values.persistence.annotations }}
annotations:
{{- toYaml . | nindent 10 }}
{{- end }}
spec:
storageClassName: {{ .Values.persistence.storageClassName }}
accessModes:

View File

@@ -94,6 +94,7 @@ affinity: {}
persistence:
accessModes: ["ReadWriteOnce"]
size: 10Gi
annotations: {}
# storageClassName: local-path
# only supported for single node qdrant clusters.

View File

@@ -0,0 +1,40 @@
package test
import (
"path/filepath"
"strings"
"testing"
"github.com/gruntwork-io/terratest/modules/helm"
"github.com/gruntwork-io/terratest/modules/k8s"
"github.com/gruntwork-io/terratest/modules/logger"
"github.com/gruntwork-io/terratest/modules/random"
"github.com/stretchr/testify/require"
appsv1 "k8s.io/api/apps/v1"
)
func TestPvcAnnotations(t *testing.T) {
t.Parallel()
helmChartPath, err := filepath.Abs("../charts/qdrant")
releaseName := "qdrant"
require.NoError(t, err)
namespaceName := "qdrant-" + strings.ToLower(random.UniqueId())
logger.Log(t, "Namespace: %s\n", namespaceName)
options := &helm.Options{
SetJsonValues: map[string]string{
"persistence.annotations": `{"test": "value"}`,
},
KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
}
output := helm.RenderTemplate(t, options, helmChartPath, releaseName, []string{"templates/statefulset.yaml"})
var statefulSet appsv1.StatefulSet
helm.UnmarshalK8SYaml(t, output, &statefulSet)
require.Contains(t, statefulSet.Spec.VolumeClaimTemplates[0].ObjectMeta.Annotations, "test")
require.Equal(t, statefulSet.Spec.VolumeClaimTemplates[0].ObjectMeta.Annotations["test"], "value")
}