Skip to content

Commit

Permalink
Override ECK mount path such that our plugin continues to work
Browse files Browse the repository at this point in the history
  • Loading branch information
rene-dekker committed Jan 10, 2025
1 parent ecdc1ce commit 478d254
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
10 changes: 9 additions & 1 deletion pkg/render/logstorage/kibana/kibana.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,15 @@ func (k *kibana) kibanaCR() *kbv1.Kibana {
var initContainers []corev1.Container
var volumes []corev1.Volume
var automountToken bool
var volumeMounts []corev1.VolumeMount
volumeMounts := []corev1.VolumeMount{
{
// We need to override this mount and change the mountPath. Otherwise, ECK will mount an emptyDir in the
// original location (/usr/share/kibana/plugins), which would remove our custom theme resulting in
// crash-looping pods, because our custom config is unexpected.
Name: "kibana-plugins",
MountPath: "/mnt/dummy-location/",
},
}
if k.cfg.Installation.CertificateManagement != nil {
config["elasticsearch.ssl.certificateAuthorities"] = []string{"/mnt/elastic-internal/http-certs/ca.crt"}
automountToken = true
Expand Down
7 changes: 6 additions & 1 deletion pkg/render/logstorage/kibana/kibana_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
kbv1 "github.com/elastic/cloud-on-k8s/v2/pkg/apis/kibana/v1"

v3 "github.com/tigera/api/pkg/apis/projectcalico/v3"

operatorv1 "github.com/tigera/operator/api/v1"
"github.com/tigera/operator/pkg/apis"
"github.com/tigera/operator/pkg/common"
Expand Down Expand Up @@ -132,11 +133,15 @@ var _ = Describe("Kibana rendering tests", func() {
Drop: []corev1.Capability{"ALL"},
},
))
Expect(kibanaCR.Spec.PodTemplate.Spec.Containers[0].VolumeMounts).To(ContainElement(corev1.VolumeMount{
Name: "kibana-plugins",
MountPath: "/mnt/dummy-location/",
}))

Expect(kibanaCR.Spec.PodTemplate.Spec.Containers[0].SecurityContext.SeccompProfile).To(Equal(
&corev1.SeccompProfile{
Type: corev1.SeccompProfileTypeRuntimeDefault,
}))

resultKB := rtest.GetResource(createResources, kibana.CRName, kibana.Namespace,
"kibana.k8s.elastic.co", "v1", "Kibana").(*kbv1.Kibana)
Expect(resultKB.Spec.Config.Data["xpack.security.session.lifespan"]).To(Equal("8h"))
Expand Down

0 comments on commit 478d254

Please sign in to comment.