From ca7b1fdf7c7104bfd184f346aeb13c98f3631ffd Mon Sep 17 00:00:00 2001 From: skrbug Date: Sat, 11 Jun 2022 20:24:54 +0800 Subject: [PATCH] feat: lotus config file mount by volumeSubpath --- controllers/filecoin/node_controller.go | 35 +++++-------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/controllers/filecoin/node_controller.go b/controllers/filecoin/node_controller.go index 38fd357a..d67ea151 100644 --- a/controllers/filecoin/node_controller.go +++ b/controllers/filecoin/node_controller.go @@ -3,7 +3,7 @@ package controllers import ( "context" _ "embed" - "fmt" + "path/filepath" filecoinv1alpha1 "github.com/kotalco/kotal/apis/filecoin/v1alpha1" filecoinClients "github.com/kotalco/kotal/clients/filecoin" @@ -264,34 +264,6 @@ func (r *NodeReconciler) specStatefulSet(node *filecoinv1alpha1.Node, sts *appsv }, Spec: corev1.PodSpec{ SecurityContext: shared.SecurityContext(), - InitContainers: []corev1.Container{ - { - Name: "copy-config-toml", - Image: shared.BusyboxImage, - Env: []corev1.EnvVar{ - { - Name: EnvDataPath, - Value: shared.PathData(homeDir), - }, - { - Name: EnvConfigPath, - Value: shared.PathConfig(homeDir), - }, - }, - Command: []string{"/bin/sh"}, - Args: []string{fmt.Sprintf("%s/copy_config_toml.sh", shared.PathConfig(homeDir))}, - VolumeMounts: []corev1.VolumeMount{ - { - Name: "data", - MountPath: shared.PathData(homeDir), - }, - { - Name: "config", - MountPath: shared.PathConfig(homeDir), - }, - }, - }, - }, Containers: []corev1.Container{ { Name: "node", @@ -303,6 +275,11 @@ func (r *NodeReconciler) specStatefulSet(node *filecoinv1alpha1.Node, sts *appsv Name: "data", MountPath: shared.PathData(homeDir), }, + { + Name: "config", + MountPath: filepath.Join(shared.PathData(homeDir), "config.toml"), + SubPath: "config.toml", + }, }, Resources: corev1.ResourceRequirements{ Requests: corev1.ResourceList{