Skip to content

Commit

Permalink
Handle automatic image component creation for 'odo dev' on Podman
Browse files Browse the repository at this point in the history
  • Loading branch information
rm3l committed Mar 13, 2023
1 parent fc1e5f9 commit c9a810a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pkg/dev/podmandev/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ import (

"github.com/redhat-developer/odo/pkg/api"
"github.com/redhat-developer/odo/pkg/component"
envcontext "github.com/redhat-developer/odo/pkg/config/context"
"github.com/redhat-developer/odo/pkg/dev"
"github.com/redhat-developer/odo/pkg/devfile"
"github.com/redhat-developer/odo/pkg/devfile/adapters"
"github.com/redhat-developer/odo/pkg/devfile/image"
"github.com/redhat-developer/odo/pkg/libdevfile"
"github.com/redhat-developer/odo/pkg/log"
odocontext "github.com/redhat-developer/odo/pkg/odo/context"
Expand Down Expand Up @@ -45,6 +47,11 @@ func (o *DevClient) reconcile(

o.warnAboutK8sComponents(*devfileObj)

err := o.handleAutoImageComponents(ctx, *devfileObj)
if err != nil {
return err
}

pod, fwPorts, err := o.deployPod(ctx, options)
if err != nil {
return err
Expand Down Expand Up @@ -162,6 +169,21 @@ func (o *DevClient) warnAboutK8sComponents(devfileObj parser.DevfileObj) {
log.Warningf("Kubernetes components are not supported on Podman. Skipping: %v.", strings.Join(components, ", "))
}

func (o *DevClient) handleAutoImageComponents(ctx context.Context, devfileObj parser.DevfileObj) error {
components, err := devfile.GetImageComponentsToPush(devfileObj)
if err != nil {
return err
}

for _, c := range components {
err = image.BuildPushSpecificImage(ctx, o.fs, c, envcontext.GetEnvConfig(ctx).PushImages)
if err != nil {
return err
}
}
return nil
}

// deployPod deploys the component as a Pod in podman
func (o *DevClient) deployPod(ctx context.Context, options dev.StartOptions) (*corev1.Pod, []api.ForwardedPort, error) {
var (
Expand Down

0 comments on commit c9a810a

Please sign in to comment.