provider

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

README

provider package

Contains kube and ssh provider.

SSH provider integration tests located in ../ssh/testssh/provider_test.go.

Kube provider does not contain unit tests only integration. Integration tests located in ../tests/provider/kube_test.go.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCannotProvideSSHProvider = errors.New("cannot provide ssh provider initializer")
)
View Source
var ErrSSHClientCannotProvided = errors.New("cannot provide ssh client")

Functions

This section is empty.

Types

type DefaultKubeProvider

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

func NewDefaultKubeProvider

func NewDefaultKubeProvider(sett settings.Settings, config *kube.Config, runnerInterface RunnerInterface) *DefaultKubeProvider

NewDefaultKubeProvider if use rest config sshProvider can be nil

func (*DefaultKubeProvider) AdditionalClientsCount

func (p *DefaultKubeProvider) AdditionalClientsCount() int

func (*DefaultKubeProvider) Cleanup

func (*DefaultKubeProvider) Client

func (*DefaultKubeProvider) HasCurrent

func (p *DefaultKubeProvider) HasCurrent() bool

func (*DefaultKubeProvider) NewAdditionalClient

func (p *DefaultKubeProvider) NewAdditionalClient(ctx context.Context) (connection.KubeClient, error)

func (*DefaultKubeProvider) NewAdditionalClientWithoutInitialize

func (p *DefaultKubeProvider) NewAdditionalClientWithoutInitialize(ctx context.Context) (connection.KubeClient, error)

NewAdditionalClientWithoutInitialize create new additional client without initialize

func (*DefaultKubeProvider) WithLoopsParams

type DefaultSSHProvider

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

func NewDefaultSSHProvider

func NewDefaultSSHProvider(sett settings.Settings, config *sshconfig.ConnectionConfig, opts ...SSHClientOption) *DefaultSSHProvider

func NewDefaultSSHProviderFromFlags

func NewDefaultSSHProviderFromFlags(sett settings.Settings, flags *sshconfig.Flags, opts ...sshconfig.ValidateOption) (*DefaultSSHProvider, error)

func (*DefaultSSHProvider) AdditionalClients

func (p *DefaultSSHProvider) AdditionalClients() []connection.SSHClient

AdditionalClients please use for testing purposes only!

func (*DefaultSSHProvider) Cleanup

func (*DefaultSSHProvider) Client

func (*DefaultSSHProvider) HasCurrent

func (p *DefaultSSHProvider) HasCurrent() bool

func (*DefaultSSHProvider) NewAdditionalClient

func (p *DefaultSSHProvider) NewAdditionalClient(ctx context.Context) (connection.SSHClient, error)

func (*DefaultSSHProvider) NewStandaloneClient

func (p *DefaultSSHProvider) NewStandaloneClient(ctx context.Context, sess *session.Session, privateKeys []session.AgentPrivateKey, opts ...connection.StandaloneClientOpt) (connection.SSHClient, error)

func (*DefaultSSHProvider) SwitchClient

func (p *DefaultSSHProvider) SwitchClient(ctx context.Context, sess *session.Session, privateKeys []session.AgentPrivateKey) (connection.SSHClient, error)

func (*DefaultSSHProvider) SwitchToDefault

func (p *DefaultSSHProvider) SwitchToDefault(ctx context.Context) (connection.SSHClient, error)

func (*DefaultSSHProvider) WithID

func (*DefaultSSHProvider) WithOptions

func (p *DefaultSSHProvider) WithOptions(opts ...SSHClientOption) *DefaultSSHProvider

WithOptions warning passed options fully rewrite options passed to NewDefaultSSHProvider

type ErrorSSHProvider

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

func NewErrorSSHProvider

func NewErrorSSHProvider(err error) *ErrorSSHProvider

NewErrorSSHProvider Special provider that always return error for all operations expected cleanup it can be used with GetRunnerInterface if you are you sure that you do not use KubeClient over SSH

func (*ErrorSSHProvider) Cleanup

func (p *ErrorSSHProvider) Cleanup(context.Context) error

func (*ErrorSSHProvider) Client

func (*ErrorSSHProvider) NewAdditionalClient

func (p *ErrorSSHProvider) NewAdditionalClient(context.Context) (connection.SSHClient, error)

func (*ErrorSSHProvider) SwitchClient

func (*ErrorSSHProvider) SwitchToDefault

func (p *ErrorSSHProvider) SwitchToDefault(context.Context) (connection.SSHClient, error)

type ErrorSSHProviderInitializer added in v0.3.0

type ErrorSSHProviderInitializer struct {
	*SimpleSSHProviderInitializer
}

ErrorSSHProviderInitializer provide ErrorSSHProvider this provider returns error for every SSHProvider methods call

func NewErrorSSHProviderInitializer added in v0.5.0

func NewErrorSSHProviderInitializer(err error) *ErrorSSHProviderInitializer

type FakeKubeProvider

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

func NewFakeKubeProvider

func NewFakeKubeProvider(gvrs ...map[schema.GroupVersionResource]string) *FakeKubeProvider

func (*FakeKubeProvider) Cleanup

func (p *FakeKubeProvider) Cleanup(context.Context) error

func (*FakeKubeProvider) Client

func (*FakeKubeProvider) NewAdditionalClient

func (p *FakeKubeProvider) NewAdditionalClient(ctx context.Context) (connection.KubeClient, error)

func (*FakeKubeProvider) NewAdditionalClientWithoutInitialize

func (p *FakeKubeProvider) NewAdditionalClientWithoutInitialize(ctx context.Context) (connection.KubeClient, error)

type FakeKubeProviderInitializer added in v0.3.0

type FakeKubeProviderInitializer struct {
	*SimpleKubeProviderInitializer
}

func NewFakeKubeProviderInitializer added in v0.3.0

func NewFakeKubeProviderInitializer(gvrs ...map[schema.GroupVersionResource]string) *FakeKubeProviderInitializer

type KubeProviderInitializer added in v0.3.0

type KubeProviderInitializer interface {
	GetKubeProvider(ctx context.Context) (connection.KubeProvider, error)
}

type KubeProviderInitializerWithCleanup added in v0.3.0

type KubeProviderInitializerWithCleanup interface {
	KubeProviderInitializer
	Cleanup(ctx context.Context) error
}

type KubeProviderLoopsParams

type KubeProviderLoopsParams struct {
	InitClient   retry.Params
	WaitingReady retry.Params
}

type ProvideErrorSSHProviderInitializer added in v0.5.0

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

ProvideErrorSSHProviderInitializer this provider returns error for every GetSSHProvider call for fail fast in GetRunnerInterface func

func NewProvideErrorSSHProviderInitializer added in v0.5.0

func NewProvideErrorSSHProviderInitializer(err error) *ProvideErrorSSHProviderInitializer

func (*ProvideErrorSSHProviderInitializer) Cleanup added in v0.5.0

func (*ProvideErrorSSHProviderInitializer) GetSSHProvider added in v0.5.0

type RunnerInterface

type RunnerInterface interface {
	IsSwitched(ctx context.Context) (bool, error)
	SetNodeInterface(ctx context.Context, client *kube.KubernetesClient, opts ...SetNodeInterfaceOpt) error
	Finalize(isError bool)
	InitOptions() []kube.InitOpt
}

func GetRunnerInterface

func GetRunnerInterface(ctx context.Context, config *kube.Config, sett settings.Settings, sshInitializer SSHProviderInitializer, opts ...RunnerInterfaceOpt) (RunnerInterface, error)

type RunnerInterfaceLocal

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

func NewRunnerInterfaceLocal

func NewRunnerInterfaceLocal(sett settings.Settings) *RunnerInterfaceLocal

func (*RunnerInterfaceLocal) Finalize

func (r *RunnerInterfaceLocal) Finalize(bool)

func (*RunnerInterfaceLocal) InitOptions

func (r *RunnerInterfaceLocal) InitOptions() []kube.InitOpt

func (*RunnerInterfaceLocal) IsSwitched

func (r *RunnerInterfaceLocal) IsSwitched(context.Context) (bool, error)

func (*RunnerInterfaceLocal) SetNodeInterface

func (r *RunnerInterfaceLocal) SetNodeInterface(_ context.Context, client *kube.KubernetesClient, _ ...SetNodeInterfaceOpt) error

type RunnerInterfaceNoAction

type RunnerInterfaceNoAction struct{}

func (*RunnerInterfaceNoAction) Finalize

func (*RunnerInterfaceNoAction) Finalize(bool)

func (*RunnerInterfaceNoAction) InitOptions

func (*RunnerInterfaceNoAction) InitOptions() []kube.InitOpt

func (*RunnerInterfaceNoAction) IsSwitched

func (*RunnerInterfaceNoAction) SetNodeInterface

type RunnerInterfaceOpt

type RunnerInterfaceOpt func(RunnerInterface)

func RunnerInterfaceWithInitOpts

func RunnerInterfaceWithInitOpts(opts ...kube.InitOpt) RunnerInterfaceOpt

type RunnerInterfaceSSH

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

func NewRunnerInterfaceSSH

func NewRunnerInterfaceSSH(sett settings.Settings, sshProvider connection.SSHProvider) *RunnerInterfaceSSH

func (*RunnerInterfaceSSH) Finalize

func (r *RunnerInterfaceSSH) Finalize(isError bool)

func (*RunnerInterfaceSSH) InitOptions

func (r *RunnerInterfaceSSH) InitOptions() []kube.InitOpt

func (*RunnerInterfaceSSH) IsSwitched

func (r *RunnerInterfaceSSH) IsSwitched(ctx context.Context) (bool, error)

func (*RunnerInterfaceSSH) SetNodeInterface

func (r *RunnerInterfaceSSH) SetNodeInterface(ctx context.Context, client *kube.KubernetesClient, opts ...SetNodeInterfaceOpt) error

func (*RunnerInterfaceSSH) WithInitOptions

func (r *RunnerInterfaceSSH) WithInitOptions(opts ...kube.InitOpt) *RunnerInterfaceSSH

func (*RunnerInterfaceSSH) WithLoopParams

type RunnerInterfaceSSHLoopsParams

type RunnerInterfaceSSHLoopsParams struct {
	AwaitAvailabilityOverSSH retry.Params
}

type SSHClientOption

type SSHClientOption func(options *SSHClientOptions)

func SSHClientWithForceGoSSH

func SSHClientWithForceGoSSH() SSHClientOption

func SSHClientWithID

func SSHClientWithID(id string) SSHClientOption

func SSHClientWithLoopsParams

func SSHClientWithLoopsParams(params gossh.ClientLoopsParams) SSHClientOption

func SSHClientWithNoInitializeAgent

func SSHClientWithNoInitializeAgent() SSHClientOption

func SSHClientWithStartAfterCreate

func SSHClientWithStartAfterCreate(f bool) SSHClientOption

type SSHClientOptions

type SSHClientOptions struct {
	InitializeNewAgent bool
	ForceGoSSH         bool
	LoopsParams        gossh.ClientLoopsParams
	StartClient        bool
	ClientID           string
}

type SSHProviderInitializer added in v0.3.0

type SSHProviderInitializer interface {
	GetSSHProvider(ctx context.Context) (connection.SSHProvider, error)
}

type SSHProviderInitializerWithCleanup added in v0.3.0

type SSHProviderInitializerWithCleanup interface {
	SSHProviderInitializer
	Cleanup(ctx context.Context) error
}

type SetNodeInterfaceOpt

type SetNodeInterfaceOpt func(opts *SetNodeInterfaceOpts)

func SetNodeInterfaceOptWithNewNodeInterface

func SetNodeInterfaceOptWithNewNodeInterface() SetNodeInterfaceOpt

func SetNodeInterfaceOptWithRunChecks

func SetNodeInterfaceOptWithRunChecks() SetNodeInterfaceOpt

type SetNodeInterfaceOpts

type SetNodeInterfaceOpts struct {
	RunChecks        bool
	NewNodeInterface bool
}

type SimpleKubeProviderInitializer added in v0.3.0

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

func NewSimpleKubeProviderInitializer added in v0.3.0

func NewSimpleKubeProviderInitializer(provider connection.KubeProvider) *SimpleKubeProviderInitializer

func (*SimpleKubeProviderInitializer) Cleanup added in v0.3.0

func (*SimpleKubeProviderInitializer) GetKubeProvider added in v0.3.0

type SimpleSSHProviderInitializer added in v0.3.0

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

func NewSimpleSSHProviderInitializer added in v0.3.0

func NewSimpleSSHProviderInitializer(provider connection.SSHProvider) *SimpleSSHProviderInitializer

func (*SimpleSSHProviderInitializer) Cleanup added in v0.3.0

func (*SimpleSSHProviderInitializer) GetSSHProvider added in v0.3.0

Jump to

Keyboard shortcuts

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