v1

package
v0.31.1 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: Apache-2.0 Imports: 34 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasFieldSelector

func HasFieldSelector(keyAndValues ...string) func(t *testing.T, a interface{})

HasFieldSelector returns a comparable which can be used for asserting that list methods are called with the appropriate field selectors

func HasLabelSelector

func HasLabelSelector(keyAndValues ...string) func(t *testing.T, a interface{})

HasLabelSelector returns a comparable which can be used for asserting that list methods are called with the appropriate label selector

func HasSelector

func HasSelector(labelKeysAndValues []string, fieldKeysAndValue []string) func(t *testing.T, a interface{})

HasSelector returns a comparable which can be used for asserting that list methods are called with the appropriate label and field selectors

Types

type KnServingClient

type KnServingClient interface {

	// Namespace in which this client is operating for
	Namespace() string

	// Get a service by its unique name
	GetService(ctx context.Context, name string) (*servingv1.Service, error)

	// List services
	ListServices(ctx context.Context, opts ...ListConfig) (*servingv1.ServiceList, error)

	// Create a new service
	CreateService(ctx context.Context, service *servingv1.Service) error

	// UpdateService updates the given service. For a more robust variant with automatic
	// conflict resolution see UpdateServiceWithRetry
	UpdateService(ctx context.Context, service *servingv1.Service) (bool, error)

	// UpdateServiceWithRetry updates service and retries if there is a version conflict.
	// The updateFunc receives a deep copy of the existing service and can add update it in
	// place. Return if the service creates a new generation or not
	UpdateServiceWithRetry(ctx context.Context, name string, updateFunc ServiceUpdateFunc, nrRetries int) (bool, error)

	// Apply a service's definition to the cluster. The full service declaration needs to be provided,
	// which is different to UpdateService which can also do a partial update. If the given
	// service does not already exists (identified by name) then the service is create.
	// If the service exists, then a three-way merge will be performed between the original
	// configuration given (from the last "apply" operation), the new configuration as given ]
	// here and the current configuration as found on the cluster.
	// The returned bool indicates whether the service has been changed or whether this operation
	// was a no-op
	// An error can indicate a general error or a conflict that occurred during the three way merge.
	ApplyService(ctx context.Context, service *servingv1.Service) (bool, error)

	// Delete a service by name
	DeleteService(ctx context.Context, name string, timeout time.Duration) error

	// Wait for a service to become ready, but not longer than provided timeout.
	// Return error and how long has been waited
	WaitForService(ctx context.Context, name string, wconfig WaitConfig, msgCallback wait.MessageCallback) (error, time.Duration)

	// Get a configuration by name
	GetConfiguration(ctx context.Context, name string) (*servingv1.Configuration, error)

	// Get a revision by name
	GetRevision(ctx context.Context, name string) (*servingv1.Revision, error)

	// Get the "base" revision for a Service; the one that corresponds to the
	// current template.
	GetBaseRevision(ctx context.Context, service *servingv1.Service) (*servingv1.Revision, error)

	// Create revision
	CreateRevision(ctx context.Context, revision *servingv1.Revision) error

	// Update revision
	UpdateRevision(ctx context.Context, revision *servingv1.Revision) error

	// List revisions
	ListRevisions(ctx context.Context, opts ...ListConfig) (*servingv1.RevisionList, error)

	// Delete a revision
	DeleteRevision(ctx context.Context, name string, timeout time.Duration) error

	// Get a route by its unique name
	GetRoute(ctx context.Context, name string) (*servingv1.Route, error)

	// List routes
	ListRoutes(ctx context.Context, opts ...ListConfig) (*servingv1.RouteList, error)
}

Kn interface to serving. All methods are relative to the namespace specified during construction

func NewKnServingClient

func NewKnServingClient(client clientv1.ServingV1Interface, namespace string) KnServingClient

Create a new client facade for the provided namespace

func NewKnServingGitOpsClient added in v0.20.0

func NewKnServingGitOpsClient(namespace, dir string) KnServingClient

NewKnServingGitOpsClient returns an instance of the kn service gitops client

type ListConfig

type ListConfig func(config *listConfigCollector)

Config function for builder pattern

func WithLabel added in v0.17.2

func WithLabel(labelKey, labelValue string) ListConfig

WithLabel filters on the provided label

func WithName

func WithName(name string) ListConfig

Filter list on the provided name

func WithService

func WithService(service string) ListConfig

Filter on the service name

type ListConfigs

type ListConfigs []ListConfig

type MockKnServingClient

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

func NewMockKnServiceClient

func NewMockKnServiceClient(t *testing.T, ns ...string) *MockKnServingClient

NewMockKnServiceClient returns a new mock instance which you need to record for

func (*MockKnServingClient) ApplyService added in v0.19.0

func (c *MockKnServingClient) ApplyService(ctx context.Context, service *servingv1.Service) (bool, error)

func (*MockKnServingClient) CreateRevision added in v0.19.0

func (c *MockKnServingClient) CreateRevision(ctx context.Context, revision *servingv1.Revision) error

CreateRevision creates a new revision

func (*MockKnServingClient) CreateService

func (c *MockKnServingClient) CreateService(ctx context.Context, service *servingv1.Service) error

func (*MockKnServingClient) DeleteRevision

func (c *MockKnServingClient) DeleteRevision(ctx context.Context, name string, timeout time.Duration) error

func (*MockKnServingClient) DeleteService

func (c *MockKnServingClient) DeleteService(ctx context.Context, name string, timeout time.Duration) error

func (*MockKnServingClient) GetBaseRevision

func (c *MockKnServingClient) GetBaseRevision(ctx context.Context, service *servingv1.Service) (*servingv1.Revision, error)

GetBaseRevision returns the base revision

func (*MockKnServingClient) GetConfiguration

func (c *MockKnServingClient) GetConfiguration(ctx context.Context, name string) (*servingv1.Configuration, error)

GetConfiguration returns a configuration looked up by name

func (*MockKnServingClient) GetRevision

func (c *MockKnServingClient) GetRevision(ctx context.Context, name string) (*servingv1.Revision, error)

func (*MockKnServingClient) GetRoute

func (c *MockKnServingClient) GetRoute(ctx context.Context, name string) (*servingv1.Route, error)

func (*MockKnServingClient) GetService

func (c *MockKnServingClient) GetService(ctx context.Context, name string) (*servingv1.Service, error)

func (*MockKnServingClient) ListRevisions

func (c *MockKnServingClient) ListRevisions(ctx context.Context, opts ...ListConfig) (*servingv1.RevisionList, error)

func (*MockKnServingClient) ListRoutes

func (c *MockKnServingClient) ListRoutes(ctx context.Context, opts ...ListConfig) (*servingv1.RouteList, error)

func (*MockKnServingClient) ListServices

func (c *MockKnServingClient) ListServices(ctx context.Context, opts ...ListConfig) (*servingv1.ServiceList, error)

func (*MockKnServingClient) Namespace

func (c *MockKnServingClient) Namespace() string

Namespace of this client

func (*MockKnServingClient) Recorder

func (c *MockKnServingClient) Recorder() *ServingRecorder

Get the record to start for the recorder

func (*MockKnServingClient) UpdateRevision added in v0.19.0

func (c *MockKnServingClient) UpdateRevision(ctx context.Context, revision *servingv1.Revision) error

UpdateRevision updates given revision

func (*MockKnServingClient) UpdateService

func (c *MockKnServingClient) UpdateService(ctx context.Context, service *servingv1.Service) (bool, error)

func (*MockKnServingClient) UpdateServiceWithRetry

func (c *MockKnServingClient) UpdateServiceWithRetry(ctx context.Context, name string, updateFunc ServiceUpdateFunc, maxRetry int) (bool, error)

Delegate to shared retry method

func (*MockKnServingClient) WaitForRevision added in v0.25.0

func (c *MockKnServingClient) WaitForRevision(ctx context.Context, name string, timeout time.Duration, msgCallback wait.MessageCallback) (error, time.Duration)

func (*MockKnServingClient) WaitForService

func (c *MockKnServingClient) WaitForService(ctx context.Context, name string, wconfig WaitConfig, msgCallback wait.MessageCallback) (error, time.Duration)

type NoBaseRevisionError

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

func (NoBaseRevisionError) Error

func (e NoBaseRevisionError) Error() string

type ServiceUpdateFunc added in v0.18.0

type ServiceUpdateFunc func(origService *servingv1.Service) (*servingv1.Service, error)

Func signature for an updating function which returns the updated service object or an error

type ServingRecorder

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

recorder for service

func (*ServingRecorder) ApplyService added in v0.19.0

func (sr *ServingRecorder) ApplyService(service interface{}, hasChanged bool, err error)

Update the given service

func (*ServingRecorder) CreateRevision added in v0.19.0

func (sr *ServingRecorder) CreateRevision(revision interface{}, err error)

CreateRevision records a call CreateRevision

func (*ServingRecorder) CreateService

func (sr *ServingRecorder) CreateService(service interface{}, err error)

Create a new service

func (*ServingRecorder) DeleteRevision

func (sr *ServingRecorder) DeleteRevision(name, timeout interface{}, err error)

Delete a revision

func (*ServingRecorder) DeleteService

func (sr *ServingRecorder) DeleteService(name, timeout interface{}, err error)

Delete a service by name

func (*ServingRecorder) GetConfiguration

func (sr *ServingRecorder) GetConfiguration(name string, config *servingv1.Configuration, err error)

GetConfiguration records a call to GetConfiguration with possible return values

func (*ServingRecorder) GetRevision

func (sr *ServingRecorder) GetRevision(name interface{}, revision *servingv1.Revision, err error)

Get a revision by name

func (*ServingRecorder) GetRoute

func (sr *ServingRecorder) GetRoute(name interface{}, route *servingv1.Route, err error)

Get a route by its unique name

func (*ServingRecorder) GetService

func (sr *ServingRecorder) GetService(name interface{}, service *servingv1.Service, err error)

Get Service

func (*ServingRecorder) ListRevisions

func (sr *ServingRecorder) ListRevisions(opts interface{}, revisionList *servingv1.RevisionList, err error)

List revisions

func (*ServingRecorder) ListRoutes

func (sr *ServingRecorder) ListRoutes(opts interface{}, routeList *servingv1.RouteList, err error)

List routes

func (*ServingRecorder) ListServices

func (sr *ServingRecorder) ListServices(opts interface{}, serviceList *servingv1.ServiceList, err error)

List services

func (*ServingRecorder) UpdateRevision added in v0.19.0

func (sr *ServingRecorder) UpdateRevision(revision interface{}, err error)

UpdateRevision records a call UpdateRevision

func (*ServingRecorder) UpdateService

func (sr *ServingRecorder) UpdateService(service interface{}, hasChanged bool, err error)

Update the given service

func (*ServingRecorder) Validate

func (sr *ServingRecorder) Validate()

Check that every recorded method has been called

func (*ServingRecorder) WaitForRevision added in v0.25.0

func (sr *ServingRecorder) WaitForRevision(name interface{}, timeout interface{}, callback interface{}, err error, duration time.Duration)

Wait for a revision to become ready, but not longer than provided timeout

func (*ServingRecorder) WaitForService

func (sr *ServingRecorder) WaitForService(name interface{}, wconfig interface{}, callback interface{}, err error, duration time.Duration)

Wait for a service to become ready, but not longer than provided timeout

type WaitConfig added in v0.31.0

type WaitConfig struct {
	Timeout     time.Duration
	ErrorWindow time.Duration
}

Jump to

Keyboard shortcuts

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