1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-18 08:20:36 +00:00

Updates Schemas watch logic.

Updated logic used to decide when and what schema events are sent
during a watch.
This commit is contained in:
Kevin Joiner
2022-10-20 00:16:01 -04:00
parent 44e5b8dc3d
commit 72ab913c4c
9 changed files with 738 additions and 36 deletions

View File

@@ -1,6 +1,8 @@
package schema
//go:generate mockgen --build_flags=--mod=mod -package fake -destination fake/factory.go "github.com/rancher/steve/pkg/schema" Factory
import (
"context"
"fmt"
"net/http"
"time"
@@ -9,9 +11,18 @@ import (
"github.com/rancher/apiserver/pkg/types"
"github.com/rancher/steve/pkg/accesscontrol"
"github.com/rancher/steve/pkg/attributes"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apiserver/pkg/authentication/user"
)
type Factory interface {
Schemas(user user.Info) (*types.APISchemas, error)
ByGVR(gvr schema.GroupVersionResource) string
ByGVK(gvr schema.GroupVersionKind) string
OnChange(ctx context.Context, cb func())
AddTemplate(template ...Template)
}
func newSchemas() (*types.APISchemas, error) {
apiSchemas := types.EmptyAPISchemas()
if err := apiSchemas.AddSchemas(builtin.Schemas); err != nil {