Help us shape the future of Go! Take the 2026 Go Developer Survey

image

package
v1.26.1 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 24 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 for all image operations against the request organization: region.CheckAccess for v1 list/create/delete, and region.AllowedOrganizations on the organizationID filter for the v2 query. A v2 query without a filter returns only global images and needs the region visible to any of the caller's organizations. See the region package README.
  • 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 identityids.OrganizationID, regionID regionids.RegionID, request *openapi.ImageCreateRequest) (*openapi.ImageResponse, error)

func (*Client) DeleteImage added in v1.12.0

func (c *Client) DeleteImage(ctx context.Context, organizationID identityids.OrganizationID, regionID regionids.RegionID, imageID regionids.ImageID) error

func (*Client) ListImages

func (c *Client) ListImages(ctx context.Context, organizationID identityids.OrganizationID, regionID regionids.RegionID) (openapi.Images, error)

func (*Client) QueryImages added in v1.14.0

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