bundle

package
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2020 License: Apache-2.0 Imports: 13 Imported by: 16

Documentation

Index

Constants

View Source
const (
	DefaultPermission   = 0644
	RegistryV1Type      = "registry+v1"
	PlainType           = "plain"
	HelmType            = "helm"
	AnnotationsFile     = "annotations.yaml"
	DockerFile          = "Dockerfile"
	ManifestsDir        = "manifests/"
	MetadataDir         = "metadata/"
	ManifestsLabel      = "operators.operatorframework.io.bundle.manifests.v1"
	MetadataLabel       = "operators.operatorframework.io.bundle.metadata.v1"
	MediatypeLabel      = "operators.operatorframework.io.bundle.mediatype.v1"
	PackageLabel        = "operators.operatorframework.io.bundle.package.v1"
	ChannelsLabel       = "operators.operatorframework.io.bundle.channels.v1"
	ChannelDefaultLabel = "operators.operatorframework.io.bundle.channel.default.v1"
)

Variables

This section is empty.

Functions

func BuildBundleImage

func BuildBundleImage(directory, imageTag, imageBuilder string) (*exec.Cmd, error)

Create build command to build bundle manifests image

func BuildFunc

func BuildFunc(directory, imageTag, imageBuilder, packageName, channels, channelDefault string, overwrite bool) error

BuildFunc is used to build bundle container image from a list of manifests that exist in local directory and it also generates Dockerfile annotations.yaml which contains media type, package name and channels information if the file doesn't exist locally. Inputs: @directory: The local directory where bundle manifests and metadata are located @imageTag: The image tag that is applied to the bundle image @imageBuilder: The image builder tool that is used to build container image (docker, buildah or podman) @packageName: The name of the package that bundle image belongs to @channels: The list of channels that bundle image belongs to @channelDefault: The default channel for the bundle image @overwrite: Boolean flag to enable overwriting annotations.yaml locally if existed

func ExecuteCommand

func ExecuteCommand(cmd *exec.Cmd) error

func GenerateAnnotations

func GenerateAnnotations(mediaType, manifests, metadata, packageName, channels, channelDefault string) ([]byte, error)

GenerateAnnotations builds annotations.yaml with mediatype, manifests & metadata directories in bundle image, package name, channels and default channels information.

func GenerateDockerfile

func GenerateDockerfile(mediaType, manifests, metadata, packageName, channels, channelDefault string) ([]byte, error)

GenerateDockerfile builds Dockerfile with mediatype, manifests & metadata directories in bundle image, package name, channels and default channels information in LABEL section.

func GenerateFunc

func GenerateFunc(directory, packageName, channels, channelDefault string, overwrite bool) error

GenerateFunc builds annotations.yaml with mediatype, manifests & metadata directories in bundle image, package name, channels and default channels information and then writes the file to `/metadata` directory. Inputs: @directory: The local directory where bundle manifests and metadata are located @packageName: The name of the package that bundle image belongs to @channels: The list of channels that bundle image belongs to @channelDefault: The default channel for the bundle image @overwrite: Boolean flag to enable overwriting annotations.yaml locally if existed

func GetMediaType

func GetMediaType(directory string) (string, error)

GetMediaType determines mediatype from files (yaml) in given directory Currently able to detect helm chart, registry+v1 (CSV) and plain k8s resources such as CRD.

func ValidateAnnotations

func ValidateAnnotations(existing, expected []byte) error

ValidateAnnotations validates existing annotations.yaml against generated annotations.yaml to ensure existing annotations.yaml contains expected values.

func ValidateChannelDefault added in v1.5.0

func ValidateChannelDefault(channels, channelDefault string) (string, error)

ValidateChannelDefault validates provided default channel to ensure it exists in provided channel list.

func WriteFile

func WriteFile(fileName, directory string, content []byte) error

Write `fileName` file with `content` into a `directory` Note: Will overwrite the existing `fileName` file if it exists

Types

type AnnotationMetadata

type AnnotationMetadata struct {
	Annotations map[string]string `yaml:"annotations"`
}

type BundleImageValidator

type BundleImageValidator interface {
	// PullBundleImage takes an imageTag to pull and a directory to push
	// the contents of the image to
	PullBundleImage(imageTag string, directory string) error
	// Validate bundle takes a directory containing the contents of a bundle image
	// and validates that the format is correct
	ValidateBundle(directory string) error
}

BundleImageValidator provides a toolset for pulling and then validating bundle container images

func NewImageValidator

func NewImageValidator(containerTool string, logger *logrus.Entry) BundleImageValidator

NewImageValidator is a constructor that returns an ImageValidator

type ValidationError

type ValidationError struct {
	AnnotationErrors []error
	FormatErrors     []error
}

ValidationError is an imlementation of the Error type that defines a set of errors when validating the bundle

func NewValidationError

func NewValidationError(annotationErrs, formatErrs []error) ValidationError

func (ValidationError) Error

func (v ValidationError) Error() string

Jump to

Keyboard shortcuts

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