2019-08-13 23:36:03 +00:00
|
|
|
package resources
|
|
|
|
|
|
|
|
import (
|
2020-01-31 05:01:21 +00:00
|
|
|
"github.com/rancher/norman/v2/pkg/store/apiroot"
|
|
|
|
"github.com/rancher/norman/v2/pkg/subscribe"
|
|
|
|
"github.com/rancher/norman/v2/pkg/types"
|
2019-09-11 21:05:00 +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/core"
|
|
|
|
"github.com/rancher/steve/pkg/resources/counts"
|
|
|
|
"github.com/rancher/steve/pkg/resources/schema"
|
2019-08-14 20:13:26 +00:00
|
|
|
"k8s.io/client-go/kubernetes"
|
2019-08-13 23:36:03 +00:00
|
|
|
)
|
|
|
|
|
2020-01-31 05:01:21 +00:00
|
|
|
func SchemaFactory(
|
|
|
|
cf *client.Factory,
|
2019-09-09 21:28:55 +00:00
|
|
|
as *accesscontrol.AccessStore,
|
|
|
|
k8s kubernetes.Interface,
|
|
|
|
ccache clustercache.ClusterCache,
|
2020-01-31 05:01:21 +00:00
|
|
|
) (*schema.Collection, error) {
|
2019-08-13 23:36:03 +00:00
|
|
|
baseSchema := types.EmptySchemas()
|
|
|
|
collection := schema.NewCollection(baseSchema, as)
|
|
|
|
|
2019-09-09 21:28:55 +00:00
|
|
|
core.Register(collection)
|
|
|
|
counts.Register(baseSchema, ccache)
|
2019-08-13 23:36:03 +00:00
|
|
|
subscribe.Register(baseSchema)
|
2019-08-14 20:13:26 +00:00
|
|
|
apigroups.Register(baseSchema, k8s.Discovery())
|
2019-08-14 20:51:13 +00:00
|
|
|
apiroot.Register(baseSchema, []string{"v1"}, []string{"proxy:/apis"})
|
2019-08-13 23:36:03 +00:00
|
|
|
|
2020-01-31 05:01:21 +00:00
|
|
|
if err := common.Register(collection, cf); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2019-08-13 23:36:03 +00:00
|
|
|
|
2020-01-31 05:01:21 +00:00
|
|
|
return collection, nil
|
2019-08-13 23:36:03 +00:00
|
|
|
}
|