sqlproxy

package
v0.0.0-...-4787160 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2024 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Overview

Package sqlproxy implements the proxy store, which is responsible for either interfacing directly with the Kubernetes API, or in the case of List, interfacing with an on-disk cache of items in the Kubernetes API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	// ListByOptions returns objects according to the specified list options and partitions.
	// Specifically:
	//   - an unstructured list of resources belonging to any of the specified partitions
	//   - the total number of resources (returned list might be a subset depending on pagination options in lo)
	//   - a continue token, if there are more pages after the returned one
	//   - an error instead of all of the above if anything went wrong
	ListByOptions(ctx context.Context, lo informer.ListOptions, partitions []partition.Partition, namespace string) (*unstructured.UnstructuredList, int, string, error)
}

type CacheFactory

type CacheFactory interface {
	CacheFor(fields [][]string, client dynamic.ResourceInterface, gvk schema.GroupVersionKind, namespaced bool) (factory.Cache, error)
	Reset() error
}

type CacheFactoryInitializer

type CacheFactoryInitializer func() (CacheFactory, error)

type ClientGetter

type ClientGetter interface {
	IsImpersonating() bool
	K8sInterface(ctx *types.APIRequest) (kubernetes.Interface, error)
	AdminK8sInterface() (kubernetes.Interface, error)
	Client(ctx *types.APIRequest, schema *types.APISchema, namespace string, warningHandler rest.WarningHandler) (dynamic.ResourceInterface, error)
	DynamicClient(ctx *types.APIRequest, warningHandler rest.WarningHandler) (dynamic.Interface, error)
	AdminClient(ctx *types.APIRequest, schema *types.APISchema, namespace string, warningHandler rest.WarningHandler) (dynamic.ResourceInterface, error)
	TableClient(ctx *types.APIRequest, schema *types.APISchema, namespace string, warningHandler rest.WarningHandler) (dynamic.ResourceInterface, error)
	TableAdminClient(ctx *types.APIRequest, schema *types.APISchema, namespace string, warningHandler rest.WarningHandler) (dynamic.ResourceInterface, error)
	TableClientForWatch(ctx *types.APIRequest, schema *types.APISchema, namespace string, warningHandler rest.WarningHandler) (dynamic.ResourceInterface, error)
	TableAdminClientForWatch(ctx *types.APIRequest, schema *types.APISchema, namespace string, warningHandler rest.WarningHandler) (dynamic.ResourceInterface, error)
}

ClientGetter is a dynamic kubernetes client factory.

type RelationshipNotifier

type RelationshipNotifier interface {
	OnInboundRelationshipChange(ctx context.Context, schema *types.APISchema, namespace string) <-chan *summary.Relationship
}

RelationshipNotifier is an interface for handling wrangler summary.Relationship events.

type SchemaColumnSetter

type SchemaColumnSetter interface {
	SetColumns(ctx context.Context, schema *types.APISchema) error
}

type Store

type Store struct {
	// contains filtered or unexported fields
}

func NewProxyStore

func NewProxyStore(c SchemaColumnSetter, clientGetter ClientGetter, notifier RelationshipNotifier, factory CacheFactory) (*Store, error)

NewProxyStore returns a Store implemented directly on top of kubernetes.

func (*Store) ByID

func (s *Store) ByID(apiOp *types.APIRequest, schema *types.APISchema, id string) (*unstructured.Unstructured, []types.Warning, error)

ByID looks up a single object by its ID.

func (*Store) Create

func (s *Store) Create(apiOp *types.APIRequest, schema *types.APISchema, params types.APIObject) (*unstructured.Unstructured, []types.Warning, error)

Create creates a single object in the store.

func (*Store) Delete

func (s *Store) Delete(apiOp *types.APIRequest, schema *types.APISchema, id string) (*unstructured.Unstructured, []types.Warning, error)

Delete deletes an object from a store.

func (*Store) ListByPartitions

func (s *Store) ListByPartitions(apiOp *types.APIRequest, schema *types.APISchema, partitions []partition.Partition) ([]unstructured.Unstructured, int, string, error)

ListByPartitions returns:

  • an unstructured list of resources belonging to any of the specified partitions
  • the total number of resources (returned list might be a subset depending on pagination options in apiOp)
  • a continue token, if there are more pages after the returned one
  • an error instead of all of the above if anything went wrong

func (*Store) Reset

func (s *Store) Reset() error

Reset locks the store, resets the underlying cache factory, and warm the namespace cache.

func (*Store) Update

func (s *Store) Update(apiOp *types.APIRequest, schema *types.APISchema, params types.APIObject, id string) (*unstructured.Unstructured, []types.Warning, error)

Update updates a single object in the store.

func (*Store) Watch

func (s *Store) Watch(apiOp *types.APIRequest, schema *types.APISchema, w types.WatchRequest) (chan watch.Event, error)

Watch returns a channel of events for a list or resource.

func (*Store) WatchByPartitions

func (s *Store) WatchByPartitions(apiOp *types.APIRequest, schema *types.APISchema, wr types.WatchRequest, partitions []partition.Partition) (chan watch.Event, error)

WatchByPartitions returns a channel of events for a list or resource belonging to any of the specified partitions

func (*Store) WatchNames

func (s *Store) WatchNames(apiOp *types.APIRequest, schema *types.APISchema, w types.WatchRequest, names sets.Set[string]) (chan watch.Event, error)

WatchNames returns a channel of events filtered by an allowed set of names. In plain kubernetes, if a user has permission to 'list' or 'watch' a defined set of resource names, performing the list or watch will result in a Forbidden error, because the user does not have permission to list *all* resources. With this filter, the request can be performed successfully, and only the allowed resources will be returned in watch.

type WarningBuffer

type WarningBuffer []types.Warning

WarningBuffer holds warnings that may be returned from the kubernetes api

func (*WarningBuffer) HandleWarningHeader

func (w *WarningBuffer) HandleWarningHeader(code int, agent string, text string)

HandleWarningHeader takes the components of a kubernetes warning header and stores them

Directories

Path Synopsis
Package tablelistconvert provides a client that will use a table client but convert *UnstructuredList and *Unstructured objects returned by ByID and List to resemble those returned by non-table clients while preserving some table-related data.
Package tablelistconvert provides a client that will use a table client but convert *UnstructuredList and *Unstructured objects returned by ByID and List to resemble those returned by non-table clients while preserving some table-related data.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL