From c2c89d8f241fcdcd3b05454126b02daeac387694 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期四, 11 一月 2024 14:13:29 +0800 Subject: [PATCH] env完善 --- src/k8s/create.go | 47 +++++++++++++++++++---------------------------- 1 files changed, 19 insertions(+), 28 deletions(-) diff --git a/src/k8s/create.go b/src/k8s/create.go index 6388990..488c600 100644 --- a/src/k8s/create.go +++ b/src/k8s/create.go @@ -327,12 +327,13 @@ }, { Name: "DB_HOST", - ValueFrom: &apiv1.EnvVarSource{ - FieldRef: &apiv1.ObjectFieldSelector{ - APIVersion: "v1", - FieldPath: "status.hostIP", - }, - }, + //ValueFrom: &apiv1.EnvVarSource{ + // FieldRef: &apiv1.ObjectFieldSelector{ + // APIVersion: "v1", + // FieldPath: "status.hostIP", + // }, + //}, + Value: config.DBHost, }, { Name: "HOST", @@ -342,6 +343,18 @@ FieldPath: "status.hostIP", }, }, + }, + { + Name: "AL_HOST", + Value: config.ALHost, + }, + { + Name: "GRPC_NODE_PORT", + Value: strconv.Itoa(int(config.RpcPort)), + }, + { + Name: "NODE_ID", + Value: config.NodeID, }, { Name: "DB_NAME", @@ -361,28 +374,6 @@ }, } - if config.ALHost != "" { - envs = append(envs, apiv1.EnvVar{ - Name: "AL_HOST", - Value: config.ALHost, - }) - } - - if config.NodeID != "" { - envs = append(envs, apiv1.EnvVar{ - Name: "NODE_ID", - Value: config.NodeID, - }) - } - - if len(pairs) > 0 { - for name, value := range pairs { - envs = append(envs, apiv1.EnvVar{ - Name: name, - Value: value, - }) - } - } for name, value := range pairs { envs = append(envs, apiv1.EnvVar{ Name: name, -- Gitblit v1.8.0