sqlproxy

package
v0.6.53 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: Apache-2.0 Imports: 47 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 *sqltypes.ListOptions, partitions []partition.Partition, namespace string) (*unstructured.UnstructuredList, int, string, error)
}

type CacheFactory

type CacheFactory interface {
	CacheFor(ctx context.Context, fields [][]string, externalUpdateInfo *sqltypes.ExternalGVKUpdates, selfUpdateInfo *sqltypes.ExternalGVKUpdates, transform cache.TransformFunc, client dynamic.ResourceInterface, gvk schema.GroupVersionKind, typeGuidance map[string]string, namespaced bool, watchable bool) (*factory.Cache, error)
	DoneWithCache(*factory.Cache)
	Stop(gvk schema.GroupVersionKind) 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(ctx context.Context, c SchemaColumnSetter, clientGetter ClientGetter, notifier RelationshipNotifier, scache virtualCommon.SummaryCache, factory CacheFactory, needToInitNamespaceCache bool) (*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, apiSchema *types.APISchema, partitions []partition.Partition) (*unstructured.UnstructuredList, 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(gvk schema.GroupVersionKind) 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 TransformBuilder

type TransformBuilder interface {
	GetTransformFunc(gvk schema.GroupVersionKind, colDefs []common.ColumnDefinition, isCRD bool) cache.TransformFunc
}

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

type Watchers added in v0.6.7

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

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