Skip to content
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

Simplify pkg/devfile/adapters/... packages #5914

Merged
20 changes: 11 additions & 9 deletions pkg/dev/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import (
"k8s.io/klog/v2"

"github.com/redhat-developer/odo/pkg/devfile/adapters"
"github.com/redhat-developer/odo/pkg/devfile/adapters/common"
"github.com/redhat-developer/odo/pkg/devfile/adapters/kubernetes"
"github.com/redhat-developer/odo/pkg/devfile/adapters/kubernetes/component"
"github.com/redhat-developer/odo/pkg/watch"
)

Expand Down Expand Up @@ -43,7 +42,7 @@ func NewDevClient(

func (o *DevClient) Start(
devfileObj parser.DevfileObj,
platformContext kubernetes.KubernetesContext,
namespace string,
ignorePaths []string,
path string,
debug bool,
Expand All @@ -53,19 +52,22 @@ func (o *DevClient) Start(
errOut io.Writer,
) error {
klog.V(4).Infoln("Creating new adapter")
adapter, err := adapters.NewComponentAdapter(
adapter := component.NewKubernetesAdapter(
o.kubernetesClient, o.prefClient, o.portForwardClient,
devfileObj.GetMetadataName(), path, "app", devfileObj, platformContext, randomPorts, errOut)
if err != nil {
return err
}
component.AdapterContext{
ComponentName: devfileObj.GetMetadataName(),
Context: path,
AppName: "app",
Devfile: devfileObj,
},
namespace, randomPorts, errOut)

envSpecificInfo, err := envinfo.NewEnvSpecificInfo(path)
if err != nil {
return err
}

pushParameters := common.PushParameters{
pushParameters := adapters.PushParameters{
EnvSpecificInfo: *envSpecificInfo,
DebugPort: envSpecificInfo.GetDebugPort(),
Path: path,
Expand Down
10 changes: 4 additions & 6 deletions pkg/dev/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,20 @@ import (
"context"
"io"

"github.com/redhat-developer/odo/pkg/devfile/adapters/common"

"github.com/devfile/library/pkg/devfile/parser"

"github.com/redhat-developer/odo/pkg/devfile/adapters/kubernetes"
"github.com/redhat-developer/odo/pkg/devfile/adapters"
"github.com/redhat-developer/odo/pkg/watch"
)

type Client interface {
// Start the resources in devfileObj on the platformContext. It then pushes the files in path to the container.
// Start the resources in devfileObj on the namespace. It then pushes the files in path to the container.
// If debug is true, executes the debug command, or the run command by default.
// If buildCommand is set, this will look up the specified build command in the Devfile. Otherwise, it uses the default one.
// If runCommand is set, this will look up the specified run command in the Devfile and execute it. Otherwise, it uses the default one.
Start(
devfileObj parser.DevfileObj,
platformContext kubernetes.KubernetesContext,
namespace string,
ignorePaths []string,
path string,
debug bool,
Expand Down Expand Up @@ -50,5 +48,5 @@ type Client interface {
}

type Handler interface {
RegenerateAdapterAndPush(common.PushParameters, watch.WatchParameters) error
RegenerateAdapterAndPush(adapters.PushParameters, watch.WatchParameters) error
}
21 changes: 10 additions & 11 deletions pkg/dev/mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions pkg/devfile/adapters/common/interface.go

This file was deleted.

41 changes: 0 additions & 41 deletions pkg/devfile/adapters/common/utils.go

This file was deleted.

71 changes: 0 additions & 71 deletions pkg/devfile/adapters/helper.go

This file was deleted.

64 changes: 0 additions & 64 deletions pkg/devfile/adapters/helper_test.go

This file was deleted.

52 changes: 0 additions & 52 deletions pkg/devfile/adapters/kubernetes/adapter.go

This file was deleted.

Loading