image

package
v1.16.6 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

README

Image

Purpose

pkg/handler/image is the image-specific handler client.

It is one of the biggest outliers in the handler graph because it is mostly provider-backed rather than CRD-backed. The package does not primarily manage a stored Kubernetes image resource. Instead it coordinates image import, query, deletion, visibility, and snapshot-adjacent metadata through the provider layer.

It therefore sits closer to the provider image-policy surface than to the normal CRUD-over-CRD pattern used by many other handlers.

Distinctive Behaviour

  • v1 image list/create/delete flows are organization- and region-scoped
  • v2 image query is flatter and provider-query-driven
  • import validates the remote image by peeking the MBR and currently requires a raw-format style bootable image
  • image provenance and ownership semantics are carried through tags and organization scoping
  • delete enforces ownership visibility and surfaces “still in use” conflicts

Invariants And Guard Rails

  • Region access is enforced via region.CheckAccess for all image operations (v1 list/create/delete and v2 query), preventing access to regions the caller cannot see.
  • Image visibility is provider-mediated, not inferred from CRD ancestry.
  • Imported images are tagged to distinguish provenance and organization ownership.
  • Delete only succeeds for images effectively owned by the caller's organization.
  • v2 query semantics are intentionally driven through provider query interfaces rather than reimplementing image indexing locally.

Caveats

  • This package inherits the image-origin/tag design smell already documented in ../../constants: tags are carrying semantics that would be cleaner as typed API fields.
  • Import validation is intentionally narrow and conservative at present.
  • Because images are mostly provider-backed, this package is not a good example of the normal CRD-centric handler pattern.

Cross-Package Context

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConvertImage = convertImage

Export this so it can be used for server snapshot.

View Source
var ErrFailedImageFetch = goerrors.New("image fetch failed")
View Source
var ErrProviderResource = goerrors.New("conflict with resource at provider")
View Source
var ErrUnknownDiskFormat = errors.New("unknown image format")

Functions

func GenerateTags added in v1.14.0

func GenerateTags(requestTags *coreapi.TagList, extra map[string]string) map[string]string

Types

type Client

type Client struct {
	common.ClientArgs
}

func NewClient

func NewClient(clientArgs common.ClientArgs) *Client

func (*Client) CreateImage added in v1.12.0

func (c *Client) CreateImage(ctx context.Context, organizationID, regionID string, request *openapi.ImageCreateRequest) (*openapi.ImageResponse, error)

func (*Client) DeleteImage added in v1.12.0

func (c *Client) DeleteImage(ctx context.Context, organizationID, regionID, imageID string) error

func (*Client) ListImages

func (c *Client) ListImages(ctx context.Context, organizationID, regionID string) (openapi.Images, error)

func (*Client) QueryImages added in v1.14.0

func (c *Client) QueryImages(ctx context.Context, regionID string, params openapi.GetApiV2RegionsRegionIDImagesParams) (openapi.Images, error)

QueryImages takes the parameters from an image list request and runs them as a query against the provider.

Directories

Path Synopsis
Code generated by MockGen.
Code generated by MockGen.

Jump to

Keyboard shortcuts

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