clients

package
v1.17.0-beta26 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DefaultPathPrefix = "secret"

The DefaultPathPrefix may be overridden to allow for non-standard vault mount paths

View Source
const (
	DefaultRootKey = "gloo" // used for vault and consul key-value storage
)
View Source
const SecretSourceAPIVaultClientInitIndex = -1

SecretSourceAPIVaultClientInitIndex is a dedicated index for use of the SecretSource API

Variables

View Source
var (
	// ErrNilSourceSlice indicates a nil slice of sources was passed to the factory,
	// and we can therefore not initialize any sub-clients
	ErrNilSourceSlice = errors.New("nil slice of secret sources")

	// ErrEmptySourceSlice indicates the factory held an empty slice of sources while
	// trying to create a new client, and we can therefore not initialize any sub-clients
	ErrEmptySourceSlice = errors.New("empty slice of secret sources")
)
View Source
var DefaultConsulQueryOptions = &consulapi.QueryOptions{RequireConsistent: true, AllowStale: false}

DefaultConsulQueryOptions provides default query options for consul

View Source
var (
	// ErrNotImplemented indicates a call was made to an interface method which has not been implemented
	ErrNotImplemented = errors.New("interface method not implemented")
)

Functions

func ArtifactFactoryForSettings

func ArtifactFactoryForSettings(ctx context.Context,
	settings *v1.Settings,
	sharedCache memory.InMemoryResourceCache,
	cfg **rest.Config,
	clientset *kubernetes.Interface,
	kubeCoreCache *cache.KubeCoreCache,
	consulClient *consulapi.Client,
	pluralName string) (factory.ResourceClientFactory, error)

ArtifactFactoryForSettings constructs a new ResourceClientFactory for Artifacts using Kubernetes, Directory, or Consul. settings.ArtifactSource or sharedCache must be non-nil

func ConfigFactoryForSettings

func ConfigFactoryForSettings(params ConfigFactoryParams, resourceCrd crd.Crd) (factory.ResourceClientFactory, error)

ConfigFactoryForSettings constructs a new ResourceClientFactory for Config using Kubernetes, Directory, or Consul. params.memory.sharedCache, resourceCrd+params.kube.restCfg OR params.consul.consulClient must be non-nil

func ConsulClientForSettings

func ConsulClientForSettings(ctx context.Context, settings *v1.Settings) (*consulapi.Client, error)

ConsulClientForSettings constructs a Consul API client for the configuration provided in the settings parameter.

func KubeServiceClientForSettings

func KubeServiceClientForSettings(ctx context.Context,
	settings *v1.Settings,
	sharedCache memory.InMemoryResourceCache,
	cfg **rest.Config,
	clientset *kubernetes.Interface,
	kubeCoreCache *cache.KubeCoreCache) (skkube.ServiceClient, error)

KubeServiceClientForSettings initializes a ServiceClient for the given settings. If we are using Config in Kubernetes, we use a Kubernetes ServiceClient, otherwise we use an in-memory client.

func NewMultiSecretResourceClientFactory added in v1.14.7

func NewMultiSecretResourceClientFactory(params MultiSecretFactoryParams) (factory.ResourceClientFactory, error)

NewMultiSecretResourceClientFactory returns a resource client factory for a client supporting multiple sources

func NewSecretResourceClientFactory added in v1.14.7

func NewSecretResourceClientFactory(ctx context.Context, params SecretFactoryParams) (factory.ResourceClientFactory, error)

func NewVaultSecretClientFactory

func NewVaultSecretClientFactory(ctx context.Context, clientInit VaultClientInitFunc, pathPrefix, rootKey string) factory.ResourceClientFactory

NewVaultSecretClientFactory consumes a vault client along with a set of basic configurations for retrieving info with the client

func SecretFactoryForSettings

func SecretFactoryForSettings(ctx context.Context, params SecretFactoryParams) (factory.ResourceClientFactory, error)

SecretFactoryForSettings creates a resource client factory for provided config. Implemented as secrets.MultiResourceClient iff secretOptions API is configured.

func VaultClientForSettings

func VaultClientForSettings(ctx context.Context, vaultSettings *v1.Settings_VaultSecrets) (*api.Client, error)

VaultClientForSettings returns a vault client based on the provided settings.

Types

type ConfigFactoryParams

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

func NewConfigFactoryParams

func NewConfigFactoryParams(settings *v1.Settings,
	sharedCache memory.InMemoryResourceCache,
	cache kube.SharedCache,
	cfg **rest.Config,
	consulClient *consulapi.Client) ConfigFactoryParams

NewConfigFactoryParams constructs a ConfigFactoryParams to pass into ConfigFactoryForSettings

type MultiSecretFactoryParams added in v1.14.7

type MultiSecretFactoryParams struct {
	SecretSources      SourceList
	SharedCache        memory.InMemoryResourceCache
	Cfg                **rest.Config
	Clientset          *kubernetes.Interface
	KubeCoreCache      *cache.KubeCoreCache
	VaultClientInitMap map[int]VaultClientInitFunc
}

type MultiSecretResourceClient added in v1.14.7

type MultiSecretResourceClient struct {
	// guard against concurrent slice access
	*sync.RWMutex
	// contains filtered or unexported fields
}

MultiSecretResourceClient represents a client that is minimally implemented to facilitate Gloo operations. Specifically, only List and Watch are properly implemented.

Direct access to clientList is deliberately omitted to prevent changing clients with an open Watch leading to inconsistent and undefined behavior

func (*MultiSecretResourceClient) ApplyStatus added in v1.14.7

func (*MultiSecretResourceClient) Delete added in v1.14.7

func (m *MultiSecretResourceClient) Delete(namespace string, name string, opts clients.DeleteOpts) error

func (*MultiSecretResourceClient) Kind added in v1.14.7

func (*MultiSecretResourceClient) List added in v1.14.7

func (*MultiSecretResourceClient) NewResource added in v1.14.7

func (m *MultiSecretResourceClient) NewResource() resources.Resource

func (*MultiSecretResourceClient) Read added in v1.14.7

func (m *MultiSecretResourceClient) Read(namespace string, name string, opts clients.ReadOpts) (resources.Resource, error)

func (*MultiSecretResourceClient) Register deprecated added in v1.14.7

func (m *MultiSecretResourceClient) Register() error

Deprecated: implemented only by the kubernetes resource client. Will be removed from the interface.

func (*MultiSecretResourceClient) Watch added in v1.14.7

func (m *MultiSecretResourceClient) Watch(namespace string, opts clients.WatchOpts) (<-chan resources.ResourceList, <-chan error, error)

func (*MultiSecretResourceClient) Write added in v1.14.7

type MultiSecretResourceClientFactory added in v1.14.7

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

func (*MultiSecretResourceClientFactory) NewResourceClient added in v1.14.7

NewResourceClient implements ResourceClientFactory by creating a new client with each sub-client initialized

type SecretFactoryParams added in v1.14.7

type SecretFactoryParams struct {
	Settings           *v1.Settings
	SharedCache        memory.InMemoryResourceCache
	Cfg                **rest.Config
	Clientset          *kubernetes.Interface
	KubeCoreCache      *cache.KubeCoreCache
	VaultClientInitMap map[int]VaultClientInitFunc // map client init funcs to their index in the sources slice
	PluralName         string
}

type SourceList added in v1.14.7

type SourceList []*v1.Settings_SecretOptions_Source

func (SourceList) Len added in v1.14.7

func (s SourceList) Len() int

func (SourceList) Less added in v1.14.7

func (s SourceList) Less(i int, j int) bool

func (SourceList) Swap added in v1.14.7

func (s SourceList) Swap(i int, j int)

type VaultClientInitFunc added in v1.14.7

type VaultClientInitFunc func(ctx context.Context) *api.Client

func NoopVaultClientInitFunc added in v1.14.7

func NoopVaultClientInitFunc(c *api.Client) VaultClientInitFunc

Directories

Path Synopsis
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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