Skip to content

Commit 6c95548

Browse files
easyCZroboquat
authored andcommitted
[spicedb] Fix env vars
1 parent 2128412 commit 6c95548

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

install/installer/pkg/components/spicedb/deployment.go

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
7474
},
7575
Env: common.CustomizeEnvvar(ctx, Component, common.MergeEnv(
7676
common.DefaultEnv(&ctx.Config),
77-
dbEnvVars(ctx),
7877
spicedbEnvVars(ctx),
7978
)),
8079
Ports: []corev1.ContainerPort{
@@ -139,15 +138,24 @@ func dbEnvVars(ctx *common.RenderContext) []corev1.EnvVar {
139138
containerEnvVars := common.DatabaseEnv(&ctx.Config)
140139

141140
if ctx.Config.Database.CloudSQLGlobal != nil {
142-
containerEnvVars = append(containerEnvVars, common.MergeEnv(
141+
var withoutDBHost []corev1.EnvVar
142+
143+
for _, v := range containerEnvVars {
144+
if v.Name == "DB_HOST" {
145+
continue
146+
}
147+
withoutDBHost = append(withoutDBHost, v)
148+
}
149+
150+
withoutDBHost = append(withoutDBHost,
143151
// Override the DB host to point to global cloudsql
144-
[]corev1.EnvVar{
145-
{
146-
Name: "DB_HOST",
147-
Value: cloudsql.ComponentGlobal,
148-
},
152+
corev1.EnvVar{
153+
Name: "DB_HOST",
154+
Value: cloudsql.ComponentGlobal,
149155
},
150-
)...)
156+
)
157+
158+
containerEnvVars = withoutDBHost
151159
}
152160

153161
return containerEnvVars

0 commit comments

Comments
 (0)