format code

This commit is contained in:
jeff
2018-06-05 20:52:50 +08:00
parent 41a64c4017
commit 85d35e42ea
32 changed files with 119 additions and 276 deletions

181
Godeps/Godeps.json generated
View File

@@ -1,181 +0,0 @@
{
"ImportPath": "kubesphere.io/kubesphere",
"GoVersion": "go1.10",
"GodepVersion": "v80",
"Packages": [
"./..."
],
"Deps": [
{
"ImportPath": "github.com/docker/distribution/digestset",
"Comment": "v2.6.0-rc.1-277-g83389a14",
"Rev": "83389a148052d74ac602f5f1d62f86ff2f3c4aa5"
},
{
"ImportPath": "github.com/docker/distribution/reference",
"Comment": "v2.6.0-rc.1-277-g83389a14",
"Rev": "83389a148052d74ac602f5f1d62f86ff2f3c4aa5"
},
{
"ImportPath": "github.com/docker/docker/api",
"Comment": "docs-v1.12.0-rc4-2016-07-15-9343-gb7b6b6929",
"Rev": "b7b6b6929c6436145bd12e6fef7efb7d01fa170b"
},
{
"ImportPath": "github.com/docker/docker/api/types",
"Comment": "docs-v1.12.0-rc4-2016-07-15-9343-gb7b6b6929",
"Rev": "b7b6b6929c6436145bd12e6fef7efb7d01fa170b"
},
{
"ImportPath": "github.com/docker/docker/api/types/blkiodev",
"Comment": "docs-v1.12.0-rc4-2016-07-15-9343-gb7b6b6929",
"Rev": "b7b6b6929c6436145bd12e6fef7efb7d01fa170b"
},
{
"ImportPath": "github.com/docker/docker/api/types/container",
"Comment": "docs-v1.12.0-rc4-2016-07-15-9343-gb7b6b6929",
"Rev": "b7b6b6929c6436145bd12e6fef7efb7d01fa170b"
},
{
"ImportPath": "github.com/docker/docker/api/types/events",
"Comment": "docs-v1.12.0-rc4-2016-07-15-9343-gb7b6b6929",
"Rev": "b7b6b6929c6436145bd12e6fef7efb7d01fa170b"
},
{
"ImportPath": "github.com/docker/docker/api/types/filters",
"Comment": "docs-v1.12.0-rc4-2016-07-15-9343-gb7b6b6929",
"Rev": "b7b6b6929c6436145bd12e6fef7efb7d01fa170b"
},
{
"ImportPath": "github.com/docker/docker/api/types/image",
"Comment": "docs-v1.12.0-rc4-2016-07-15-9343-gb7b6b6929",
"Rev": "b7b6b6929c6436145bd12e6fef7efb7d01fa170b"
},
{
"ImportPath": "github.com/docker/docker/api/types/mount",
"Comment": "docs-v1.12.0-rc4-2016-07-15-9343-gb7b6b6929",
"Rev": "b7b6b6929c6436145bd12e6fef7efb7d01fa170b"
},
{
"ImportPath": "github.com/docker/docker/api/types/network",
"Comment": "docs-v1.12.0-rc4-2016-07-15-9343-gb7b6b6929",
"Rev": "b7b6b6929c6436145bd12e6fef7efb7d01fa170b"
},
{
"ImportPath": "github.com/docker/docker/api/types/registry",
"Comment": "docs-v1.12.0-rc4-2016-07-15-9343-gb7b6b6929",
"Rev": "b7b6b6929c6436145bd12e6fef7efb7d01fa170b"
},
{
"ImportPath": "github.com/docker/docker/api/types/strslice",
"Comment": "docs-v1.12.0-rc4-2016-07-15-9343-gb7b6b6929",
"Rev": "b7b6b6929c6436145bd12e6fef7efb7d01fa170b"
},
{
"ImportPath": "github.com/docker/docker/api/types/swarm",
"Comment": "docs-v1.12.0-rc4-2016-07-15-9343-gb7b6b6929",
"Rev": "b7b6b6929c6436145bd12e6fef7efb7d01fa170b"
},
{
"ImportPath": "github.com/docker/docker/api/types/swarm/runtime",
"Comment": "docs-v1.12.0-rc4-2016-07-15-9343-gb7b6b6929",
"Rev": "b7b6b6929c6436145bd12e6fef7efb7d01fa170b"
},
{
"ImportPath": "github.com/docker/docker/api/types/time",
"Comment": "docs-v1.12.0-rc4-2016-07-15-9343-gb7b6b6929",
"Rev": "b7b6b6929c6436145bd12e6fef7efb7d01fa170b"
},
{
"ImportPath": "github.com/docker/docker/api/types/versions",
"Comment": "docs-v1.12.0-rc4-2016-07-15-9343-gb7b6b6929",
"Rev": "b7b6b6929c6436145bd12e6fef7efb7d01fa170b"
},
{
"ImportPath": "github.com/docker/docker/api/types/volume",
"Comment": "docs-v1.12.0-rc4-2016-07-15-9343-gb7b6b6929",
"Rev": "b7b6b6929c6436145bd12e6fef7efb7d01fa170b"
},
{
"ImportPath": "github.com/docker/docker/client",
"Comment": "docs-v1.12.0-rc4-2016-07-15-9343-gb7b6b6929",
"Rev": "b7b6b6929c6436145bd12e6fef7efb7d01fa170b"
},
{
"ImportPath": "github.com/docker/go-connections/nat",
"Comment": "v0.3.0-13-g7395e3f",
"Rev": "7395e3f8aa162843a74ed6d48e79627d9792ac55"
},
{
"ImportPath": "github.com/docker/go-connections/sockets",
"Comment": "v0.3.0-13-g7395e3f",
"Rev": "7395e3f8aa162843a74ed6d48e79627d9792ac55"
},
{
"ImportPath": "github.com/docker/go-connections/tlsconfig",
"Comment": "v0.3.0-13-g7395e3f",
"Rev": "7395e3f8aa162843a74ed6d48e79627d9792ac55"
},
{
"ImportPath": "github.com/docker/go-units",
"Comment": "v0.3.2-4-g47565b4",
"Rev": "47565b4f722fb6ceae66b95f853feed578a4a51c"
},
{
"ImportPath": "github.com/emicklei/go-restful",
"Comment": "v2.6.1",
"Rev": "92cd0815dd1a028a6e69faee9757c7436238e252"
},
{
"ImportPath": "github.com/emicklei/go-restful/log",
"Comment": "v2.6.1",
"Rev": "92cd0815dd1a028a6e69faee9757c7436238e252"
},
{
"ImportPath": "github.com/gogo/protobuf/proto",
"Comment": "v1.0.0-16-g30cf7ac3",
"Rev": "30cf7ac33676b5786e78c746683f0d4cd64fa75b"
},
{
"ImportPath": "github.com/golang/glog",
"Rev": "23def4e6c14b4da8ac2ed8007337bc5eb5007998"
},
{
"ImportPath": "github.com/opencontainers/go-digest",
"Comment": "v1.0.0-rc1-2-gc928146",
"Rev": "c9281466c8b2f606084ac71339773efd177436e7"
},
{
"ImportPath": "github.com/opencontainers/image-spec/specs-go",
"Comment": "v1.0.0-35-ge562b04",
"Rev": "e562b04403929d582d449ae5386ff79dd7961a11"
},
{
"ImportPath": "github.com/opencontainers/image-spec/specs-go/v1",
"Comment": "v1.0.0-35-ge562b04",
"Rev": "e562b04403929d582d449ae5386ff79dd7961a11"
},
{
"ImportPath": "github.com/pkg/errors",
"Comment": "v0.8.0-12-g816c908",
"Rev": "816c9085562cd7ee03e7f8188a1cfd942858cded"
},
{
"ImportPath": "github.com/spf13/pflag",
"Comment": "v1.0.1",
"Rev": "583c0c0531f06d5278b7d917446061adc344b5cd"
},
{
"ImportPath": "golang.org/x/net/context",
"Rev": "6078986fec03a1dcc236c34816c71b0e05018fda"
},
{
"ImportPath": "golang.org/x/net/context/ctxhttp",
"Rev": "6078986fec03a1dcc236c34816c71b0e05018fda"
},
{
"ImportPath": "golang.org/x/net/proxy",
"Rev": "6078986fec03a1dcc236c34816c71b0e05018fda"
}
]
}

5
Godeps/Readme generated
View File

@@ -1,5 +0,0 @@
This directory tree is generated automatically by godep.
Please do not edit.
See https://github.com/tools/godep for more information.

View File

@@ -18,6 +18,7 @@ package main
import ( import (
"github.com/spf13/pflag" "github.com/spf13/pflag"
"kubesphere.io/kubesphere/pkg/app" "kubesphere.io/kubesphere/pkg/app"
"kubesphere.io/kubesphere/pkg/logs" "kubesphere.io/kubesphere/pkg/logs"
"kubesphere.io/kubesphere/pkg/options" "kubesphere.io/kubesphere/pkg/options"

View File

@@ -17,11 +17,13 @@ limitations under the License.
package components package components
import ( import (
"net/http"
"github.com/emicklei/go-restful" "github.com/emicklei/go-restful"
"kubesphere.io/kubesphere/pkg/constants"
"kubesphere.io/kubesphere/pkg/filter/route" "kubesphere.io/kubesphere/pkg/filter/route"
"kubesphere.io/kubesphere/pkg/models" "kubesphere.io/kubesphere/pkg/models"
"net/http"
"kubesphere.io/kubesphere/pkg/constants"
) )
func Register(ws *restful.WebService, subPath string) { func Register(ws *restful.WebService, subPath string) {

View File

@@ -18,14 +18,16 @@
package iam package iam
import ( import (
"github.com/emicklei/go-restful"
"kubesphere.io/kubesphere/pkg/filter/route"
"kubesphere.io/kubesphere/pkg/models"
"net/http" "net/http"
"strings" "strings"
"kubesphere.io/kubesphere/pkg/constants"
"github.com/emicklei/go-restful"
"k8s.io/api/rbac/v1" "k8s.io/api/rbac/v1"
"k8s.io/kubernetes/pkg/util/slice" "k8s.io/kubernetes/pkg/util/slice"
"kubesphere.io/kubesphere/pkg/constants"
"kubesphere.io/kubesphere/pkg/filter/route"
"kubesphere.io/kubesphere/pkg/models"
) )
func Register(ws *restful.WebService) { func Register(ws *restful.WebService) {

View File

@@ -20,6 +20,7 @@ package iam
import ( import (
"k8s.io/api/rbac/v1" "k8s.io/api/rbac/v1"
"k8s.io/kubernetes/pkg/util/slice" "k8s.io/kubernetes/pkg/util/slice"
"kubesphere.io/kubesphere/pkg/models" "kubesphere.io/kubesphere/pkg/models"
) )

View File

@@ -18,17 +18,18 @@ package v1alpha
import ( import (
"github.com/emicklei/go-restful" "github.com/emicklei/go-restful"
"kubesphere.io/kubesphere/pkg/apis/v1alpha/components"
"kubesphere.io/kubesphere/pkg/apis/v1alpha/containers" "kubesphere.io/kubesphere/pkg/apis/v1alpha/containers"
"kubesphere.io/kubesphere/pkg/apis/v1alpha/iam"
"kubesphere.io/kubesphere/pkg/apis/v1alpha/kubeconfig" "kubesphere.io/kubesphere/pkg/apis/v1alpha/kubeconfig"
"kubesphere.io/kubesphere/pkg/apis/v1alpha/kubectl" "kubesphere.io/kubesphere/pkg/apis/v1alpha/kubectl"
"kubesphere.io/kubesphere/pkg/apis/v1alpha/nodes" "kubesphere.io/kubesphere/pkg/apis/v1alpha/nodes"
"kubesphere.io/kubesphere/pkg/apis/v1alpha/pods" "kubesphere.io/kubesphere/pkg/apis/v1alpha/pods"
"kubesphere.io/kubesphere/pkg/apis/v1alpha/registries" "kubesphere.io/kubesphere/pkg/apis/v1alpha/registries"
"kubesphere.io/kubesphere/pkg/apis/v1alpha/routes"
"kubesphere.io/kubesphere/pkg/apis/v1alpha/storage" "kubesphere.io/kubesphere/pkg/apis/v1alpha/storage"
"kubesphere.io/kubesphere/pkg/apis/v1alpha/volumes" "kubesphere.io/kubesphere/pkg/apis/v1alpha/volumes"
"kubesphere.io/kubesphere/pkg/apis/v1alpha/iam"
"kubesphere.io/kubesphere/pkg/apis/v1alpha/components"
"kubesphere.io/kubesphere/pkg/apis/v1alpha/routes"
) )
func init() { func init() {

View File

@@ -15,8 +15,10 @@
package kubeconfig package kubeconfig
import ( import (
"github.com/emicklei/go-restful"
"net/http" "net/http"
"github.com/emicklei/go-restful"
"kubesphere.io/kubesphere/pkg/models" "kubesphere.io/kubesphere/pkg/models"
) )
@@ -29,7 +31,6 @@ type Config struct {
Token string Token string
} }
func Register(ws *restful.WebService, subPath string) { func Register(ws *restful.WebService, subPath string) {
ws.Route(ws.GET(subPath).To(handleKubeconfig)) ws.Route(ws.GET(subPath).To(handleKubeconfig))

View File

@@ -17,9 +17,11 @@ limitations under the License.
package kubectl package kubectl
import ( import (
"github.com/emicklei/go-restful"
"kubesphere.io/kubesphere/pkg/models"
"net/http" "net/http"
"github.com/emicklei/go-restful"
"kubesphere.io/kubesphere/pkg/models"
) )
func Register(ws *restful.WebService, subPath string) { func Register(ws *restful.WebService, subPath string) {

View File

@@ -1,10 +1,12 @@
package storage package storage
import ( import (
"net/http"
"github.com/emicklei/go-restful" "github.com/emicklei/go-restful"
"kubesphere.io/kubesphere/pkg/filter/route" "kubesphere.io/kubesphere/pkg/filter/route"
"kubesphere.io/kubesphere/pkg/models" "kubesphere.io/kubesphere/pkg/models"
"net/http"
) )
func Register(ws *restful.WebService, subPath string) { func Register(ws *restful.WebService, subPath string) {

View File

@@ -1,10 +1,12 @@
package volumes package volumes
import ( import (
"net/http"
"github.com/emicklei/go-restful" "github.com/emicklei/go-restful"
"kubesphere.io/kubesphere/pkg/filter/route" "kubesphere.io/kubesphere/pkg/filter/route"
"kubesphere.io/kubesphere/pkg/models" "kubesphere.io/kubesphere/pkg/models"
"net/http"
) )
func Register(ws *restful.WebService, subPath string) { func Register(ws *restful.WebService, subPath string) {

View File

@@ -19,12 +19,14 @@ package app
import ( import (
"crypto/tls" "crypto/tls"
"fmt" "fmt"
"github.com/emicklei/go-restful"
"github.com/golang/glog"
_ "kubesphere.io/kubesphere/pkg/apis/v1alpha"
"kubesphere.io/kubesphere/pkg/options"
"net" "net"
"net/http" "net/http"
"github.com/emicklei/go-restful"
"github.com/golang/glog"
_ "kubesphere.io/kubesphere/pkg/apis/v1alpha"
"kubesphere.io/kubesphere/pkg/options"
) )
type kubeSphereServer struct { type kubeSphereServer struct {

View File

@@ -16,13 +16,13 @@ limitations under the License.
package client package client
import ( import (
"kubesphere.io/kubesphere/pkg/options" "github.com/golang/glog"
"k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest" "k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd" "k8s.io/client-go/tools/clientcmd"
"github.com/golang/glog"
"kubesphere.io/kubesphere/pkg/options"
) )
var k8sClient *kubernetes.Clientset var k8sClient *kubernetes.Clientset

View File

@@ -17,9 +17,10 @@ limitations under the License.
package container package container
import ( import (
"strings"
"github.com/emicklei/go-restful" "github.com/emicklei/go-restful"
"github.com/golang/glog" "github.com/golang/glog"
"strings"
) )
func logFilter() restful.FilterFunction { func logFilter() restful.FilterFunction {

View File

@@ -17,10 +17,11 @@ limitations under the License.
package route package route
import ( import (
"github.com/emicklei/go-restful"
"github.com/golang/glog"
"strings" "strings"
"time" "time"
"github.com/emicklei/go-restful"
"github.com/golang/glog"
) )
// Route Filter (defines FilterFunction) // Route Filter (defines FilterFunction)

View File

@@ -18,16 +18,17 @@ package models
import ( import (
"bytes" "bytes"
"github.com/golang/glog"
"text/template"
"encoding/base64" "encoding/base64"
"text/template"
"github.com/golang/glog"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"kubesphere.io/kubesphere/pkg/client" "kubesphere.io/kubesphere/pkg/client"
"kubesphere.io/kubesphere/pkg/options" "kubesphere.io/kubesphere/pkg/options"
) )
var kubeconfigTemp = var kubeconfigTemp = "apiVersion: v1\n" +
"apiVersion: v1\n" +
"clusters:\n" + "clusters:\n" +
"- cluster:\n" + "- cluster:\n" +
" certificate-authority-data: {{.Certificate}}\n" + " certificate-authority-data: {{.Certificate}}\n" +

View File

@@ -19,13 +19,14 @@ package models
import ( import (
"fmt" "fmt"
"math/rand" "math/rand"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"kubesphere.io/kubesphere/pkg/client"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/api/core/v1" "k8s.io/api/core/v1"
) meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"kubesphere.io/kubesphere/pkg/client"
)
const ( const (
deploymentName = "kubectl" deploymentName = "kubectl"
@@ -65,7 +66,6 @@ func GetKubectlPod(namespace string) (kubectlPodInfo, error) {
} }
func selectCorrectPod(namespace string, pods []v1.Pod) (kubectlPod v1.Pod, err error) { func selectCorrectPod(namespace string, pods []v1.Pod) (kubectlPod v1.Pod, err error) {
var kubectPodList []v1.Pod var kubectPodList []v1.Pod

View File

@@ -25,6 +25,7 @@ import (
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"kubesphere.io/kubesphere/pkg/client" "kubesphere.io/kubesphere/pkg/client"
ksutil "kubesphere.io/kubesphere/pkg/util" ksutil "kubesphere.io/kubesphere/pkg/util"

View File

@@ -14,9 +14,11 @@ import (
"fmt" "fmt"
"strconv" "strconv"
"k8s.io/apimachinery/pkg/apis/meta/v1"
"kubesphere.io/kubesphere/pkg/constants"
"math" "math"
"k8s.io/apimachinery/pkg/apis/meta/v1"
"kubesphere.io/kubesphere/pkg/constants"
) )
type ResultPod struct { type ResultPod struct {

View File

@@ -2,8 +2,9 @@ package models
import ( import (
"k8s.io/api/rbac/v1" "k8s.io/api/rbac/v1"
"kubesphere.io/kubesphere/pkg/client"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"kubesphere.io/kubesphere/pkg/client"
) )
const ClusterRoleKind = "ClusterRole" const ClusterRoleKind = "ClusterRole"

View File

@@ -17,15 +17,15 @@ limitations under the License.
package models package models
import ( import (
"strings"
"io/ioutil" "io/ioutil"
"strings"
"github.com/golang/glog"
coreV1 "k8s.io/api/core/v1" coreV1 "k8s.io/api/core/v1"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/scheme"
extensionsV1beta1 "k8s.io/api/extensions/v1beta1" extensionsV1beta1 "k8s.io/api/extensions/v1beta1"
"k8s.io/api/rbac/v1beta1" "k8s.io/api/rbac/v1beta1"
"github.com/golang/glog" metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/scheme"
"kubesphere.io/kubesphere/pkg/client" "kubesphere.io/kubesphere/pkg/client"
) )

View File

@@ -4,6 +4,7 @@ import (
v12 "k8s.io/api/core/v1" v12 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1"
"kubesphere.io/kubesphere/pkg/client" "kubesphere.io/kubesphere/pkg/client"
) )

View File

@@ -3,6 +3,7 @@ package models
import ( import (
v12 "k8s.io/api/core/v1" v12 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1"
"kubesphere.io/kubesphere/pkg/client" "kubesphere.io/kubesphere/pkg/client"
) )

View File

@@ -19,8 +19,9 @@ package options
import ( import (
goflag "flag" goflag "flag"
"github.com/spf13/pflag"
"net" "net"
"github.com/spf13/pflag"
) )
// ServerRunOptions runs a kubernetes api server. // ServerRunOptions runs a kubernetes api server.

View File

@@ -18,8 +18,9 @@ package util
import ( import (
"encoding/json" "encoding/json"
"github.com/golang/glog"
"strings" "strings"
"github.com/golang/glog"
) )
type JsonRawMessage []byte type JsonRawMessage []byte

View File

@@ -18,8 +18,10 @@ package version
import ( import (
"fmt" "fmt"
"github.com/spf13/pflag"
"os" "os"
"github.com/spf13/pflag"
"kubesphere.io/kubesphere/pkg/constants" "kubesphere.io/kubesphere/pkg/constants"
) )