Skip to content

Commit

Permalink
added environment variable CF_INSTANCE_PORTS
Browse files Browse the repository at this point in the history
  • Loading branch information
marsteg committed Apr 29, 2024
1 parent 46197a8 commit 6008735
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions controllers/controllers/workloads/env/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,11 @@ func (b *ProcessEnvBuilder) buildPortEnv(ctx context.Context, cfApp *korifiv1alp
processPorts := ports.FromRoutes(cfRoutesForProcess.Items, cfApp.Name, cfProcess.Spec.ProcessType)
if len(processPorts) > 0 {
portString := strconv.FormatInt(int64(processPorts[0]), 10)
cfInstancePorts := fmt.Sprintf("[{\"internal\":%s}]", portString)
return []corev1.EnvVar{
{Name: "VCAP_APP_PORT", Value: portString},
{Name: "PORT", Value: portString},
{Name: "CF_INSTANCE_PORTS", Value: cfInstancePorts},
}, nil
}

Expand Down
4 changes: 4 additions & 0 deletions controllers/controllers/workloads/env/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,10 @@ var _ = Describe("EnvBuilder", func() {
"Name": Equal("PORT"),
"Value": Equal("1234"),
}),
MatchFields(IgnoreExtras, Fields{
"Name": Equal("CF_INSTANCE_PORTS"),
"Value": ContainSubstring("\"internal\":1234"),
}),
))
})

Expand Down

0 comments on commit 6008735

Please sign in to comment.