Documentation ¶
Index ¶
- Constants
- func BuildBundleImage(directory, imageTag, imageBuilder string) (*exec.Cmd, error)
- func BuildFunc(...) error
- func ExecuteCommand(cmd *exec.Cmd) error
- func GenerateAnnotations(mediaType, manifests, metadata, packageName, channels, channelDefault string) ([]byte, error)
- func GenerateDockerfile(mediaType, manifests, metadata, packageName, channels, channelDefault string) ([]byte, error)
- func GenerateFunc(directory, packageName, channels, channelDefault string, overwrite bool) error
- func GetMediaType(directory string) (string, error)
- func ValidateAnnotations(existing, expected []byte) error
- func ValidateChannelDefault(channels, channelDefault string) (string, error)
- func WriteFile(fileName, directory string, content []byte) error
- type AnnotationMetadata
- type BundleImageValidator
- type ValidationError
Constants ¶
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 ¶
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 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 ¶
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 ¶
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 ¶
ValidateAnnotations validates existing annotations.yaml against generated annotations.yaml to ensure existing annotations.yaml contains expected values.
func ValidateChannelDefault ¶ added in v1.5.0
ValidateChannelDefault validates provided default channel to ensure it exists in provided channel list.
Types ¶
type AnnotationMetadata ¶
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 ¶
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