mirror of
https://github.com/niusmallnan/steve.git
synced 2025-06-26 14:41:35 +00:00
Ensure that watches use the latest schemas
This commit is contained in:
parent
0414d4acf5
commit
426330efa2
@ -19,13 +19,23 @@ import (
|
|||||||
steveschema "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/stores/proxy"
|
||||||
"github.com/rancher/steve/pkg/summarycache"
|
"github.com/rancher/steve/pkg/summarycache"
|
||||||
|
"k8s.io/apiserver/pkg/endpoints/request"
|
||||||
"k8s.io/client-go/discovery"
|
"k8s.io/client-go/discovery"
|
||||||
)
|
)
|
||||||
|
|
||||||
func DefaultSchemas(ctx context.Context, baseSchema *types.APISchemas, ccache clustercache.ClusterCache,
|
func DefaultSchemas(ctx context.Context, baseSchema *types.APISchemas, ccache clustercache.ClusterCache,
|
||||||
cg proxy.ClientGetter, schemaFactory steveschema.Factory) error {
|
cg proxy.ClientGetter, schemaFactory steveschema.Factory) error {
|
||||||
counts.Register(baseSchema, ccache)
|
counts.Register(baseSchema, ccache)
|
||||||
subscribe.Register(baseSchema)
|
subscribe.Register(baseSchema, func(apiOp *types.APIRequest) *types.APISchemas {
|
||||||
|
user, ok := request.UserFrom(apiOp.Context())
|
||||||
|
if ok {
|
||||||
|
schemas, err := schemaFactory.Schemas(user)
|
||||||
|
if err == nil {
|
||||||
|
return schemas
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return apiOp.Schemas
|
||||||
|
})
|
||||||
apiroot.Register(baseSchema, []string{"v1"}, "proxy:/apis")
|
apiroot.Register(baseSchema, []string{"v1"}, "proxy:/apis")
|
||||||
cluster.Register(ctx, baseSchema, cg, schemaFactory)
|
cluster.Register(ctx, baseSchema, cg, schemaFactory)
|
||||||
userpreferences.Register(baseSchema)
|
userpreferences.Register(baseSchema)
|
||||||
|
Loading…
Reference in New Issue
Block a user