Skip to content

Commit

Permalink
fix: merge cluster.spec.env (labring#4100)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengxsong committed Oct 17, 2023
1 parent e62bf53 commit 3d1cd30
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/apply/processor/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@ func (c *CreateProcessor) preProcess(cluster *v2.Cluster) error {
if err := MountClusterImages(c.Buildah, cluster, false); err != nil {
return err
}
// env in cluster.spec will be merged into every mounts object
env := maps.FromSlice(cluster.Spec.Env)
// extra env must been set at the very first
for i := range cluster.Status.Mounts {
cluster.Status.Mounts[i].Env = maps.Merge(cluster.Status.Mounts[i].Env, c.ExtraEnvs)
cluster.Status.Mounts[i].Env = maps.Merge(cluster.Status.Mounts[i].Env, env, c.ExtraEnvs)
}

rt, err := factory.New(cluster, c.ClusterFile.GetRuntimeConfig())
Expand Down

0 comments on commit 3d1cd30

Please sign in to comment.