Documentation
¶
Overview ¶
Package project contains logic for building Crossplane projects.
Index ¶
- Constants
- func AnnotateImage(i v1.Image) (v1.Image, error)
- func ApplyResources(ctx context.Context, cl client.Client, resources []runtime.RawExtension) error
- func BuildIndex(imgs ...v1.Image) (v1.ImageIndex, []v1.Image, error)
- func EmbeddedFunctionsToDaemon(ctx context.Context, imageMap ImageTagMap) ([]pkgv1.Function, error)
- func InstallConfiguration(ctx context.Context, cl client.Client, cfgName string, tag name.Tag, ...) error
- func LoadFunctionDependencies(resolver Resolver, proj *devv1alpha1.Project) ([]pkgv1.Function, error)
- func SortImages(imgMap ImageTagMap, repo string) (cfgImage v1.Image, fnImages map[name.Repository][]v1.Image, err error)
- type BuildOption
- type Builder
- type BuilderOption
- func BuildWithDependencyManager(m *dependency.Manager) BuilderOption
- func BuildWithFunctionIdentifier(i functions.Identifier) BuilderOption
- func BuildWithMaxConcurrency(n uint) BuilderOption
- func BuildWithSchemaManager(m *manager.Manager) BuilderOption
- func BuildWithTempDir(dir string) BuilderOption
- type ImageTagMap
- type PushOption
- type Pusher
- type PusherOption
- type Resolver
Constants ¶
const ( // ConfigurationTag is the tag used for the configuration image in the built // package. ConfigurationTag = "configuration" )
Variables ¶
This section is empty.
Functions ¶
func AnnotateImage ¶
AnnotateImage reads in the layers of the given v1.Image and annotates the xpkg layers with their corresponding annotations, returning a new v1.Image containing the annotation details.
func ApplyResources ¶
ApplyResources installs arbitrary resources to the target control plane.
func BuildIndex ¶
BuildIndex applies annotations to each of the given images and then generates an index for them. The annotated images are returned so that a caller can push them before pushing the index, since the passed images may not match the annotated images.
func EmbeddedFunctionsToDaemon ¶
EmbeddedFunctionsToDaemon loads each compatible image in the ImageTagMap into the Docker daemon and returns Function manifests.
func InstallConfiguration ¶
func InstallConfiguration(ctx context.Context, cl client.Client, cfgName string, tag name.Tag, logger logging.Logger) error
InstallConfiguration installs a Configuration package on the target control plane and waits for it and all its dependencies to become healthy.
func LoadFunctionDependencies ¶
func LoadFunctionDependencies(resolver Resolver, proj *devv1alpha1.Project) ([]pkgv1.Function, error)
LoadFunctionDependencies loads function manifests from a project's dependencies, resolving version constraints using the provided resolver.
func SortImages ¶
func SortImages(imgMap ImageTagMap, repo string) (cfgImage v1.Image, fnImages map[name.Repository][]v1.Image, err error)
SortImages analyzes an image map produced by the project builder and picks out the configuration and function images from it. The function images are grouped together by function, so that multi-arch indexes can be produced based on the returned map.
Types ¶
type BuildOption ¶
type BuildOption func(o *buildOptions)
BuildOption configures a build.
func BuildWithEventChannel ¶
func BuildWithEventChannel(ch async.EventChannel) BuildOption
BuildWithEventChannel provides a channel for sending progress events during the build.
func BuildWithLogger ¶
func BuildWithLogger(l logging.Logger) BuildOption
BuildWithLogger provides a logger for progress updates during the build.
func BuildWithProjectBasePath ¶
func BuildWithProjectBasePath(path string) BuildOption
BuildWithProjectBasePath sets the real on-disk base path of the project. This path will be used for following symlinks. If not set it will be inferred from the project FS, which works only when the project FS is an afero.BasePathFs.
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
A Builder builds a project into a set of packages.
The images Build returns may read lazily from temporary files on disk - for example, when a function's runtime is supplied as a gzipped tarball that is decompressed once during the build. These files are written to the temporary directory set by BuildWithTempDir, which the caller owns and is responsible for removing once it has finished consuming the returned images.
func NewBuilder ¶
func NewBuilder(opts ...BuilderOption) *Builder
NewBuilder returns a new project builder. Callers that build functions whose runtime is supplied as a gzipped tarball should set BuildWithTempDir and remove the directory once they have finished consuming the images returned by Build.
func (*Builder) Build ¶
func (b *Builder) Build(ctx context.Context, project *devv1alpha1.Project, projectFS afero.Fs, opts ...BuildOption) (ImageTagMap, error)
Build builds a project into a set of packages. It returns a map containing images that were built from the project. The returned map will always include one image with the ConfigurationTag, which is the configuration package built from the APIs found in the project.
type BuilderOption ¶
type BuilderOption func(b *Builder)
BuilderOption configures a Builder.
func BuildWithDependencyManager ¶
func BuildWithDependencyManager(m *dependency.Manager) BuilderOption
BuildWithDependencyManager sets the dependency manager that will be used to ensure schemas are present for the project's declared dependencies before building functions.
func BuildWithFunctionIdentifier ¶
func BuildWithFunctionIdentifier(i functions.Identifier) BuilderOption
BuildWithFunctionIdentifier sets the function identifier that will be used to find function builders for any functions in a project.
func BuildWithMaxConcurrency ¶
func BuildWithMaxConcurrency(n uint) BuilderOption
BuildWithMaxConcurrency sets the maximum concurrency for building embedded functions.
func BuildWithSchemaManager ¶
func BuildWithSchemaManager(m *manager.Manager) BuilderOption
BuildWithSchemaManager sets the schema manager that will be used to generate language-specific schemas from XRDs before building functions.
func BuildWithTempDir ¶ added in v2.4.0
func BuildWithTempDir(dir string) BuilderOption
BuildWithTempDir sets a directory the builder can use to hold temporary files. The images returned from Build() may depend on this directory, so callers should not remove it until they have finished consuming the images.
If unset, the OS default temporary directory is to hold temporary files, which are not cleaned up by the builder.
type ImageTagMap ¶
ImageTagMap is a map of container image tags to images.
type PushOption ¶
type PushOption func(o *pushOptions)
PushOption configures a push.
func PushWithEventChannel ¶
func PushWithEventChannel(ch async.EventChannel) PushOption
PushWithEventChannel provides a channel to which progress updates will be written during the push. It is the caller's responsibility to manage the lifecycle of this channel.
func PushWithTag ¶
func PushWithTag(tag string) PushOption
PushWithTag sets the tag to be used for the pushed packages.
type Pusher ¶
type Pusher interface {
// Push pushes a set of packages built from a project to a registry and
// returns the tag to which the configuration package was pushed.
Push(ctx context.Context, project *devv1alpha1.Project, imgMap ImageTagMap, opts ...PushOption) (name.Tag, error)
}
Pusher is able to push a set of packages built from a project to a registry.
func NewPusher ¶
func NewPusher(opts ...PusherOption) Pusher
NewPusher returns a new project Pusher.
type PusherOption ¶
type PusherOption func(p *realPusher)
PusherOption configures a pusher.
func PushWithAuthKeychain ¶
func PushWithAuthKeychain(kc authn.Keychain) PusherOption
PushWithAuthKeychain provides a registry credential source to be used by the push.
func PushWithMaxConcurrency ¶
func PushWithMaxConcurrency(n uint) PusherOption
PushWithMaxConcurrency sets the maximum concurrency for pushing packages.
func PushWithTransport ¶
func PushWithTransport(t http.RoundTripper) PusherOption
PushWithTransport sets the HTTP transport to be used by the pusher.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package certs generates certificates for the local dev registry.
|
Package certs generates certificates for the local dev registry. |
|
Package controlplane manages local development control planes.
|
Package controlplane manages local development control planes. |
|
Package functions contains functions for building embedded functions.
|
Package functions contains functions for building embedded functions. |
|
Package helm implements a helm chart installer.
|
Package helm implements a helm chart installer. |
|
Package projectfile reads and writes Crossplane project files.
|
Package projectfile reads and writes Crossplane project files. |