Skip to content

Commit

Permalink
Merge pull request #1024 from FabianKramm/kustomize
Browse files Browse the repository at this point in the history
use kustomize from path
  • Loading branch information
FabianKramm authored Mar 20, 2020
2 parents 187a1ac + ccb81d2 commit 459919c
Show file tree
Hide file tree
Showing 536 changed files with 945 additions and 336,907 deletions.
38 changes: 7 additions & 31 deletions cmd/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,49 +461,25 @@ func (cmd *DevCmd) startServices(f factory.Factory, config *latest.Config, gener
if interactiveMode {
var imageSelector []string
if config.Dev.Interactive.Terminal != nil && config.Dev.Interactive.Terminal.ImageName != "" {
imageConfigCache := generatedConfig.GetActive().GetImageCache(config.Dev.Interactive.Terminal.ImageName)
if imageConfigCache.ImageName != "" {
imageSelector = []string{imageConfigCache.ImageName + ":" + imageConfigCache.Tag}
}
imageSelector = targetselector.ImageSelectorFromConfig(config.Dev.Interactive.Terminal.ImageName, config, generatedConfig)
} else if len(config.Dev.Interactive.Images) > 0 {
imageSelector = []string{}
cache := generatedConfig.GetActive()

for _, imageConfig := range config.Dev.Interactive.Images {
imageConfigCache := cache.GetImageCache(imageConfig.Name)
if imageConfigCache.ImageName != "" {
imageSelector = append(imageSelector, imageConfigCache.ImageName+":"+imageConfigCache.Tag)
}
imageSelector = append(imageSelector, targetselector.ImageSelectorFromConfig(imageConfig.Name, config, generatedConfig)...)
}
}

return servicesClient.StartTerminal(args, imageSelector, exitChan, true)
} else if config.Dev == nil || config.Dev.Logs == nil || config.Dev.Logs.Disabled == nil || *config.Dev.Logs.Disabled == false {
// Build an image selector
imageSelector := []string{}
if config.Dev != nil && config.Dev.Logs != nil && config.Dev.Logs.Images != nil {
for generatedImageName, imageConfigCache := range generatedConfig.GetActive().Images {
if imageConfigCache.ImageName != "" {
// Check that they are also in the real config
for _, configImageName := range config.Dev.Logs.Images {
if configImageName == generatedImageName {
imageSelector = append(imageSelector, imageConfigCache.ImageName+":"+imageConfigCache.Tag)
break
}
}
}
if config.Dev != nil && config.Dev.Logs != nil {
for _, configImageName := range config.Dev.Logs.Images {
imageSelector = append(imageSelector, targetselector.ImageSelectorFromConfig(configImageName, config, generatedConfig)...)
}
} else {
for generatedImageName, imageConfigCache := range generatedConfig.GetActive().Images {
if imageConfigCache.ImageName != "" {
// Check that they are also in the real config
for configImageName := range config.Images {
if configImageName == generatedImageName {
imageSelector = append(imageSelector, imageConfigCache.ImageName+":"+imageConfigCache.Tag)
break
}
}
}
for configImageName := range config.Images {
imageSelector = append(imageSelector, targetselector.ImageSelectorFromConfig(configImageName, config, generatedConfig)...)
}
}

Expand Down
6 changes: 6 additions & 0 deletions cmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,12 @@ func (cmd *SyncCmd) Run(f factory.Factory, cobraCmd *cobra.Command, args []strin
if params.Namespace != "" {
loadedSyncConfig.Namespace = ""
}
if *syncConfig.DisableDownload {
loadedSyncConfig.DisableDownload = syncConfig.DisableDownload
}
if *syncConfig.DisableUpload {
loadedSyncConfig.DisableUpload = syncConfig.DisableUpload
}

syncConfig = loadedSyncConfig
selectorParameter.ConfigParameter = targetselector.ConfigParameter{
Expand Down
2 changes: 1 addition & 1 deletion hack/build-all.bash
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ done

# build sync helper
echo "Building sync helper"
GOARCH=386 GOOS=linux go build -ldflags "-s -w -X main.version=${VERSION}" -o "${DEVSPACE_ROOT}/release/sync" sync/stub/main.go
GOARCH=386 GOOS=linux go build -ldflags "-s -w -X main.version=${VERSION}" -o "${DEVSPACE_ROOT}/release/sync" sync/cmd/main.go
shasum -a 256 "${DEVSPACE_ROOT}/release/sync" > "${DEVSPACE_ROOT}/release/sync".sha256
8 changes: 4 additions & 4 deletions pkg/devspace/build/builder/custom/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ func (b *Builder) Build(log logpkg.Logger) error {
}

if len(b.imageConf.Tags) == 0 {
if b.imageConf.Build.Custom.ImageFlag != "" {
args = append(args, b.imageConf.Build.Custom.ImageFlag)
if b.imageConf.Build.Custom.ImageArg != "" {
args = append(args, b.imageConf.Build.Custom.ImageArg)
}

args = append(args, b.imageConf.Image+":"+b.imageTag)
} else {
for _, tag := range b.imageConf.Tags {
if b.imageConf.Build.Custom.ImageFlag != "" {
args = append(args, b.imageConf.Build.Custom.ImageFlag)
if b.imageConf.Build.Custom.ImageArg != "" {
args = append(args, b.imageConf.Build.Custom.ImageArg)
}

args = append(args, b.imageConf.Image+":"+tag)
Expand Down
6 changes: 1 addition & 5 deletions pkg/devspace/build/builder/kaniko/build_pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,7 @@ func (b *Builder) getBuildPod(buildID string, options *types.ImageBuildOptions,
}

// Extra flags
if kanikoOptions.Flags != nil {
for _, flag := range kanikoOptions.Flags {
kanikoArgs = append(kanikoArgs, flag)
}
}
kanikoArgs = append(kanikoArgs, kanikoOptions.Args...)

// Cache
if !options.NoCache {
Expand Down
11 changes: 7 additions & 4 deletions pkg/devspace/config/versions/latest/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
)

// Version is the current api version
const Version string = "v1beta7"
const Version string = "v1beta8"

// GetVersion returns the version
func (c *Config) GetVersion() string {
Expand Down Expand Up @@ -75,7 +75,7 @@ type DockerConfig struct {
type KanikoConfig struct {
Cache *bool `yaml:"cache,omitempty"`
SnapshotMode string `yaml:"snapshotMode,omitempty"`
Flags []string `yaml:"flags,omitempty"`
Args []string `yaml:"args,omitempty"`
Namespace string `yaml:"namespace,omitempty"`
Insecure *bool `yaml:"insecure,omitempty"`
PullSecret string `yaml:"pullSecret,omitempty"`
Expand All @@ -87,7 +87,7 @@ type CustomConfig struct {
Command string `yaml:"command,omitempty"`
AppendArgs []string `yaml:"appendArgs,omitempty"`
Args []string `yaml:"args,omitempty"`
ImageFlag string `yaml:"imageFlag,omitempty"`
ImageArg string `yaml:"imageArg,omitempty"`
OnChange []string `yaml:"onChange,omitempty"`
}

Expand Down Expand Up @@ -253,8 +253,11 @@ type ChartConfig struct {
type KubectlConfig struct {
Manifests []string `yaml:"manifests,omitempty"`
Kustomize *bool `yaml:"kustomize,omitempty"`
KustomizeArgs []string `yaml:"kustomizeArgs,omitempty"`
ReplaceImageTags *bool `yaml:"replaceImageTags,omitempty"`
Flags []string `yaml:"flags,omitempty"`
DeleteArgs []string `yaml:"deleteArgs,omitempty"`
CreateArgs []string `yaml:"createArgs,omitempty"`
ApplyArgs []string `yaml:"applyArgs,omitempty"`
CmdPath string `yaml:"cmdPath,omitempty"`
}

Expand Down
5 changes: 2 additions & 3 deletions pkg/devspace/config/versions/v1beta6/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package v1beta6

import (
"github.com/devspace-cloud/devspace/pkg/devspace/config/versions/config"
"github.com/devspace-cloud/devspace/pkg/devspace/config/versions/latest"
next "github.com/devspace-cloud/devspace/pkg/devspace/config/versions/latest"
"github.com/devspace-cloud/devspace/pkg/devspace/config/versions/util"
next "github.com/devspace-cloud/devspace/pkg/devspace/config/versions/v1beta7"
"github.com/devspace-cloud/devspace/pkg/util/log"
)

Expand All @@ -23,7 +22,7 @@ func (c *Config) Upgrade(log log.Logger) (config.Config, error) {
}

if config.DownloadOnInitialSync != nil && *config.DownloadOnInitialSync == true {
nextConfig.Dev.Sync[key].InitialSync = latest.InitialSyncStrategyPreferLocal
nextConfig.Dev.Sync[key].InitialSync = next.InitialSyncStrategyPreferLocal
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/devspace/config/versions/v1beta6/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"reflect"
"testing"

next "github.com/devspace-cloud/devspace/pkg/devspace/config/versions/latest"
next "github.com/devspace-cloud/devspace/pkg/devspace/config/versions/v1beta7"
"github.com/devspace-cloud/devspace/pkg/util/log"
"github.com/devspace-cloud/devspace/pkg/util/ptr"
yaml "gopkg.in/yaml.v2"
Expand Down
Loading

0 comments on commit 459919c

Please sign in to comment.