Documentation
¶
Index ¶
- func ConvertImageRegistryOverrideStringToMap(envVar string) map[string][]string
- func ConvertOpenShiftImageRegistryOverridesToCommandLineFlag(registryOverrides map[string][]string) string
- func ConvertRegistryOverridesToCommandLineFlag(registryOverrides map[string]string) string
- func GetControlPlaneOperatorImage(ctx context.Context, hc *hyperv1.HostedCluster, ...) (string, error)
- func GetControlPlaneOperatorImageLabels(ctx context.Context, hc *hyperv1.HostedCluster, ...) (map[string]string, error)
- func GetPayloadImage(ctx context.Context, releaseImageProvider releaseinfo.Provider, ...) (string, error)
- func GetPayloadImageFromRelease(ctx context.Context, releaseImageProvider releaseinfo.Provider, release string, ...) (string, error)
- func GetPayloadVersion(ctx context.Context, releaseImageProvider releaseinfo.Provider, ...) (*semver.Version, error)
- func GetRegistryOverrides(ctx context.Context, ref reference.DockerImageReference, source, mirror string) (*reference.DockerImageReference, bool, error)
- func GetRepoSetup(ctx context.Context, imageRef string, pullSecret []byte) (distribution.Repository, *reference.DockerImageReference, error)
- func HCControlPlaneReleaseImage(hcluster *hyperv1.HostedCluster) string
- func HCPControlPlaneReleaseImage(hcp *hyperv1.HostedControlPlane) string
- func ImageLabels(metadata *dockerv1client.DockerImageConfig) map[string]string
- func LookupMappedImage(ctx context.Context, ocpOverrides map[string][]string, image string, ...) (string, error)
- type GetMetadataFn
- type ImageMetadataProvider
- type MirrorAvailabilityCache
- type RegistryClientImageMetadataProvider
- func (r *RegistryClientImageMetadataProvider) GetDigest(ctx context.Context, imageRef string, pullSecret []byte) (digest.Digest, *reference.DockerImageReference, error)
- func (r *RegistryClientImageMetadataProvider) GetManifest(ctx context.Context, imageRef string, pullSecret []byte) (distribution.Manifest, error)
- func (r *RegistryClientImageMetadataProvider) GetMetadata(ctx context.Context, imageRef string, pullSecret []byte) (*dockerv1client.DockerImageConfig, []distribution.Descriptor, ...)
- func (r *RegistryClientImageMetadataProvider) GetOverride(ctx context.Context, imageRef string, pullSecret []byte) (*reference.DockerImageReference, error)
- func (r *RegistryClientImageMetadataProvider) ImageMetadata(ctx context.Context, imageRef string, pullSecret []byte) (*dockerv1client.DockerImageConfig, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertImageRegistryOverrideStringToMap ¶
ConvertImageRegistryOverrideStringToMap translates the environment variable containing registry source to mirror mappings back to a map[string]string structure that can be ingested by the registry image content policies release provider
func ConvertOpenShiftImageRegistryOverridesToCommandLineFlag ¶
func ConvertOpenShiftImageRegistryOverridesToCommandLineFlag(registryOverrides map[string][]string) string
ConvertOpenShiftImageRegistryOverridesToCommandLineFlag converts a map of image registry sources and their mirrors into a string
func ConvertRegistryOverridesToCommandLineFlag ¶
ConvertRegistryOverridesToCommandLineFlag converts a map of registry sources and their mirrors into a string
func GetControlPlaneOperatorImage ¶
func GetControlPlaneOperatorImage(ctx context.Context, hc *hyperv1.HostedCluster, releaseProvider releaseinfo.Provider, hypershiftOperatorImage string, pullSecret []byte) (string, error)
GetControlPlaneOperatorImage resolves the appropriate control plane operator image based on the following order of precedence (from most to least preferred):
- The image specified by the ControlPlaneOperatorImageAnnotation on the HostedCluster resource itself
- The hypershift image specified in the release payload indicated by the HostedCluster's release field
- The hypershift-operator's own image for release versions 4.9 and 4.10
- The registry.ci.openshift.org/hypershift/hypershift:4.8 image for release version 4.8
If no image can be found according to these rules, an error is returned.
func GetControlPlaneOperatorImageLabels ¶
func GetControlPlaneOperatorImageLabels(ctx context.Context, hc *hyperv1.HostedCluster, controlPlaneOperatorImage string, pullSecret []byte, imageMetadataProvider ImageMetadataProvider) (map[string]string, error)
GetControlPlaneOperatorImageLabels resolves the appropriate control plane operator image labels based on the following order of precedence (from most to least preferred):
- The labels specified by the ControlPlaneOperatorImageLabelsAnnotation on the HostedCluster resource itself
- The image labels in the medata of the image as resolved by GetControlPlaneOperatorImage
func GetPayloadImage ¶
func GetPayloadImage(ctx context.Context, releaseImageProvider releaseinfo.Provider, hc *hyperv1.HostedCluster, component string, pullSecret []byte) (string, error)
func GetPayloadVersion ¶
func GetPayloadVersion(ctx context.Context, releaseImageProvider releaseinfo.Provider, hc *hyperv1.HostedCluster, pullSecret []byte) (*semver.Version, error)
func GetRegistryOverrides ¶
func GetRegistryOverrides(ctx context.Context, ref reference.DockerImageReference, source, mirror string) (*reference.DockerImageReference, bool, error)
func GetRepoSetup ¶
func GetRepoSetup(ctx context.Context, imageRef string, pullSecret []byte) (distribution.Repository, *reference.DockerImageReference, error)
GetRepoSetup connects to a repo and pulls the imageRef's docker image information from the repo. Returns the repo and the docker image.
func HCControlPlaneReleaseImage ¶
func HCControlPlaneReleaseImage(hcluster *hyperv1.HostedCluster) string
func HCPControlPlaneReleaseImage ¶
func HCPControlPlaneReleaseImage(hcp *hyperv1.HostedControlPlane) string
func ImageLabels ¶
func ImageLabels(metadata *dockerv1client.DockerImageConfig) map[string]string
ImageLabels returns labels on a given image metadata. Labels may be recorded on either Config or ContainerConfig depending on how the image was built, so fall back to ContainerConfig when Config carries no labels. Returning Config.Labels unconditionally (even when nil) would silently drop labels that live on ContainerConfig, which can turn a present capability label into a spurious "absent" and, for the AWS default worker security group capability, flip an AWSMachineTemplate hash and roll all workers (OCPBUGS-105464).
func LookupMappedImage ¶
func LookupMappedImage(ctx context.Context, ocpOverrides map[string][]string, image string, pullSecretBytes []byte, getMetadataFn GetMetadataFn) (string, error)
LookupMappedImage looks up a mapped image based on OCP overrides by allowing tests to control the image availability check without reaching out to actual registries
Types ¶
type GetMetadataFn ¶
type GetMetadataFn func(context.Context, string, []byte) (*dockerv1client.DockerImageConfig, []distribution.Descriptor, distribution.BlobStore, error)
GetMetadataFn is a function type for checking image availability It takes a context, image reference, and pull secret, and returns image metadata or an error
type ImageMetadataProvider ¶
type ImageMetadataProvider interface {
ImageMetadata(ctx context.Context, imageRef string, pullSecret []byte) (*dockerv1client.DockerImageConfig, error)
GetManifest(ctx context.Context, imageRef string, pullSecret []byte) (distribution.Manifest, error)
GetDigest(ctx context.Context, imageRef string, pullSecret []byte) (digest.Digest, *reference.DockerImageReference, error)
GetMetadata(ctx context.Context, imageRef string, pullSecret []byte) (*dockerv1client.DockerImageConfig, []distribution.Descriptor, distribution.BlobStore, error)
GetOverride(ctx context.Context, imageRef string, pullSecret []byte) (*reference.DockerImageReference, error)
}
type MirrorAvailabilityCache ¶
type MirrorAvailabilityCache struct {
// contains filtered or unexported fields
}
MirrorAvailabilityCache caches mirror availability results to prevent flapping
type RegistryClientImageMetadataProvider ¶
type RegistryClientImageMetadataProvider struct {
OpenShiftImageRegistryOverrides map[string][]string
// contains filtered or unexported fields
}
func (*RegistryClientImageMetadataProvider) GetDigest ¶
func (r *RegistryClientImageMetadataProvider) GetDigest(ctx context.Context, imageRef string, pullSecret []byte) (digest.Digest, *reference.DockerImageReference, error)
func (*RegistryClientImageMetadataProvider) GetManifest ¶
func (r *RegistryClientImageMetadataProvider) GetManifest(ctx context.Context, imageRef string, pullSecret []byte) (distribution.Manifest, error)
GetManifest returns the manifest for a given image using the given pull secret to authenticate. The ICSPs/IDMSs are checked first for overrides and then the cache is checked using the image pull spec. If not found in the cache, the manifest is looked up and added to the cache.
func (*RegistryClientImageMetadataProvider) GetMetadata ¶
func (r *RegistryClientImageMetadataProvider) GetMetadata(ctx context.Context, imageRef string, pullSecret []byte) (*dockerv1client.DockerImageConfig, []distribution.Descriptor, distribution.BlobStore, error)
func (*RegistryClientImageMetadataProvider) GetOverride ¶
func (r *RegistryClientImageMetadataProvider) GetOverride(ctx context.Context, imageRef string, pullSecret []byte) (*reference.DockerImageReference, error)
GetOverride returns the image reference override based on the source/mirrors in the ICSPs/IDMSs
func (*RegistryClientImageMetadataProvider) ImageMetadata ¶
func (r *RegistryClientImageMetadataProvider) ImageMetadata(ctx context.Context, imageRef string, pullSecret []byte) (*dockerv1client.DockerImageConfig, error)
ImageMetadata returns metadata for a given image using the given pull secret to authenticate. The ICSPs/IDMSs are checked first for overrides and then the cache is checked using the image pull spec. If not found in the cache, the manifest is looked up and added to the cache.