1
0
mirror of https://github.com/rancher/steve.git synced 2025-06-01 19:36:00 +00:00
steve/pkg/resources/schema.go

53 lines
1.6 KiB
Go
Raw Normal View History

2019-08-13 23:36:03 +00:00
package resources
import (
2020-06-02 15:51:42 +00:00
"context"
2020-06-22 15:49:49 +00:00
"github.com/rancher/steve/pkg/summarycache"
"github.com/rancher/apiserver/pkg/store/apiroot"
"github.com/rancher/apiserver/pkg/subscribe"
"github.com/rancher/apiserver/pkg/types"
2020-02-10 17:18:20 +00:00
"github.com/rancher/steve/pkg/accesscontrol"
2020-01-31 05:01:21 +00:00
"github.com/rancher/steve/pkg/client"
2019-09-11 21:05:00 +00:00
"github.com/rancher/steve/pkg/clustercache"
"github.com/rancher/steve/pkg/resources/apigroups"
"github.com/rancher/steve/pkg/resources/common"
"github.com/rancher/steve/pkg/resources/counts"
2020-08-04 02:52:04 +00:00
"github.com/rancher/steve/pkg/resources/formatters"
"github.com/rancher/steve/pkg/resources/userpreferences"
2020-01-31 05:37:59 +00:00
"github.com/rancher/steve/pkg/schema"
"github.com/rancher/steve/pkg/stores/proxy"
2020-01-31 05:37:59 +00:00
"k8s.io/client-go/discovery"
2019-08-13 23:36:03 +00:00
)
2020-06-06 03:45:26 +00:00
func DefaultSchemas(ctx context.Context, baseSchema *types.APISchemas, ccache clustercache.ClusterCache, cg proxy.ClientGetter) (*types.APISchemas, error) {
2019-09-09 21:28:55 +00:00
counts.Register(baseSchema, ccache)
2020-03-01 16:00:08 +00:00
subscribe.Register(baseSchema)
apiroot.Register(baseSchema, []string{"v1"}, "proxy:/apis")
2020-03-12 20:14:47 +00:00
userpreferences.Register(baseSchema, cg)
return baseSchema, nil
2020-01-31 05:37:59 +00:00
}
2019-08-13 23:36:03 +00:00
2020-06-22 15:49:49 +00:00
func DefaultSchemaTemplates(cf *client.Factory,
summaryCache *summarycache.SummaryCache,
lookup accesscontrol.AccessSetLookup,
discovery discovery.DiscoveryInterface) []schema.Template {
2020-01-31 05:37:59 +00:00
return []schema.Template{
2020-06-22 15:49:49 +00:00
common.DefaultTemplate(cf, summaryCache, lookup),
apigroups.Template(discovery),
2020-06-05 20:30:33 +00:00
{
ID: "configmap",
2020-08-04 02:52:04 +00:00
Formatter: formatters.DropHelmData,
2020-06-05 20:30:33 +00:00
},
{
ID: "secret",
2020-08-04 02:52:04 +00:00
Formatter: formatters.DropHelmData,
},
{
ID: "pod",
Formatter: formatters.Pod,
2020-06-05 20:30:33 +00:00
},
2020-01-31 05:01:21 +00:00
}
2019-08-13 23:36:03 +00:00
}