Merge pull request #846 from surajnarwade/buildv3

Added support for build key in v3
This commit is contained in:
Charlie Drage
2017-11-30 09:06:32 -05:00
committed by GitHub
323 changed files with 28990 additions and 66981 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ package app
import (
"strings"
log "github.com/Sirupsen/logrus"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
// install kubernetes api
+1 -1
View File
@@ -26,10 +26,10 @@ import (
"k8s.io/kubernetes/pkg/api"
log "github.com/Sirupsen/logrus"
"github.com/fatih/structs"
"github.com/kubernetes/kompose/pkg/kobject"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)
// Bundle is docker bundle file loader, implements Loader interface
+1 -1
View File
@@ -24,11 +24,11 @@ import (
yaml "gopkg.in/yaml.v2"
log "github.com/Sirupsen/logrus"
"github.com/docker/libcompose/project"
"github.com/fatih/structs"
"github.com/kubernetes/kompose/pkg/kobject"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)
// Compose is docker compose file loader, implements Loader interface
+9 -3
View File
@@ -25,6 +25,8 @@ import (
"github.com/kubernetes/kompose/pkg/kobject"
"k8s.io/kubernetes/pkg/api"
"time"
"github.com/docker/cli/cli/compose/types"
"github.com/docker/libcompose/config"
"github.com/docker/libcompose/project"
@@ -32,14 +34,18 @@ import (
"github.com/pkg/errors"
)
func durationPtr(value time.Duration) *time.Duration {
return &value
}
func TestParseHealthCheck(t *testing.T) {
helperValue := uint64(2)
check := types.HealthCheckConfig{
Test: []string{"CMD-SHELL", "echo", "foobar"},
Timeout: "1s",
Interval: "2s",
Timeout: durationPtr(1 * time.Second),
Interval: durationPtr(2 * time.Second),
Retries: &helperValue,
StartPeriod: "3s",
StartPeriod: durationPtr(3 * time.Second),
}
// CMD-SHELL or SHELL is included Test within docker/cli, thus we remove the first value in Test
+1 -1
View File
@@ -26,13 +26,13 @@ import (
"k8s.io/kubernetes/pkg/api"
log "github.com/Sirupsen/logrus"
"github.com/docker/libcompose/config"
"github.com/docker/libcompose/lookup"
"github.com/docker/libcompose/project"
"github.com/kubernetes/kompose/pkg/kobject"
"github.com/kubernetes/kompose/pkg/transformer"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)
// Parse Docker Compose with libcompose (only supports v1 and v2). Eventually we will
+10 -9
View File
@@ -31,9 +31,9 @@ import (
"os"
log "github.com/Sirupsen/logrus"
"github.com/kubernetes/kompose/pkg/kobject"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)
// converts os.Environ() ([]string) to map[string]string
@@ -171,16 +171,16 @@ func parseHealthCheck(composeHealthCheck types.HealthCheckConfig) (kobject.Healt
var timeout, interval, retries, startPeriod int32
// Here we convert the timeout from 1h30s (example) to 36030 seconds.
if composeHealthCheck.Timeout != "" {
parse, err := time.ParseDuration(composeHealthCheck.Timeout)
if composeHealthCheck.Timeout != nil {
parse, err := time.ParseDuration(composeHealthCheck.Timeout.String())
if err != nil {
return kobject.HealthCheck{}, errors.Wrap(err, "unable to parse health check timeout variable")
}
timeout = int32(parse.Seconds())
}
if composeHealthCheck.Interval != "" {
parse, err := time.ParseDuration(composeHealthCheck.Interval)
if composeHealthCheck.Interval != nil {
parse, err := time.ParseDuration(composeHealthCheck.Interval.String())
if err != nil {
return kobject.HealthCheck{}, errors.Wrap(err, "unable to parse health check interval variable")
}
@@ -191,8 +191,8 @@ func parseHealthCheck(composeHealthCheck types.HealthCheckConfig) (kobject.Healt
retries = int32(*composeHealthCheck.Retries)
}
if composeHealthCheck.StartPeriod != "" {
parse, err := time.ParseDuration(composeHealthCheck.StartPeriod)
if composeHealthCheck.StartPeriod != nil {
parse, err := time.ParseDuration(composeHealthCheck.StartPeriod.String())
if err != nil {
return kobject.HealthCheck{}, errors.Wrap(err, "unable to parse health check startPeriod variable")
}
@@ -312,8 +312,9 @@ func dockerComposeToKomposeMapping(composeObject *types.Config) (kobject.Kompose
// TODO: Build is not yet supported, see:
// https://github.com/docker/cli/blob/master/cli/compose/types/types.go#L9
// We will have to *manually* add this / parse.
// serviceConfig.Build = composeServiceConfig.Build.Context
// serviceConfig.Dockerfile = composeServiceConfig.Build.Dockerfile
serviceConfig.Build = composeServiceConfig.Build.Context
serviceConfig.Dockerfile = composeServiceConfig.Build.Dockerfile
serviceConfig.BuildArgs = composeServiceConfig.Build.Args
// Gather the environment values
// DockerCompose uses map[string]*string while we use []string
+1 -1
View File
@@ -30,11 +30,11 @@ import (
"text/template"
"time"
log "github.com/Sirupsen/logrus"
"github.com/ghodss/yaml"
"github.com/joho/godotenv"
"github.com/kubernetes/kompose/pkg/kobject"
"github.com/kubernetes/kompose/pkg/transformer"
log "github.com/sirupsen/logrus"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
+1 -1
View File
@@ -22,12 +22,12 @@ import (
"strconv"
"time"
log "github.com/Sirupsen/logrus"
"github.com/fatih/structs"
"github.com/kubernetes/kompose/pkg/kobject"
"github.com/kubernetes/kompose/pkg/transformer"
buildapi "github.com/openshift/origin/pkg/build/api"
deployapi "github.com/openshift/origin/pkg/deploy/api"
log "github.com/sirupsen/logrus"
// install kubernetes api
_ "k8s.io/kubernetes/pkg/api/install"
+1 -1
View File
@@ -23,7 +23,7 @@ import (
"github.com/kubernetes/kompose/pkg/kobject"
"github.com/kubernetes/kompose/pkg/transformer/kubernetes"
log "github.com/Sirupsen/logrus"
log "github.com/sirupsen/logrus"
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
+1 -1
View File
@@ -24,8 +24,8 @@ import (
"path"
"strings"
log "github.com/Sirupsen/logrus"
"github.com/kubernetes/kompose/pkg/kobject"
log "github.com/sirupsen/logrus"
"path/filepath"
+1 -1
View File
@@ -18,10 +18,10 @@ package docker
import (
"bytes"
log "github.com/Sirupsen/logrus"
dockerlib "github.com/fsouza/go-dockerclient"
"github.com/kubernetes/kompose/pkg/utils/archive"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"io/ioutil"
"os"
"path"
+1 -1
View File
@@ -18,10 +18,10 @@ package docker
import (
"bytes"
log "github.com/Sirupsen/logrus"
dockerlib "github.com/fsouza/go-dockerclient"
"github.com/novln/docker-parser"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)
// Push will provide methods for interaction with API regarding pushing images