mirror of
https://github.com/niusmallnan/steve.git
synced 2025-07-16 15:41:10 +00:00
Set pod status to state
This commit is contained in:
parent
afb90310a2
commit
a528c500cf
@ -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")
|
||||
}
|
||||
}
|
@ -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,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user