mirror of
https://github.com/niusmallnan/steve.git
synced 2025-06-20 03:41:55 +00:00
25 lines
696 B
Go
25 lines
696 B
Go
package formatters
|
|
|
|
import (
|
|
"github.com/rancher/apiserver/pkg/types"
|
|
"github.com/rancher/norman/types/convert"
|
|
)
|
|
|
|
func DropHelmData(request *types.APIRequest, resource *types.RawResource) {
|
|
data := resource.APIObject.Data()
|
|
if data.String("metadata", "labels", "owner") == "helm" ||
|
|
data.String("metadata", "labels", "OWNER") == "TILLER" {
|
|
if data.String("data", "release") != "" {
|
|
delete(data.Map("data"), "release")
|
|
}
|
|
}
|
|
}
|
|
|
|
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")
|
|
}
|
|
}
|