ocm-downloadhandlers

Description

A download handler can be used to process resources to be downloaded from on OCM repository. By default, the blobs provided from the access method (see ocm ocm-accessmethods) are used to store the resource content in the local filesystem. Download handlers can be used to tweak this process. They get access to the blob content and decide on their own what to do with it, or how to transform it into files stored in the file system.

For example, a pre-registered helm download handler will store OCI-based helm artifacts as regular helm archives in the local file system.

Handler Registration

Programmatically any kind of handlers can be registered for various download conditions. But this feature is available as command-line option, also. New handlers can be provided by plugins. In general available handlers, plugin-based or as part of the CLI coding are nameable using an hierarchical namespace. Those names can be used by a –downloader option to register handlers for various conditions for CLI commands like ocm download resources (implicitly registered download handlers can be enabled using the option -d).

Besides the activation constraints (resource type and media type of the resource blob), it is possible to pass handler configuration controlling the exact behaviour of the handler for selected artifacts.

The following handler names are possible:

  • ocm/dirtree: downloading directory tree-like resources

    The dirtree downloader is able to download directory-tree like resources as directory structure (default) or archive. The following artifact media types are supported:

    • application/vnd.oci.image.manifest.v1+tar+gzip
    • application/x-tgz
    • application/x-tar+gzip
    • application/x-tar

    By default, it is registered for the following resource types:

    • directoryTree
    • filesystem

    It accepts a config with the following fields:

    • asArchive: flag to request an archive download
    • ociConfigTypes: a list of accepted OCI config archive mime types defaulted by application/vnd.oci.image.config.v1+json.
  • oci/artifact: uploading an OCI artifact to an OCI registry

    The artifact downloader is able to transfer OCI artifact-like resources into an OCI registry given by the combination of the download target and the registration config.

    If no config is given, the target must be an OCI reference with a potentially omitted repository. The repo part is derived from the reference hint provided by the resource’s access specification.

    If the config is given, the target is used as repository name prefixed with an optional repository prefix given by the configuration.

    The following artifact media types are supported:

    • application/vnd.oci.image.manifest.v1+tar+gzip
    • application/vnd.oci.image.index.v1+tar+gzip

    It accepts a config with the following fields:

    • namespacePrefix: a namespace prefix used for the uploaded artifacts
    • ociRef: an OCI repository reference
    • repository: an OCI repository specification for the target OCI registry
  • plugin: [downloaders provided by plugins]

    sub namespace of the form <plugin name>/<handler>

  • landscaper/blueprint: uploading an OCI artifact to an OCI registry

    The artifact downloader is able to transfer OCI artifact-like resources into an OCI registry given by the combination of the download target and the registration config.

    If no config is given, the target must be an OCI reference with a potentially omitted repository. The repo part is derived from the reference hint provided by the resource’s access specification.

    If the config is given, the target is used as repository name prefixed with an optional repository prefix given by the configuration.

    The following artifact media types are supported:

    • application/vnd.docker.distribution.manifest.v2+tar
    • application/vnd.docker.distribution.manifest.v2+tar+gzip
    • application/vnd.gardener.landscaper.blueprint.layer.v1.tar
    • application/vnd.gardener.landscaper.blueprint.layer.v1.tar+gzip
    • application/vnd.gardener.landscaper.blueprint.v1+tar
    • application/vnd.gardener.landscaper.blueprint.v1+tar+gzip
    • application/vnd.oci.image.manifest.v1+tar
    • application/vnd.oci.image.manifest.v1+tar+gzip
    • application/x-tar
    • application/x-tar+gzip
    • application/x-tgz

    It accepts a config with the following fields:

    • ociConfigTypes: a list of accepted OCI config archive mime types defaulted by application/vnd.gardener.landscaper.blueprint.config.v1.

    This handler is by default registered for the following artifact types: landscaper.gardener.cloud/blueprint,blueprint

See ocm ocm-downloadhandlers for further details on using download handlers.

See Also