-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
The camel-k operator implements a Container Image Builder whose goal is to efficiently assemble container images from a list of dependencies and attributes.
The general work flow the camel-k operator follow to materialize an integration is the following one:
As the operator is aware about all the containers it has previously created, it can efficiently create new containers images using some of the previously built ones:
The way the camel-k operator assembles applications, can be useful outside to assemble any kind of application.
Proposed CR definition (pseudo go code):
type ExecutionType string
type AssemblerType string
type ContainerImagePhase string
type ContainerImageLayout string
const (
ExecutionTypeRoutine ExecutionType = "routine"
ExecutionTypePod ExecutionType = "pod"
AssemblerTypeBuildah AssemblerType = "buildah"
AssemblerTypeSpectrum AssemblerType = "spectrum"
)
// ContainerImageBuilder defines the status of the controller.
type ContainerImageBuilder struct {
metav1.TypeMeta
metav1.ObjectMeta
Spec struct {
// Type define the strategy used to create the container
// image.
//
// NOTE: to be removed when stable
Type AssemblerType
// Execution describes how to execute the assemble phase.
//
// NOTE: to be removed when stable
Execution ExecutionType
// Registries defines the list of registries that can be
// used to pull or push images. The controller will try
// to automatically configure this section when possible
// and if not it will go to an error status.
Registries []struct {
Insecure bool
Address string
Secret string
CA string
Repository string
}
// List of plugins implemented through a sidecar exposing
// gRPC endpoints (https://github.com/hashicorp/go-plugin)
Plugins []struct {
ID string
Container core.Container
}
}
Status struct {
// The phase in which the container image builder is
Phase ContainerImageBuilderPhase
// Conditions detail the current conditions of
// this container image builder.
Conditions []struct {
// Similar to the condition structure found on a number of
// k8s resources.
}
}
}
// ContainerImage describe a Container Image
//
// When looking for base image, the controller should filter
// the images according to the “layout” defined through a
// label, i.e:
//
// metadata:
// labels:
// containers-tools.io/layout: “camel-k“
//
// The “layout” identifies a plugin that the image builder
// should invoke in order copy the resolved dependencies to
// the right location expected by the image requestor.
//
type ContainerImage struct {
metav1.TypeMeta
metav1.ObjectMeta
Spec ContainerImageSpec
Status ContainerImageStatus
}
// ContainerImageSpec ---
type ContainerImageSpec struct {
// List of maven dependencies
Dependencies [] struct {
// GAV represents Maven ID of a dependency:
// mvn:groupId:artifactId[:packagingType[:classifier]]:(version|'?')
GAV *struct {
GroupID string
ApplicationID string
Version string
Type string
Classifier string
}
// URL a location of the artifact
ULR *url.URL
// CheckSum ---
CheckSum string
}
// The image used to derive the image if no better image is found.
From string
// Settings configure where maven settings are stored.
Settings *struct {
// Selects a key of a ConfigMap.
ConfigMapKeyRef *corev1.ConfigMapKeySelector
// Selects a key of a secret.
SecretKeyRef *corev1.SecretKeySelector
}
// Resources configure additional resources that have to be
// taken into account by the image generation process
Resources []struct {
// Selects a key of a ConfigMap.
ConfigMapKeyRef *corev1.ConfigMapKeySelector
// Selects a key of a secret.
SecretKeyRef *corev1.SecretKeySelector
// The local path where the key should be mounted
Path string
}
// Destination is an optional field that defines where the
// artifact should be located. It support templating so
// one should be able to define it as:
//
// Destination: “/opt/my-app/{{.GroupID}}-{{.ArtifactID}}.jar
//
// If a specific layout “plugin” is found, this field is
// ignored.
Destination string
}
// ContainerImageStatus ---
type ContainerImageStatus struct {
// Image is the final image name
Image string
// The phase in which the container image is
Phase ContainerImagePhase
// Conditions detail the current conditions of this process.
Conditions []struct {
// Similar to the condition structure found on a number of
// k8s resources.
}
// Dependencies lists the resolved dependencies
// and the related target path
Dependencies []struct {
ID string
TargetPath string
}
}
