forked from LaconicNetwork/kompose
Updated code with go lint result
Updated code with suggestion given by `go lint`
This commit is contained in:
parent
462453208b
commit
91a6e79d6f
@ -562,7 +562,7 @@ func (k *Kubernetes) VolumesFrom(objects *[]runtime.Object, komposeObject kobjec
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//Ensure the kubernetes objects are in a consistent order
|
// SortedKeys Ensure the kubernetes objects are in a consistent order
|
||||||
func SortedKeys(komposeObject kobject.KomposeObject) []string {
|
func SortedKeys(komposeObject kobject.KomposeObject) []string {
|
||||||
var sortedKeys []string
|
var sortedKeys []string
|
||||||
for name := range komposeObject.ServiceConfigs {
|
for name := range komposeObject.ServiceConfigs {
|
||||||
@ -572,7 +572,7 @@ func SortedKeys(komposeObject kobject.KomposeObject) []string {
|
|||||||
return sortedKeys
|
return sortedKeys
|
||||||
}
|
}
|
||||||
|
|
||||||
//converts duration string to *int64 in seconds
|
// DurationStrToSecondsInt converts duration string to *int64 in seconds
|
||||||
func DurationStrToSecondsInt(s string) (*int64, error) {
|
func DurationStrToSecondsInt(s string) (*int64, error) {
|
||||||
if s == "" {
|
if s == "" {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|||||||
@ -61,7 +61,7 @@ type Kubernetes struct {
|
|||||||
// used when undeploying resources from kubernetes
|
// used when undeploying resources from kubernetes
|
||||||
const TIMEOUT = 300
|
const TIMEOUT = 300
|
||||||
|
|
||||||
//default size of Persistent Volume Claim
|
// PVCRequestSize (Persistent Volume Claim) has default size
|
||||||
const PVCRequestSize = "100Mi"
|
const PVCRequestSize = "100Mi"
|
||||||
|
|
||||||
// CheckUnsupportedKey checks if given komposeObject contains
|
// CheckUnsupportedKey checks if given komposeObject contains
|
||||||
|
|||||||
@ -33,6 +33,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Selector used as labels and selector
|
||||||
const Selector = "io.kompose.service"
|
const Selector = "io.kompose.service"
|
||||||
|
|
||||||
// CreateOutFile creates the file to write to if --out is specified
|
// CreateOutFile creates the file to write to if --out is specified
|
||||||
@ -155,7 +156,7 @@ func formatProviderName(provider string) string {
|
|||||||
return provider
|
return provider
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort struct
|
// EnvSort struct
|
||||||
type EnvSort []api.EnvVar
|
type EnvSort []api.EnvVar
|
||||||
|
|
||||||
// returns the number of elements in the collection.
|
// returns the number of elements in the collection.
|
||||||
@ -189,6 +190,7 @@ func GetComposeFileDir(inputFiles []string) (string, error) {
|
|||||||
return filepath.Dir(inputFile), nil
|
return filepath.Dir(inputFile), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//BuildDockerImage builds docker image
|
||||||
func BuildDockerImage(service kobject.ServiceConfig, name string, relativePath string) error {
|
func BuildDockerImage(service kobject.ServiceConfig, name string, relativePath string) error {
|
||||||
|
|
||||||
// First, let's figure out the relative path of the Dockerfile!
|
// First, let's figure out the relative path of the Dockerfile!
|
||||||
@ -223,6 +225,7 @@ func BuildDockerImage(service kobject.ServiceConfig, name string, relativePath s
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PushDockerImage pushes docker image
|
||||||
func PushDockerImage(service kobject.ServiceConfig, serviceName string) error {
|
func PushDockerImage(service kobject.ServiceConfig, serviceName string) error {
|
||||||
|
|
||||||
log.Debugf("Pushing Docker image '%s'", service.Image)
|
log.Debugf("Pushing Docker image '%s'", service.Image)
|
||||||
|
|||||||
@ -28,12 +28,13 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Build will provide methods for interaction with API regarding building images
|
||||||
type Build struct {
|
type Build struct {
|
||||||
Client dockerlib.Client
|
Client dockerlib.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Build a Docker image via the Docker API. Takes the source directory
|
BuildImage builds a Docker image via the Docker API. Takes the source directory
|
||||||
and image name and then builds the appropriate image. Tarball is utilized
|
and image name and then builds the appropriate image. Tarball is utilized
|
||||||
in order to make building easier.
|
in order to make building easier.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import (
|
|||||||
"github.com/fsouza/go-dockerclient"
|
"github.com/fsouza/go-dockerclient"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// DockerClient connects to Docker client on host
|
||||||
func DockerClient() (*docker.Client, error) {
|
func DockerClient() (*docker.Client, error) {
|
||||||
|
|
||||||
// Default end-point, HTTP + TLS support to be added in the future
|
// Default end-point, HTTP + TLS support to be added in the future
|
||||||
|
|||||||
@ -24,12 +24,13 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Push will provide methods for interaction with API regarding pushing images
|
||||||
type Push struct {
|
type Push struct {
|
||||||
Client dockerlib.Client
|
Client dockerlib.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Push a Docker image via the Docker API. Takes the image name,
|
PushImage push a Docker image via the Docker API. Takes the image name,
|
||||||
parses the URL details and then push based on environment authentication
|
parses the URL details and then push based on environment authentication
|
||||||
credentials.
|
credentials.
|
||||||
*/
|
*/
|
||||||
@ -80,5 +81,5 @@ func (c *Push) PushImage(fullImageName string) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return errors.New("Unable to push docker image(s). Check that `docker login` works successfully on the command line.")
|
return errors.New("unable to push docker image(s). Check that `docker login` works successfully on the command line")
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user