Documentation
¶
Overview ¶
Package query holds the cross-CR lookups a ServiceUnit needs.
A ServiceUnit of type BUILD does not name an image. It names a Build, and runs whatever that Build last pushed. Resolution is pure and cannot read another object, so the image is looked up here, after resolution and before the resolved ServiceUnit is used.
Index ¶
- Variables
- func BuildImage(build *environmentsv1alpha1.Build) (string, error)
- func BuildKey(su *serviceunitresolution.ResolvedServiceUnit) (key types.NamespacedName, ok bool)
- func BuildPullSecret(build *environmentsv1alpha1.Build) (string, error)
- func InjectBuildImage(ctx context.Context, c client.Reader, ...) error
Constants ¶
This section is empty.
Variables ¶
var ErrBuildInOtherNamespace = errors.New("build is in another namespace")
ErrBuildInOtherNamespace reports a ServiceUnit that names a Build outside its own namespace. The image is pulled with the Build's registry secret, and a workload can only use a secret in its own namespace.
Functions ¶
func BuildImage ¶
func BuildImage(build *environmentsv1alpha1.Build) (string, error)
BuildImage returns the image the Build last pushed, pinned to its digest, as the Build's status records it. It is empty, with no error, for a Build that has not pushed an image yet.
func BuildKey ¶
func BuildKey(su *serviceunitresolution.ResolvedServiceUnit) (key types.NamespacedName, ok bool)
BuildKey is the Build a resolved ServiceUnit takes its image from. The Build is looked for in the ServiceUnit's namespace unless the reference names another. ok is false for a ServiceUnit that is not of type BUILD.
func BuildPullSecret ¶
func BuildPullSecret(build *environmentsv1alpha1.Build) (string, error)
BuildPullSecret returns the name of the registry secret the Build declares for its image (serviceAccount.secret). It is empty, with no error, for a Build that declares none.
func InjectBuildImage ¶
func InjectBuildImage(ctx context.Context, c client.Reader, su *serviceunitresolution.ResolvedServiceUnit) error
InjectBuildImage sets, on a resolved ServiceUnit of type BUILD, the image its Build last pushed and the registry secret that Build declared for it. Any other type is left as it is.
The Build has already set up access to its image, so the ServiceUnit does not declare credentials of its own and nothing is copied: the secret is referenced by name. That is why the Build must be in the ServiceUnit's namespace; one that is not is ErrBuildInOtherNamespace.
The image stays empty, with no error, while the Build has not pushed one: the ServiceUnit is then waiting for its Build, which is not a failure. A Build that cannot be read is an error.
Types ¶
This section is empty.