Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Don't return multiple default services
Browse files Browse the repository at this point in the history
In the app status we were determining the default state from the resolved
service which might be the nested service, which could cause more than
one to be treated as the default.

Signed-off-by: Darren Shepherd <darren@acorn.io>
  • Loading branch information
ibuildthecloud committed Jul 4, 2023
1 parent 6aae4d0 commit 2de1a4b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/controller/appstatus/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@ func (a *appStatusRenderer) readServices() error {
default:
}

// The ref.Lookup call above will find what the service resolves to, but not the actually local service object.
// Here we lookup the local object so we can determine if it's the default or not
localService := &v1.ServiceInstance{}
if err := a.c.Get(a.ctx, router.Key(a.app.Status.Namespace, serviceName), localService); err == nil {
s.Default = localService.Spec.Default
} else if !apierrors.IsNotFound(err) {
return err
}

addExpressionErrors(&s.CommonStatus, s.ExpressionErrors)

a.app.Status.AppStatus.Services[serviceName] = s
Expand Down

0 comments on commit 2de1a4b

Please sign in to comment.