forked from LaconicNetwork/kompose
cleanup debug logs & remove duplicated output (#1348)
* cleanup debug logs * avoid duplicate error messages and this makes main.go use os and fmt package instead of log to avoid touching global state
This commit is contained in:
parent
8b06045c70
commit
951b46e3c2
@ -52,11 +52,11 @@ var RootCmd = &cobra.Command{
|
||||
Use: "kompose",
|
||||
Short: "A tool helping Docker Compose users move to Kubernetes",
|
||||
Long: `Kompose is a tool to help users who are familiar with docker-compose move to Kubernetes.`,
|
||||
SilenceErrors: true,
|
||||
// PersistentPreRun will be "inherited" by all children and ran before *every* command unless
|
||||
// the child has overridden the functionality. This functionality was implemented to check / modify
|
||||
// all global flag calls regardless of app call.
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
|
||||
// Add extra logging when verbosity is passed
|
||||
if GlobalVerbose {
|
||||
log.SetLevel(log.DebugLevel)
|
||||
@ -81,7 +81,6 @@ var RootCmd = &cobra.Command{
|
||||
if provider != "kubernetes" && provider != "openshift" {
|
||||
log.Fatalf("%s is an unsupported provider. Supported providers are: 'kubernetes', 'openshift'.", GlobalProvider)
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
7
main.go
7
main.go
@ -17,14 +17,15 @@ limitations under the License.
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/kubernetes/kompose/cmd"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := cmd.Execute(); err != nil {
|
||||
log.SetFlags(0)
|
||||
log.Fatal(err)
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,8 +139,6 @@ func (k *Kubernetes) InitPodSpecWithConfigMap(name string, image string, service
|
||||
var volumeMounts []api.VolumeMount
|
||||
var volumes []api.Volume
|
||||
|
||||
log.Debugf("Configs in InitPodSpecWithConfigMap: %+v", service.Configs)
|
||||
|
||||
for _, value := range service.Configs {
|
||||
cmVolName := FormatFileName(value.Source)
|
||||
target := value.Target
|
||||
@ -598,7 +596,6 @@ func (k *Kubernetes) ConfigServicePorts(name string, service kobject.ServiceConf
|
||||
seenPorts := make(map[int]struct{}, len(service.Port))
|
||||
|
||||
var servicePort api.ServicePort
|
||||
log.Debugf("Ports in ConfigServicePorts: %+v", service.Port)
|
||||
for _, port := range service.Port {
|
||||
if port.HostPort == 0 {
|
||||
port.HostPort = port.ContainerPort
|
||||
|
||||
Loading…
Reference in New Issue
Block a user