apiutil

package
v0.30.5 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: Apache-2.0 Imports: 16 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectImageInfo added in v0.25.13

func CollectImageInfo(kc client.Client, pod *core.Pod, images map[string]kmapi.ImageInfo, fullLineage bool) (map[string]kmapi.ImageInfo, error)

func CollectPullCredentials added in v0.25.15

func CollectPullCredentials(pod *core.Pod, refs map[string]kmapi.PullCredentials) (map[string]kmapi.PullCredentials, error)

func DetectLineage added in v0.25.13

func DetectLineage(ctx context.Context, kc client.Client, obj client.Object) ([]kmapi.ObjectInfo, error)

func GetImageRef added in v0.25.13

func GetImageRef(containerImage, statusImage, statusImageID string) (string, error)

Types

type Cachable

type Cachable interface {
	GVK(gvk schema.GroupVersionKind) (bool, error)
	GVR(gvr schema.GroupVersionResource) (bool, error)
}

func NewCachable

func NewCachable(cl discovery.DiscoveryInterface) (Cachable, error)

func NewDynamicCachable

func NewDynamicCachable(cfg *rest.Config, opts ...DynamicCachableOption) (Cachable, error)

NewDynamicCachable returns a dynamic Cachable for cfg. The dynamic Cachable dynamically discovers resource types at runtime. opts configure the Cachable.

type DynamicCachableOption

type DynamicCachableOption func(*dynamicCachable) error

DynamicCachableOption is a functional option on the dynamicCachable

var WithLazyDiscovery DynamicCachableOption = func(drm *dynamicCachable) error {
	drm.lazy = true
	return nil
}

WithLazyDiscovery prevents the Cachable from discovering REST mappings until an API call is made.

func WithCustomCachable

func WithCustomCachable(newCachable func() (Cachable, error)) DynamicCachableOption

WithCustomCachable supports setting a custom Cachable refresher instead of the default method, which uses a discovery client.

This exists mainly for testing, but can be useful if you need tighter control over how discovery is performed, which discovery endpoints are queried, etc.

func WithLimiter

func WithLimiter(lim *rate.Limiter) DynamicCachableOption

WithLimiter sets the Cachable's underlying limiter to lim.

Jump to

Keyboard shortcuts

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