diff --git a/pkg/resources/helm/formatter.go b/pkg/resources/formatters/formatter.go similarity index 54% rename from pkg/resources/helm/formatter.go rename to pkg/resources/formatters/formatter.go index 91b1c64..212b4fc 100644 --- a/pkg/resources/helm/formatter.go +++ b/pkg/resources/formatters/formatter.go @@ -1,7 +1,8 @@ -package helm +package formatters import ( "github.com/rancher/apiserver/pkg/types" + "github.com/rancher/norman/types/convert" ) func DropHelmData(request *types.APIRequest, resource *types.RawResource) { @@ -13,3 +14,11 @@ func DropHelmData(request *types.APIRequest, resource *types.RawResource) { } } } + +func Pod(request *types.APIRequest, resource *types.RawResource) { + data := resource.APIObject.Data() + fields := data.StringSlice("metadata", "fields") + if len(fields) > 2 { + data.SetNested(convert.LowerTitle(fields[2]), "metadata", "state", "name") + } +} diff --git a/pkg/resources/schema.go b/pkg/resources/schema.go index d3d9411..d6775b3 100644 --- a/pkg/resources/schema.go +++ b/pkg/resources/schema.go @@ -14,7 +14,7 @@ import ( "github.com/rancher/steve/pkg/resources/apigroups" "github.com/rancher/steve/pkg/resources/common" "github.com/rancher/steve/pkg/resources/counts" - "github.com/rancher/steve/pkg/resources/helm" + "github.com/rancher/steve/pkg/resources/formatters" "github.com/rancher/steve/pkg/resources/userpreferences" "github.com/rancher/steve/pkg/schema" "github.com/rancher/steve/pkg/stores/proxy" @@ -38,11 +38,15 @@ func DefaultSchemaTemplates(cf *client.Factory, apigroups.Template(discovery), { ID: "configmap", - Formatter: helm.DropHelmData, + Formatter: formatters.DropHelmData, }, { ID: "secret", - Formatter: helm.DropHelmData, + Formatter: formatters.DropHelmData, + }, + { + ID: "pod", + Formatter: formatters.Pod, }, } }