Documentation
¶
Overview ¶
Package client provides the Runtime SDK client.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtensionNameFromHandlerName ¶ added in v1.5.2
ExtensionNameFromHandlerName extracts the extension name from the canonical name of a registered runtime extension handler.
func NameForHandler ¶ added in v1.5.2
func NameForHandler(handler runtimehooksv1.ExtensionHandler, extensionConfig *runtimev1.ExtensionConfig) (string, error)
NameForHandler constructs a canonical name for a registered runtime extension handler.
Types ¶
type CallExtensionCacheEntry ¶ added in v1.8.7
type CallExtensionCacheEntry struct { CacheKey string Response runtimehooksv1.ResponseObject }
CallExtensionCacheEntry is a cache entry for the cache that can be used with the CallExtension call via the WithCaching option.
func (CallExtensionCacheEntry) Key ¶ added in v1.8.7
func (c CallExtensionCacheEntry) Key() string
Key returns the cache key of a CallExtensionCacheEntry.
type CallExtensionOption ¶ added in v1.8.7
type CallExtensionOption interface { // ApplyToOptions applies this configuration to the given CallExtensionOptions. ApplyToOptions(*CallExtensionOptions) }
CallExtensionOption is the interface for configuration that modifies CallExtensionOptions for a CallExtension call.
type CallExtensionOptions ¶ added in v1.8.7
type CallExtensionOptions struct { WithCaching bool Cache cache.Cache[CallExtensionCacheEntry] CacheKeyFunc func(*runtimeregistry.ExtensionRegistration, runtimehooksv1.RequestObject) string }
CallExtensionOptions contains the options for the CallExtension call.
type Client ¶
type Client interface { // WarmUp can be used to initialize a "cold" RuntimeClient with all // known runtimev1.ExtensionConfigs at a given time. // After WarmUp completes the RuntimeClient is considered ready. WarmUp(extensionConfigList *runtimev1.ExtensionConfigList) error // IsReady return true after the RuntimeClient finishes warmup. IsReady() bool // Discover makes the discovery call on the extension and returns an updated ExtensionConfig // with extension handlers information in the ExtensionConfig status. Discover(context.Context, *runtimev1.ExtensionConfig) (*runtimev1.ExtensionConfig, error) // Register registers the ExtensionConfig. Register(extensionConfig *runtimev1.ExtensionConfig) error // Unregister unregisters the ExtensionConfig. Unregister(extensionConfig *runtimev1.ExtensionConfig) error // CallAllExtensions calls all the ExtensionHandler registered for the hook. CallAllExtensions(ctx context.Context, hook runtimecatalog.Hook, forObject metav1.Object, request runtimehooksv1.RequestObject, response runtimehooksv1.ResponseObject) error // CallExtension calls the ExtensionHandler with the given name. CallExtension(ctx context.Context, hook runtimecatalog.Hook, forObject metav1.Object, name string, request runtimehooksv1.RequestObject, response runtimehooksv1.ResponseObject, opts ...CallExtensionOption) error }
Client is the runtime client to interact with extensions.
type Options ¶
type Options struct { Catalog *runtimecatalog.Catalog Registry runtimeregistry.ExtensionRegistry Client ctrlclient.Client }
Options are creation options for a Client.
type WithCaching ¶ added in v1.8.7
type WithCaching struct { Cache cache.Cache[CallExtensionCacheEntry] CacheKeyFunc func(*runtimeregistry.ExtensionRegistration, runtimehooksv1.RequestObject) string }
WithCaching enables caching for the CallExtension call.
func (WithCaching) ApplyToOptions ¶ added in v1.8.7
func (w WithCaching) ApplyToOptions(in *CallExtensionOptions)
ApplyToOptions applies WithCaching to the given CallExtensionOptions.