mirror of
https://github.com/rancher/steve.git
synced 2025-08-02 07:12:36 +00:00
Normalize conditions
This commit is contained in:
parent
b26bbc6494
commit
09d79b238b
@ -9,6 +9,7 @@ import (
|
||||
"github.com/rancher/steve/pkg/stores/proxy"
|
||||
"github.com/rancher/steve/pkg/summarycache"
|
||||
"github.com/rancher/wrangler/pkg/data"
|
||||
"github.com/rancher/wrangler/pkg/summary"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
)
|
||||
@ -42,14 +43,16 @@ func formatter(summarycache *summarycache.SummaryCache) types.Formatter {
|
||||
}
|
||||
|
||||
if unstr, ok := resource.APIObject.Object.(*unstructured.Unstructured); ok {
|
||||
summary, rel := summarycache.SummaryAndRelationship(unstr)
|
||||
s, rel := summarycache.SummaryAndRelationship(unstr)
|
||||
data.PutValue(unstr.Object, map[string]interface{}{
|
||||
"name": summary.State,
|
||||
"error": summary.Error,
|
||||
"transitioning": summary.Transitioning,
|
||||
"message": strings.Join(summary.Message, ":"),
|
||||
"name": s.State,
|
||||
"error": s.Error,
|
||||
"transitioning": s.Transitioning,
|
||||
"message": strings.Join(s.Message, ":"),
|
||||
}, "metadata", "state")
|
||||
data.PutValue(unstr.Object, rel, "metadata", "relationships")
|
||||
|
||||
summary.NormalizeConditions(unstr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import (
|
||||
"github.com/rancher/apiserver/pkg/types"
|
||||
"github.com/rancher/steve/pkg/accesscontrol"
|
||||
"github.com/rancher/steve/pkg/attributes"
|
||||
"github.com/rancher/steve/pkg/schema/converter"
|
||||
"github.com/rancher/wrangler/pkg/name"
|
||||
"github.com/sirupsen/logrus"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
@ -218,6 +219,10 @@ func (c *Collection) AddTemplate(templates ...Template) {
|
||||
for i, template := range templates {
|
||||
if template.Kind != "" {
|
||||
c.templates[template.Group+"/"+template.Kind] = &templates[i]
|
||||
c.templates[converter.GVKToSchemaID(schema.GroupVersionKind{
|
||||
Group: template.Group,
|
||||
Kind: template.Kind,
|
||||
})] = &templates[i]
|
||||
}
|
||||
if template.ID != "" {
|
||||
c.templates[template.ID] = &templates[i]
|
||||
|
Loading…
Reference in New Issue
Block a user