Skip to content

Commit

Permalink
Simplify devfile Kubernetes adapter (#6762)
Browse files Browse the repository at this point in the history
* Get values from context

* Move Devfile param to WatchParams and biuld adapter only once

* Move pkg/devfile/adapters/kubernetes/* into pkg/dev/kubedev

* Rename Push to reconcile and split in 2 parts: components and innreloop

* Pass out ans errout as startOptions

* Embed StartOptions into PushParameters

* Embed StartOptions into WatchParameters

* Fix passing startoptions

* Deduplicate options (out, ...)

* Revert adding unwanted files

* Fix wait app ready
  • Loading branch information
feloy authored Apr 25, 2023
1 parent 6aacbe2 commit e9c5f86
Show file tree
Hide file tree
Showing 28 changed files with 781 additions and 890 deletions.
2 changes: 1 addition & 1 deletion pkg/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

"github.com/redhat-developer/odo/pkg/component"
"github.com/redhat-developer/odo/pkg/configAutomount"
"github.com/redhat-developer/odo/pkg/devfile/adapters/kubernetes/storage"
"github.com/redhat-developer/odo/pkg/dev/kubedev/storage"
"github.com/redhat-developer/odo/pkg/devfile/image"
"github.com/redhat-developer/odo/pkg/kclient"
odolabels "github.com/redhat-developer/odo/pkg/labels"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package adapters
package common

import (
"path/filepath"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package adapters
package common

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package adapters
package common

import "fmt"

Expand Down
17 changes: 17 additions & 0 deletions pkg/dev/common/types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package common

import (
"github.com/devfile/library/v2/pkg/devfile/parser"
"github.com/redhat-developer/odo/pkg/dev"
)

// PushParameters is a struct containing the parameters to be used when pushing to a devfile component
type PushParameters struct {
StartOptions dev.StartOptions

Devfile parser.DevfileObj
WatchFiles []string // Optional: WatchFiles is the list of changed files detected by odo watch. If empty or nil, odo will check .odo/odo-file-index.json to determine changed files
WatchDeletedFiles []string // Optional: WatchDeletedFiles is the list of deleted files detected by odo watch. If empty or nil, odo will check .odo/odo-file-index.json to determine deleted files
Show bool // Show tells whether the devfile command output should be shown on stdout
DevfileScanIndexForWatch bool // DevfileScanIndexForWatch is true if watch's push should regenerate the index file during SyncFiles, false otherwise. See 'pkg/sync/adapter.go' for details
}
8 changes: 5 additions & 3 deletions pkg/dev/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package dev

import (
"context"
"github.com/redhat-developer/odo/pkg/api"
"io"

"github.com/redhat-developer/odo/pkg/api"
)

type StartOptions struct {
Expand Down Expand Up @@ -31,6 +32,9 @@ type StartOptions struct {
ForwardLocalhost bool
// Variables to override in the Devfile
Variables map[string]string

Out io.Writer
ErrOut io.Writer
}

type Client interface {
Expand All @@ -39,8 +43,6 @@ type Client interface {
// It logs messages and errors to out and errOut.
Start(
ctx context.Context,
out io.Writer,
errOut io.Writer,
options StartOptions,
) error

Expand Down
Loading

0 comments on commit e9c5f86

Please sign in to comment.