1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-09 11:19:12 +00:00
This commit is contained in:
Darren Shepherd
2020-01-30 22:01:21 -07:00
parent 9184741c57
commit 19c6732de0
2380 changed files with 587 additions and 759101 deletions

View File

@@ -0,0 +1,38 @@
package resources
import (
"github.com/rancher/norman/v2/pkg/store/apiroot"
"github.com/rancher/norman/v2/pkg/subscribe"
"github.com/rancher/norman/v2/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/common"
"github.com/rancher/steve/pkg/resources/core"
"github.com/rancher/steve/pkg/resources/counts"
"github.com/rancher/steve/pkg/resources/schema"
"k8s.io/client-go/kubernetes"
)
func SchemaFactory(
cf *client.Factory,
as *accesscontrol.AccessStore,
k8s kubernetes.Interface,
ccache clustercache.ClusterCache,
) (*schema.Collection, error) {
baseSchema := types.EmptySchemas()
collection := schema.NewCollection(baseSchema, as)
core.Register(collection)
counts.Register(baseSchema, ccache)
subscribe.Register(baseSchema)
apigroups.Register(baseSchema, k8s.Discovery())
apiroot.Register(baseSchema, []string{"v1"}, []string{"proxy:/apis"})
if err := common.Register(collection, cf); err != nil {
return nil, err
}
return collection, nil
}