mirror of
https://github.com/rancher/steve.git
synced 2025-09-09 03:09:50 +00:00
Add fake cluster object and move apply action to core steve
This commit is contained in:
@@ -10,23 +10,28 @@ import (
|
||||
"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/cluster"
|
||||
"github.com/rancher/steve/pkg/resources/common"
|
||||
"github.com/rancher/steve/pkg/resources/counts"
|
||||
"github.com/rancher/steve/pkg/resources/formatters"
|
||||
"github.com/rancher/steve/pkg/schema"
|
||||
steveschema "github.com/rancher/steve/pkg/schema"
|
||||
"github.com/rancher/steve/pkg/stores/proxy"
|
||||
"github.com/rancher/steve/pkg/summarycache"
|
||||
"k8s.io/client-go/discovery"
|
||||
)
|
||||
|
||||
func DefaultSchemas(ctx context.Context, baseSchema *types.APISchemas, ccache clustercache.ClusterCache, cg proxy.ClientGetter) (*types.APISchemas, error) {
|
||||
func DefaultSchemas(ctx context.Context, baseSchema *types.APISchemas, ccache clustercache.ClusterCache,
|
||||
cg proxy.ClientGetter, schemaFactory steveschema.Factory) error {
|
||||
counts.Register(baseSchema, ccache)
|
||||
subscribe.Register(baseSchema)
|
||||
apiroot.Register(baseSchema, []string{"v1"}, "proxy:/apis")
|
||||
return baseSchema, nil
|
||||
cluster.Register(ctx, baseSchema, cg, schemaFactory)
|
||||
return nil
|
||||
}
|
||||
|
||||
func DefaultSchemaTemplates(cf *client.Factory,
|
||||
baseSchemas *types.APISchemas,
|
||||
summaryCache *summarycache.SummaryCache,
|
||||
lookup accesscontrol.AccessSetLookup,
|
||||
discovery discovery.DiscoveryInterface) []schema.Template {
|
||||
@@ -45,5 +50,11 @@ func DefaultSchemaTemplates(cf *client.Factory,
|
||||
ID: "pod",
|
||||
Formatter: formatters.Pod,
|
||||
},
|
||||
{
|
||||
ID: "management.cattle.io.cluster",
|
||||
Customize: func(apiSchema *types.APISchema) {
|
||||
cluster.AddApply(baseSchemas, apiSchema)
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user