kubernetes

package
v0.0.0-...-e7c744b Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientFactory

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

ClientFactory returns a Kubernetes client.

func NewClientFactory

func NewClientFactory(configFactory ConfigFactory) ClientFactory

NewClientFactory returns a new ClientFactory.

func (ClientFactory) FromSecret

func (f ClientFactory) FromSecret(ctx context.Context, secretID string) (kubernetes.Interface, error)

FromSecret creates a Kubernetes client for a cluster from a secret.

type ConfigFactory

type ConfigFactory interface {
	// FromSecret returns a config from a secret.
	FromSecret(ctx context.Context, secretID string) (*rest.Config, error)
}

ConfigFactory returns a Kubernetes configuration.

type ConfigSecretGetter

type ConfigSecretGetter interface {
	// GetConfigSecretID returns a config secret ID for a cluster.
	GetConfigSecretID(ctx context.Context, clusterID uint) (string, error)
}

ConfigSecretGetter returns a config secret ID for a cluster.

type ConfigSecretStore

type ConfigSecretStore interface {
	// GetSecretValues returns the values stored within a secret.
	// If the underlying store uses additional keys for determining the exact secret path
	// (eg. organization ID), it should be retrieved from the context.
	GetSecretValues(ctx context.Context, secretID string) (map[string]string, error)
}

type DefaultConfigFactory

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

DefaultConfigFactory is a default implementation of the ConfigFactory interface.

func NewConfigFactory

func NewConfigFactory(secrets ConfigSecretStore) DefaultConfigFactory

NewConfigFactory returns a new ConfigFactory.

func (DefaultConfigFactory) FromSecret

func (f DefaultConfigFactory) FromSecret(ctx context.Context, secretID string) (*rest.Config, error)

FromSecret returns a config from a secret.

type DynamicClientFactory

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

DynamicClientFactory returns a dynamic Kubernetes client.

func NewDynamicClientFactory

func NewDynamicClientFactory(configFactory ConfigFactory) DynamicClientFactory

NewDynamicClientFactory returns a new DynamicClientFactory.

func (DynamicClientFactory) FromSecret

func (f DynamicClientFactory) FromSecret(ctx context.Context, secretID string) (dynamic.Interface, error)

FromSecret creates a Kubernetes client for a cluster from a secret.

type DynamicFileClientFactory

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

DynamicFileClientFactory returns a DynamicFileClient.

func NewDynamicFileClientFactory

func NewDynamicFileClientFactory(configFactory ConfigFactory) DynamicFileClientFactory

NewDynamicFileClientFactory returns a new DynamicFileClientFactory.

func (DynamicFileClientFactory) FromSecret

func (f DynamicFileClientFactory) FromSecret(ctx context.Context, secretID string) (k8s.DynamicFileClient, error)

FromSecret creates a DynamicFileClient for a cluster from a secret.

type Logger

type Logger = common.Logger

Logger is the fundamental interface for all log operations.

type MockDynamicFileClient

type MockDynamicFileClient struct {
	mock.Mock
}

MockDynamicFileClient is an autogenerated mock type for the DynamicFileClient type

func (*MockDynamicFileClient) Create

func (_m *MockDynamicFileClient) Create(ctx context.Context, file []byte) error

Create provides a mock function with given fields: ctx, file

type Service

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

Service provides an interface for using client-go on a specific cluster.

func NewService

func NewService(
	configSecretGetter ConfigSecretGetter,
	configFactory ConfigFactory,
	logger Logger,
) *Service

NewService returns a new NewService.

func (*Service) DeleteObject

func (s *Service) DeleteObject(ctx context.Context, clusterID uint, o client.Object) error

DeleteObject deletes an Object from a specific cluster.

func (*Service) EnsureObject

func (s *Service) EnsureObject(ctx context.Context, clusterID uint, o client.Object) error

EnsureObject makes sure that a given Object is on the cluster and returns it.

func (*Service) GetKubeConfig

func (s *Service) GetKubeConfig(ctx context.Context, clusterID uint) (*rest.Config, error)

GetKubeConfig gets a kube config for a specific cluster.

func (*Service) GetObject

func (s *Service) GetObject(ctx context.Context, clusterID uint, objRef corev1.ObjectReference, obj client.Object) error

GetObject gets an Object from a specific cluster.

func (*Service) List

func (s *Service) List(ctx context.Context, clusterID uint, labels map[string]string, obj client.ObjectList) error

List lists Objects a specific cluster.

func (*Service) Update

func (s *Service) Update(ctx context.Context, clusterID uint, o client.Object) error

Update updates a given Object on the cluster and returns it.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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