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

Commit

Permalink
Fix output of acorn apps to show image names properly for Nested an…
Browse files Browse the repository at this point in the history
…d Service Acorns (#1774) (#1851)

Signed-off-by: Grant Linville <grant@acorn.io>
  • Loading branch information
g-linville committed Jun 29, 2023
1 parent ff32506 commit 680eb7a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions pkg/cli/builder/table/funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

apiv1 "github.com/acorn-io/runtime/pkg/apis/api.acorn.io/v1"
adminv1 "github.com/acorn-io/runtime/pkg/apis/internal.admin.acorn.io/v1"
"github.com/acorn-io/runtime/pkg/labels"
"github.com/acorn-io/runtime/pkg/tags"
"github.com/rancher/wrangler/pkg/data/convert"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -40,6 +41,7 @@ var (
"memoryToRange": MemoryToRange,
"defaultMemory": DefaultMemory,
"ownerName": OwnerReferenceName,
"imageName": ImageName,
}
)

Expand Down Expand Up @@ -292,3 +294,15 @@ func OwnerReferenceName(obj metav1.Object) string {

return owners[0].Name
}

func ImageName(obj metav1.Object) string {
app, ok := obj.(*apiv1.App)
if !ok {
return ""
}

if original, exists := app.ObjectMeta.Annotations[labels.AcornOriginalImage]; exists {
return original
}
return app.Status.AppImage.Name
}
2 changes: 1 addition & 1 deletion pkg/tables/tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var (

App = [][]string{
{"Name", "{{ . | name }}"},
{"Image", "{{ trunc .Status.AppImage.Name }}"},
{"Image", "{{ . | imageName | trunc }}"},
{"Healthy", "Status.Columns.Healthy"},
{"Up-To-Date", "Status.Columns.UpToDate"},
{"Created", "{{ago .CreationTimestamp}}"},
Expand Down

0 comments on commit 680eb7a

Please sign in to comment.