1
0
mirror of https://github.com/rancher/steve.git synced 2025-06-24 14:02:04 +00:00
steve/pkg/resources/schema.go
2020-06-22 08:49:49 -07:00

53 lines
1.6 KiB
Go

package resources
import (
"context"
"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"
"github.com/rancher/steve/pkg/accesscontrol"
"github.com/rancher/steve/pkg/client"
"github.com/rancher/steve/pkg/clustercache"
"github.com/rancher/steve/pkg/resources/apigroups"
"github.com/rancher/steve/pkg/resources/clusters"
"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/userpreferences"
"github.com/rancher/steve/pkg/schema"
"github.com/rancher/steve/pkg/stores/proxy"
"k8s.io/client-go/discovery"
)
func DefaultSchemas(ctx context.Context, baseSchema *types.APISchemas, ccache clustercache.ClusterCache, cg proxy.ClientGetter) (*types.APISchemas, error) {
counts.Register(baseSchema, ccache)
subscribe.Register(baseSchema)
apiroot.Register(baseSchema, []string{"v1"}, "proxy:/apis")
userpreferences.Register(baseSchema, cg)
helm.Register(baseSchema)
err := clusters.Register(ctx, baseSchema, cg, ccache)
return baseSchema, err
}
func DefaultSchemaTemplates(cf *client.Factory,
summaryCache *summarycache.SummaryCache,
lookup accesscontrol.AccessSetLookup,
discovery discovery.DiscoveryInterface) []schema.Template {
return []schema.Template{
common.DefaultTemplate(cf, summaryCache, lookup),
apigroups.Template(discovery),
{
ID: "configmap",
Formatter: helm.DropHelmData,
},
{
ID: "secret",
Formatter: helm.DropHelmData,
},
}
}