Skip to content

image build support #122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

iignatevich
Copy link
Collaborator

No description provided.

@iignatevich iignatevich requested a review from lexbritvin July 21, 2025 14:58
exec bool
volumeFlags string
// @todo need to think about a better way to handle this.
runtimeFlags driver.RuntimeFlags
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Driver must not know about runtime flags. You can save flags in the struct, but move it back to runtime.

@@ -105,6 +106,7 @@ const (
ImagePull // ImagePull - image is being pulled from the registry.
ImageBuild // ImageBuild - image is being built.
ImageRemoved // ImageRemoved - image was removed
ImagePostpone // ImagePostpone - image was removed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix copypaste.

@@ -26,6 +26,7 @@ type ContainerRunner interface {
ContainerKill(ctx context.Context, cid, signal string) error
ContainerRemove(ctx context.Context, cid string) error
Close() error
SetRuntimeFlags(flags RuntimeFlags)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It must not be in the driver.

@@ -156,6 +163,19 @@ func (c *runtimeContainer) GetFlags() *FlagsGroup {
Type: jsonschema.Boolean,
Default: false,
},
&DefParameter{
Name: containerRegistryURL,
Title: "k8s Images registry URL",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Kubernetes for all frontend strings. k8s is mostly for development. It seems we need to be able to specify registry in the global config. We may as well have multiple registries.

@@ -25,7 +26,19 @@ import (
"github.com/launchrctl/launchr/internal/launchr"
)

// RegistryLocal defines a local registry type
const RegistryLocal = "local"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it can go to Type. Registries are the same for all containers. Define a type specific to these strings like it's done for log level


script, err := executeTemplate(buildahBuildTemplate, buildData)
if err != nil {
return "", fmt.Errorf("failed to generate image build script: %w", err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, we must panic because we control the whole process.

Name: k8sBuildPodContainer,
Image: "quay.io/buildah/stable:latest",
SecurityContext: &corev1.SecurityContext{
Privileged: &[]bool{true}[0],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider moving it to a variable, it's hard to read.

containers = append(containers, buildahContainer)
}

// @todo should we add internal type which includes registry as sidecar and builds everything inside pod?
Copy link
Collaborator

@lexbritvin lexbritvin Jul 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. I think it may be the closest approach to Docker if we run actions in the cloud and we may not even specify registry. We may add registry in a separate feature with that. The problem is that when action stops, the registry is lost, but it's not very important for the moment.

func (k *k8sRuntime) ImageRemove(_ context.Context, _ string, _ ImageRemoveOptions) (*ImageRemoveResponse, error) {
// @todo it doesn't really work well with current implementation.
// additional issue here is kubernetes internal cache, additionally to registry storage.
// should we clean both of them in case of image remove? How 'no-cache' flag should behave?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We must at least remove it from the registry. For the cache issue, you may want to specify ImagePullPolicy: Always when creating a container.

// Store image options inside runtime.
k.imageOptions = imgOpts

// Return nothing to silence ImageEnsure(), as real work will be done inside k.ContainerStart().
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally we can create an image on ContainerCreate because after that we have a working pod. But it seems we may need to define extra step before ContainerCreate to prepare pods and images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants