Documentation ¶
Index ¶
- func HasFieldSelector(keyAndValues ...string) func(t *testing.T, a interface{})
- func HasLabelSelector(keyAndValues ...string) func(t *testing.T, a interface{})
- func HasSelector(labelKeysAndValues []string, fieldKeysAndValue []string) func(t *testing.T, a interface{})
- type KnServingClient
- type ListConfig
- type ListConfigs
- type MockKnServingClient
- func (c *MockKnServingClient) ApplyService(ctx context.Context, service *servingv1.Service) (bool, error)
- func (c *MockKnServingClient) CreateRevision(ctx context.Context, revision *servingv1.Revision) error
- func (c *MockKnServingClient) CreateService(ctx context.Context, service *servingv1.Service) error
- func (c *MockKnServingClient) DeleteRevision(ctx context.Context, name string, timeout time.Duration) error
- func (c *MockKnServingClient) DeleteService(ctx context.Context, name string, timeout time.Duration) error
- func (c *MockKnServingClient) GetBaseRevision(ctx context.Context, service *servingv1.Service) (*servingv1.Revision, error)
- func (c *MockKnServingClient) GetConfiguration(ctx context.Context, name string) (*servingv1.Configuration, error)
- func (c *MockKnServingClient) GetRevision(ctx context.Context, name string) (*servingv1.Revision, error)
- func (c *MockKnServingClient) GetRoute(ctx context.Context, name string) (*servingv1.Route, error)
- func (c *MockKnServingClient) GetService(ctx context.Context, name string) (*servingv1.Service, error)
- func (c *MockKnServingClient) ListRevisions(ctx context.Context, opts ...ListConfig) (*servingv1.RevisionList, error)
- func (c *MockKnServingClient) ListRoutes(ctx context.Context, opts ...ListConfig) (*servingv1.RouteList, error)
- func (c *MockKnServingClient) ListServices(ctx context.Context, opts ...ListConfig) (*servingv1.ServiceList, error)
- func (c *MockKnServingClient) Namespace() string
- func (c *MockKnServingClient) Recorder() *ServingRecorder
- func (c *MockKnServingClient) UpdateRevision(ctx context.Context, revision *servingv1.Revision) error
- func (c *MockKnServingClient) UpdateService(ctx context.Context, service *servingv1.Service) (bool, error)
- func (c *MockKnServingClient) UpdateServiceWithRetry(ctx context.Context, name string, updateFunc ServiceUpdateFunc, maxRetry int) (bool, error)
- func (c *MockKnServingClient) WaitForRevision(ctx context.Context, name string, timeout time.Duration, ...) (error, time.Duration)
- func (c *MockKnServingClient) WaitForService(ctx context.Context, name string, wconfig WaitConfig, ...) (error, time.Duration)
- type NoBaseRevisionError
- type ServiceUpdateFunc
- type ServingRecorder
- func (sr *ServingRecorder) ApplyService(service interface{}, hasChanged bool, err error)
- func (sr *ServingRecorder) CreateRevision(revision interface{}, err error)
- func (sr *ServingRecorder) CreateService(service interface{}, err error)
- func (sr *ServingRecorder) DeleteRevision(name, timeout interface{}, err error)
- func (sr *ServingRecorder) DeleteService(name, timeout interface{}, err error)
- func (sr *ServingRecorder) GetConfiguration(name string, config *servingv1.Configuration, err error)
- func (sr *ServingRecorder) GetRevision(name interface{}, revision *servingv1.Revision, err error)
- func (sr *ServingRecorder) GetRoute(name interface{}, route *servingv1.Route, err error)
- func (sr *ServingRecorder) GetService(name interface{}, service *servingv1.Service, err error)
- func (sr *ServingRecorder) ListRevisions(opts interface{}, revisionList *servingv1.RevisionList, err error)
- func (sr *ServingRecorder) ListRoutes(opts interface{}, routeList *servingv1.RouteList, err error)
- func (sr *ServingRecorder) ListServices(opts interface{}, serviceList *servingv1.ServiceList, err error)
- func (sr *ServingRecorder) UpdateRevision(revision interface{}, err error)
- func (sr *ServingRecorder) UpdateService(service interface{}, hasChanged bool, err error)
- func (sr *ServingRecorder) Validate()
- func (sr *ServingRecorder) WaitForRevision(name interface{}, timeout interface{}, callback interface{}, err error, ...)
- func (sr *ServingRecorder) WaitForService(name interface{}, wconfig interface{}, callback interface{}, err error, ...)
- type WaitConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HasFieldSelector ¶
HasFieldSelector returns a comparable which can be used for asserting that list methods are called with the appropriate field selectors
func HasLabelSelector ¶
HasLabelSelector returns a comparable which can be used for asserting that list methods are called with the appropriate label selector
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 ¶
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 ¶
func WithLabel(labelKey, labelValue string) ListConfig
WithLabel filters on the provided label
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 ¶
func (*MockKnServingClient) CreateRevision ¶
func (c *MockKnServingClient) CreateRevision(ctx context.Context, revision *servingv1.Revision) error
CreateRevision creates a new revision
func (*MockKnServingClient) CreateService ¶
func (*MockKnServingClient) DeleteRevision ¶
func (*MockKnServingClient) DeleteService ¶
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 (*MockKnServingClient) GetService ¶
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 ¶
func (c *MockKnServingClient) UpdateRevision(ctx context.Context, revision *servingv1.Revision) error
UpdateRevision updates given revision
func (*MockKnServingClient) UpdateService ¶
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 ¶
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 ¶
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 ¶
func (sr *ServingRecorder) ApplyService(service interface{}, hasChanged bool, err error)
Update the given service
func (*ServingRecorder) CreateRevision ¶
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 ¶
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 ¶
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