add goimports format action (#3630)

Signed-off-by: Jeff <jeffzhang@yunify.com>
This commit is contained in:
zryfish
2021-03-30 13:44:24 +08:00
committed by GitHub
parent 40e3751e43
commit ac275b6e98
561 changed files with 1713 additions and 863 deletions

View File

@@ -21,6 +21,7 @@ import (
"strings"
"github.com/spf13/pflag"
"kubesphere.io/kubesphere/pkg/utils/reflectutils"
)

View File

@@ -4,8 +4,9 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/pkg/errors"
"net/http"
"github.com/pkg/errors"
)
import "github.com/prometheus/client_golang/api"

View File

@@ -18,7 +18,9 @@ package elasticsearch
import (
"fmt"
"github.com/json-iterator/go"
jsoniter "github.com/json-iterator/go"
"kubesphere.io/kubesphere/pkg/simple/client/auditing"
"kubesphere.io/kubesphere/pkg/simple/client/es"
"kubesphere.io/kubesphere/pkg/simple/client/es/query"

View File

@@ -17,14 +17,16 @@ limitations under the License.
package elasticsearch
import (
"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/assert"
"kubesphere.io/kubesphere/pkg/simple/client/auditing"
"net/http"
"net/http/httptest"
"strings"
"testing"
"time"
"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/assert"
"kubesphere.io/kubesphere/pkg/simple/client/auditing"
)
func MockElasticsearchService(pattern string, fakeCode int, fakeResp string) *httptest.Server {

View File

@@ -17,9 +17,11 @@ limitations under the License.
package auditing
import (
"github.com/spf13/pflag"
"kubesphere.io/kubesphere/pkg/utils/reflectutils"
"time"
"github.com/spf13/pflag"
"kubesphere.io/kubesphere/pkg/utils/reflectutils"
)
type Options struct {

View File

@@ -18,6 +18,7 @@ package cache
import (
"fmt"
"github.com/spf13/pflag"
)

View File

@@ -18,9 +18,10 @@ package cache
import (
"fmt"
"time"
"github.com/go-redis/redis"
"k8s.io/klog"
"time"
)
type Client struct {

View File

@@ -17,10 +17,11 @@ limitations under the License.
package cache
import (
"kubesphere.io/kubesphere/pkg/server/errors"
"regexp"
"strings"
"time"
"kubesphere.io/kubesphere/pkg/server/errors"
)
var ErrNoSuchKey = errors.New("no such key")

View File

@@ -17,10 +17,11 @@ limitations under the License.
package cache
import (
"github.com/google/go-cmp/cmp"
"k8s.io/apimachinery/pkg/util/sets"
"testing"
"time"
"github.com/google/go-cmp/cmp"
"k8s.io/apimachinery/pkg/util/sets"
)
var dataSet = map[string]string{

View File

@@ -18,14 +18,16 @@ package fake
import (
"fmt"
"github.com/emicklei/go-restful"
"io/ioutil"
v1 "k8s.io/api/core/v1"
devopsv1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
"net/http"
"net/url"
"strings"
"github.com/emicklei/go-restful"
v1 "k8s.io/api/core/v1"
devopsv1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
)
type Devops struct {

View File

@@ -18,9 +18,10 @@ package devops
import (
"fmt"
"github.com/asaskevich/govalidator"
"net/http"
"strconv"
"github.com/asaskevich/govalidator"
)
type Interface interface {

View File

@@ -17,12 +17,14 @@ package jenkins
import (
"bytes"
"errors"
"github.com/emicklei/go-restful"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
"net/http"
"net/url"
"strconv"
"time"
"github.com/emicklei/go-restful"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
)
const (

View File

@@ -16,13 +16,15 @@ package jenkins
import (
"errors"
"fmt"
"net/http"
"strconv"
"github.com/emicklei/go-restful"
v1 "k8s.io/api/core/v1"
"k8s.io/klog"
devopsv1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
"net/http"
"strconv"
)
const SSHCrenditalStaplerClass = "com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey"

View File

@@ -17,9 +17,10 @@ limitations under the License.
package jenkins
import (
"testing"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"testing"
)
func TestNewUsernamePasswordCredential(t *testing.T) {

View File

@@ -1,11 +1,12 @@
package internal
import (
"github.com/beevik/etree"
"k8s.io/klog"
"strconv"
"strings"
"github.com/beevik/etree"
"k8s.io/klog"
devopsv1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
)

View File

@@ -1,10 +1,12 @@
package internal
import (
"strconv"
"github.com/beevik/etree"
"k8s.io/klog"
devopsv1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
"strconv"
)
func AppendGitSourceToEtree(source *etree.Element, gitSource *devopsv1alpha3.GitSource) {

View File

@@ -1,11 +1,13 @@
package internal
import (
"github.com/beevik/etree"
"k8s.io/klog"
devopsv1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
"strconv"
"strings"
"github.com/beevik/etree"
"k8s.io/klog"
devopsv1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
)
func AppendGithubSourceToEtree(source *etree.Element, githubSource *devopsv1alpha3.GithubSource) {

View File

@@ -1,11 +1,13 @@
package internal
import (
"github.com/beevik/etree"
"k8s.io/klog"
devopsv1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
"strconv"
"strings"
"github.com/beevik/etree"
"k8s.io/klog"
devopsv1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
)
func AppendGitlabSourceToEtree(source *etree.Element, gitSource *devopsv1alpha3.GitlabSource) {

View File

@@ -1,8 +1,9 @@
package internal
import (
"github.com/stretchr/testify/assert"
"testing"
"github.com/stretchr/testify/assert"
)
func TestPRDiscoverTrust(t *testing.T) {

View File

@@ -21,8 +21,6 @@ import (
"fmt"
"io"
"io/ioutil"
"k8s.io/klog"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
"log"
"net/http"
"net/url"
@@ -30,6 +28,10 @@ import (
"reflect"
"strconv"
"strings"
"k8s.io/klog"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
)
// Basic Authentication

View File

@@ -19,11 +19,12 @@ import (
"encoding/json"
"errors"
"fmt"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
"net/url"
"path"
"strconv"
"strings"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
)
type Job struct {

View File

@@ -18,7 +18,9 @@ package jenkins
import (
"fmt"
"github.com/spf13/pflag"
"kubesphere.io/kubesphere/pkg/utils/reflectutils"
)

View File

@@ -20,14 +20,16 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/PuerkitoBio/goquery"
"k8s.io/klog"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
"net/http"
"net/url"
"strconv"
"strings"
"time"
"github.com/PuerkitoBio/goquery"
"k8s.io/klog"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
)
type Pipeline struct {

View File

@@ -18,12 +18,14 @@ package jenkins
import (
"fmt"
"github.com/beevik/etree"
devopsv1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
"kubesphere.io/kubesphere/pkg/simple/client/devops/jenkins/internal"
"strconv"
"strings"
"time"
"github.com/beevik/etree"
devopsv1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
"kubesphere.io/kubesphere/pkg/simple/client/devops/jenkins/internal"
)
func replaceXmlVersion(config, oldVersion, targetVersion string) string {

View File

@@ -17,9 +17,10 @@ limitations under the License.
package jenkins
import (
devopsv1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
"reflect"
"testing"
devopsv1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
)
func Test_NoScmPipelineConfig(t *testing.T) {

View File

@@ -2,11 +2,13 @@ package jenkins
import (
"fmt"
"github.com/stretchr/testify/assert"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
"net/url"
"strconv"
"testing"
"github.com/stretchr/testify/assert"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
)
func TestResetPaging(t *testing.T) {

View File

@@ -19,6 +19,7 @@ package jenkins
import (
"github.com/emicklei/go-restful"
"k8s.io/klog"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
)

View File

@@ -18,11 +18,13 @@ package jenkins
import (
"fmt"
"net/http"
"github.com/emicklei/go-restful"
"k8s.io/klog"
devopsv1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
"net/http"
)
func (j *Jenkins) CreateProjectPipeline(projectId string, pipeline *devopsv1alpha3.Pipeline) (string, error) {

View File

@@ -17,11 +17,13 @@ limitations under the License.
package jenkins
import (
"k8s.io/klog"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
"net/http"
"net/url"
"time"
"k8s.io/klog"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
)
// TODO: deprecated, use SendJenkinsRequestWithHeaderResp() instead

View File

@@ -20,17 +20,19 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/dgrijalva/jwt-go"
"io"
"io/ioutil"
authtoken "kubesphere.io/kubesphere/pkg/apiserver/authentication/token"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
"mime/multipart"
"net/http"
"net/url"
"os"
"path/filepath"
"strings"
"github.com/dgrijalva/jwt-go"
authtoken "kubesphere.io/kubesphere/pkg/apiserver/authentication/token"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
)
// Request Methods

View File

@@ -18,11 +18,12 @@ package jenkins
import (
"errors"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
"net/http"
"reflect"
"strconv"
"strings"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
)
type GlobalRoleResponse struct {

View File

@@ -19,12 +19,13 @@ import (
"encoding/json"
"io"
"io/ioutil"
"k8s.io/klog"
"net/http"
"net/url"
"strings"
"time"
"unicode/utf8"
"k8s.io/klog"
)
func makeJson(data interface{}) string {

View File

@@ -1,9 +1,10 @@
package jenkins
import (
"github.com/stretchr/testify/assert"
"net/url"
"testing"
"github.com/stretchr/testify/assert"
)
func TestParseJenkinsQuery(t *testing.T) {

View File

@@ -2,8 +2,9 @@ package devops
import (
"fmt"
"gotest.tools/assert"
"testing"
"gotest.tools/assert"
)
func TestGetSubmitters(t *testing.T) {

View File

@@ -19,16 +19,18 @@ package es
import (
"context"
"fmt"
"github.com/json-iterator/go"
"kubesphere.io/kubesphere/pkg/simple/client/es/query"
"kubesphere.io/kubesphere/pkg/simple/client/es/versions"
"kubesphere.io/kubesphere/pkg/simple/client/es/versions/v5"
"kubesphere.io/kubesphere/pkg/simple/client/es/versions/v6"
"kubesphere.io/kubesphere/pkg/simple/client/es/versions/v7"
"kubesphere.io/kubesphere/pkg/utils/esutil"
"strings"
"sync"
"time"
jsoniter "github.com/json-iterator/go"
"kubesphere.io/kubesphere/pkg/simple/client/es/query"
"kubesphere.io/kubesphere/pkg/simple/client/es/versions"
v5 "kubesphere.io/kubesphere/pkg/simple/client/es/versions/v5"
v6 "kubesphere.io/kubesphere/pkg/simple/client/es/versions/v6"
v7 "kubesphere.io/kubesphere/pkg/simple/client/es/versions/v7"
"kubesphere.io/kubesphere/pkg/utils/esutil"
)
const (

View File

@@ -18,14 +18,16 @@ package es
import (
"fmt"
"github.com/google/go-cmp/cmp"
"github.com/json-iterator/go"
"io/ioutil"
"kubesphere.io/kubesphere/pkg/simple/client/es/query"
"net/http"
"net/http/httptest"
"testing"
"time"
"github.com/google/go-cmp/cmp"
jsoniter "github.com/json-iterator/go"
"kubesphere.io/kubesphere/pkg/simple/client/es/query"
)
func TestNewClient(t *testing.T) {

View File

@@ -1,8 +1,9 @@
package query
import (
"github.com/json-iterator/go"
"reflect"
jsoniter "github.com/json-iterator/go"
)
// TODO: elastic/go-elasticsearch is working on Query DSL support.

View File

@@ -1,7 +1,7 @@
package es
import (
"github.com/json-iterator/go"
jsoniter "github.com/json-iterator/go"
"k8s.io/klog"
)

View File

@@ -21,10 +21,11 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/elastic/go-elasticsearch/v5"
"github.com/elastic/go-elasticsearch/v5/esapi"
"io/ioutil"
"time"
"github.com/elastic/go-elasticsearch/v5"
"github.com/elastic/go-elasticsearch/v5/esapi"
)
type Elastic struct {

View File

@@ -21,10 +21,11 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/elastic/go-elasticsearch/v6"
"github.com/elastic/go-elasticsearch/v6/esapi"
"io/ioutil"
"time"
"github.com/elastic/go-elasticsearch/v6"
"github.com/elastic/go-elasticsearch/v6/esapi"
)
type Elastic struct {

View File

@@ -21,10 +21,11 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/elastic/go-elasticsearch/v7"
"github.com/elastic/go-elasticsearch/v7/esapi"
"io/ioutil"
"time"
"github.com/elastic/go-elasticsearch/v7"
"github.com/elastic/go-elasticsearch/v7/esapi"
)
type Elastic struct {

View File

@@ -18,6 +18,7 @@ package elasticsearch
import (
"fmt"
"kubesphere.io/kubesphere/pkg/simple/client/es"
"kubesphere.io/kubesphere/pkg/simple/client/es/query"
"kubesphere.io/kubesphere/pkg/simple/client/events"

View File

@@ -18,14 +18,16 @@ package elasticsearch
import (
"encoding/json"
"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/assert"
"kubesphere.io/kubesphere/pkg/simple/client/events"
"net/http"
"net/http/httptest"
"strings"
"testing"
"time"
"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/assert"
"kubesphere.io/kubesphere/pkg/simple/client/events"
)
func MockElasticsearchService(pattern string, fakeCode int, fakeResp string) *httptest.Server {

View File

@@ -18,6 +18,7 @@ package events
import (
"github.com/spf13/pflag"
"kubesphere.io/kubesphere/pkg/utils/reflectutils"
)

View File

@@ -24,6 +24,7 @@ import (
"k8s.io/client-go/discovery"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
kubesphere "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
)

View File

@@ -27,6 +27,7 @@ import (
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
kubesphere "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
)

View File

@@ -24,6 +24,7 @@ import (
"k8s.io/client-go/discovery"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
kubesphere "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
)

View File

@@ -17,9 +17,11 @@ limitations under the License.
package k8s
import (
"github.com/spf13/pflag"
"kubesphere.io/kubesphere/pkg/utils/reflectutils"
"os"
"github.com/spf13/pflag"
"kubesphere.io/kubesphere/pkg/utils/reflectutils"
)
type KubernetesOptions struct {

View File

@@ -18,6 +18,7 @@ package kubeedge
import (
"github.com/spf13/pflag"
"kubesphere.io/kubesphere/pkg/utils/reflectutils"
)

View File

@@ -18,17 +18,19 @@ package ldap
import (
"fmt"
"github.com/go-ldap/ldap"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/klog"
"kubesphere.io/kubesphere/pkg/api"
iamv1alpha2 "kubesphere.io/kubesphere/pkg/apis/iam/v1alpha2"
"kubesphere.io/kubesphere/pkg/apiserver/query"
"kubesphere.io/kubesphere/pkg/server/errors"
"sort"
"strings"
"sync"
"time"
"github.com/go-ldap/ldap"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/klog"
"kubesphere.io/kubesphere/pkg/api"
iamv1alpha2 "kubesphere.io/kubesphere/pkg/apis/iam/v1alpha2"
"kubesphere.io/kubesphere/pkg/apiserver/query"
"kubesphere.io/kubesphere/pkg/server/errors"
)
const (

View File

@@ -18,6 +18,7 @@ package ldap
import (
"github.com/spf13/pflag"
"kubesphere.io/kubesphere/pkg/utils/reflectutils"
)

View File

@@ -18,6 +18,7 @@ package ldap
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"kubesphere.io/kubesphere/pkg/api"
iamv1alpha2 "kubesphere.io/kubesphere/pkg/apis/iam/v1alpha2"
"kubesphere.io/kubesphere/pkg/apiserver/query"

View File

@@ -17,10 +17,12 @@ limitations under the License.
package ldap
import (
"testing"
"github.com/google/go-cmp/cmp"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
iamv1alpha2 "kubesphere.io/kubesphere/pkg/apis/iam/v1alpha2"
"testing"
)
func TestSimpleLdap(t *testing.T) {

View File

@@ -21,10 +21,11 @@ import (
"encoding/json"
"fmt"
"io"
"time"
"kubesphere.io/kubesphere/pkg/simple/client/es"
"kubesphere.io/kubesphere/pkg/simple/client/es/query"
"kubesphere.io/kubesphere/pkg/simple/client/logging"
"time"
"kubesphere.io/kubesphere/pkg/utils/stringutils"
)

View File

@@ -18,16 +18,18 @@ package elasticsearch
import (
"fmt"
"github.com/google/go-cmp/cmp"
"github.com/json-iterator/go"
"io/ioutil"
"kubesphere.io/kubesphere/pkg/simple/client/es"
"kubesphere.io/kubesphere/pkg/simple/client/es/query"
"kubesphere.io/kubesphere/pkg/simple/client/logging"
"net/http"
"net/http/httptest"
"testing"
"time"
"github.com/google/go-cmp/cmp"
jsoniter "github.com/json-iterator/go"
"kubesphere.io/kubesphere/pkg/simple/client/es"
"kubesphere.io/kubesphere/pkg/simple/client/es/query"
"kubesphere.io/kubesphere/pkg/simple/client/logging"
)
func TestGetCurrentStats(t *testing.T) {

View File

@@ -18,6 +18,7 @@ package logging
import (
"github.com/spf13/pflag"
"kubesphere.io/kubesphere/pkg/utils/reflectutils"
)

View File

@@ -21,7 +21,7 @@ import (
"errors"
"time"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"

View File

@@ -5,12 +5,12 @@ import (
"testing"
"time"
"github.com/google/go-cmp/cmp"
"github.com/json-iterator/go"
"io/ioutil"
"k8s.io/api/core/v1"
corev1 "k8s.io/api/core/v1"
"github.com/google/go-cmp/cmp"
jsoniter "github.com/json-iterator/go"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
@@ -25,8 +25,8 @@ import (
// mergeResourceLists will merge resoure lists. When two lists have the same resourece, the value from
// the last list will be present in the result
func mergeResourceLists(resourceLists ...corev1.ResourceList) corev1.ResourceList {
result := corev1.ResourceList{}
func mergeResourceLists(resourceLists ...v1.ResourceList) v1.ResourceList {
result := v1.ResourceList{}
for _, rl := range resourceLists {
for resource, quantity := range rl {
result[resource] = quantity
@@ -35,38 +35,38 @@ func mergeResourceLists(resourceLists ...corev1.ResourceList) corev1.ResourceLis
return result
}
func getResourceList(cpu, memory string) corev1.ResourceList {
res := corev1.ResourceList{}
func getResourceList(cpu, memory string) v1.ResourceList {
res := v1.ResourceList{}
if cpu != "" {
res[corev1.ResourceCPU] = resource.MustParse(cpu)
res[v1.ResourceCPU] = resource.MustParse(cpu)
}
if memory != "" {
res[corev1.ResourceMemory] = resource.MustParse(memory)
res[v1.ResourceMemory] = resource.MustParse(memory)
}
return res
}
var nodeCapacity = mergeResourceLists(getResourceList("8", "8Gi"))
var node1 = &corev1.Node{
var node1 = &v1.Node{
ObjectMeta: metav1.ObjectMeta{
Name: "edgenode-1",
Labels: map[string]string{
"node-role.kubernetes.io/edge": "",
},
},
Status: corev1.NodeStatus{
Status: v1.NodeStatus{
Capacity: nodeCapacity,
},
}
var node2 = &corev1.Node{
var node2 = &v1.Node{
ObjectMeta: metav1.ObjectMeta{
Name: "edgenode-2",
Labels: map[string]string{
"node-role.kubernetes.io/edge": "",
},
},
Status: corev1.NodeStatus{
Status: v1.NodeStatus{
Capacity: nodeCapacity,
},
}

View File

@@ -27,6 +27,7 @@ import (
apiv1 "github.com/prometheus/client_golang/api/prometheus/v1"
"github.com/prometheus/common/model"
"k8s.io/klog"
"kubesphere.io/kubesphere/pkg/simple/client/monitoring"
)

View File

@@ -18,14 +18,16 @@ package prometheus
import (
"fmt"
"github.com/google/go-cmp/cmp"
"github.com/json-iterator/go"
"io/ioutil"
"kubesphere.io/kubesphere/pkg/simple/client/monitoring"
"net/http"
"net/http/httptest"
"testing"
"time"
"github.com/google/go-cmp/cmp"
jsoniter "github.com/json-iterator/go"
"kubesphere.io/kubesphere/pkg/simple/client/monitoring"
)
func TestGetNamedMetrics(t *testing.T) {

View File

@@ -19,6 +19,7 @@ import (
"strings"
"k8s.io/klog"
"kubesphere.io/kubesphere/pkg/simple/client/monitoring"
)

View File

@@ -17,10 +17,12 @@ limitations under the License.
package prometheus
import (
"testing"
"github.com/google/go-cmp/cmp"
"kubesphere.io/kubesphere/pkg/simple/client/monitoring"
"kubesphere.io/kubesphere/pkg/simple/client/monitoring/prometheus/testdata"
"testing"
)
func TestMakeExpr(t *testing.T) {

View File

@@ -19,11 +19,12 @@ package monitoring
import (
"errors"
"fmt"
"github.com/json-iterator/go"
"github.com/jszwec/csvutil"
"strconv"
"strings"
"time"
jsoniter "github.com/json-iterator/go"
"github.com/jszwec/csvutil"
)
const (

View File

@@ -15,6 +15,7 @@ package mysql
import (
"fmt"
"github.com/gocraft/dbr"
"k8s.io/klog"
)

View File

@@ -17,9 +17,11 @@ limitations under the License.
package mysql
import (
"github.com/spf13/pflag"
"kubesphere.io/kubesphere/pkg/utils/reflectutils"
"time"
"github.com/spf13/pflag"
"kubesphere.io/kubesphere/pkg/utils/reflectutils"
)
type Options struct {

View File

@@ -24,6 +24,7 @@ import (
discovery "k8s.io/client-go/discovery"
rest "k8s.io/client-go/rest"
flowcontrol "k8s.io/client-go/util/flowcontrol"
crdcalicov3 "kubesphere.io/kubesphere/pkg/simple/client/network/ippool/calico/client/clientset/versioned/typed/network/calicov3"
)

View File

@@ -24,6 +24,7 @@ import (
"k8s.io/client-go/discovery"
fakediscovery "k8s.io/client-go/discovery/fake"
"k8s.io/client-go/testing"
clientset "kubesphere.io/kubesphere/pkg/simple/client/network/ippool/calico/client/clientset/versioned"
crdcalicov3 "kubesphere.io/kubesphere/pkg/simple/client/network/ippool/calico/client/clientset/versioned/typed/network/calicov3"
fakecrdcalicov3 "kubesphere.io/kubesphere/pkg/simple/client/network/ippool/calico/client/clientset/versioned/typed/network/calicov3/fake"

View File

@@ -24,6 +24,7 @@ import (
schema "k8s.io/apimachinery/pkg/runtime/schema"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
crdcalicov3 "kubesphere.io/kubesphere/pkg/apis/network/calicov3"
)

View File

@@ -24,6 +24,7 @@ import (
schema "k8s.io/apimachinery/pkg/runtime/schema"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
crdcalicov3 "kubesphere.io/kubesphere/pkg/apis/network/calicov3"
)

View File

@@ -26,6 +26,7 @@ import (
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
calicov3 "kubesphere.io/kubesphere/pkg/apis/network/calicov3"
scheme "kubesphere.io/kubesphere/pkg/simple/client/network/ippool/calico/client/clientset/versioned/scheme"
)

View File

@@ -27,6 +27,7 @@ import (
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
calicov3 "kubesphere.io/kubesphere/pkg/apis/network/calicov3"
)

View File

@@ -27,6 +27,7 @@ import (
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
calicov3 "kubesphere.io/kubesphere/pkg/apis/network/calicov3"
)

View File

@@ -27,6 +27,7 @@ import (
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
calicov3 "kubesphere.io/kubesphere/pkg/apis/network/calicov3"
)

View File

@@ -21,6 +21,7 @@ package fake
import (
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
calicov3 "kubesphere.io/kubesphere/pkg/simple/client/network/ippool/calico/client/clientset/versioned/typed/network/calicov3"
)

View File

@@ -26,6 +26,7 @@ import (
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
calicov3 "kubesphere.io/kubesphere/pkg/apis/network/calicov3"
scheme "kubesphere.io/kubesphere/pkg/simple/client/network/ippool/calico/client/clientset/versioned/scheme"
)

View File

@@ -26,6 +26,7 @@ import (
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
calicov3 "kubesphere.io/kubesphere/pkg/apis/network/calicov3"
scheme "kubesphere.io/kubesphere/pkg/simple/client/network/ippool/calico/client/clientset/versioned/scheme"
)

View File

@@ -20,6 +20,7 @@ package calicov3
import (
rest "k8s.io/client-go/rest"
calicov3 "kubesphere.io/kubesphere/pkg/apis/network/calicov3"
"kubesphere.io/kubesphere/pkg/simple/client/network/ippool/calico/client/clientset/versioned/scheme"
)

View File

@@ -27,6 +27,7 @@ import (
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
cache "k8s.io/client-go/tools/cache"
versioned "kubesphere.io/kubesphere/pkg/simple/client/network/ippool/calico/client/clientset/versioned"
internalinterfaces "kubesphere.io/kubesphere/pkg/simple/client/network/ippool/calico/client/informers/externalversions/internalinterfaces"
network "kubesphere.io/kubesphere/pkg/simple/client/network/ippool/calico/client/informers/externalversions/network"

View File

@@ -23,6 +23,7 @@ import (
schema "k8s.io/apimachinery/pkg/runtime/schema"
cache "k8s.io/client-go/tools/cache"
calicov3 "kubesphere.io/kubesphere/pkg/apis/network/calicov3"
)

View File

@@ -24,6 +24,7 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
cache "k8s.io/client-go/tools/cache"
versioned "kubesphere.io/kubesphere/pkg/simple/client/network/ippool/calico/client/clientset/versioned"
)

View File

@@ -26,6 +26,7 @@ import (
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
networkcalicov3 "kubesphere.io/kubesphere/pkg/apis/network/calicov3"
versioned "kubesphere.io/kubesphere/pkg/simple/client/network/ippool/calico/client/clientset/versioned"
internalinterfaces "kubesphere.io/kubesphere/pkg/simple/client/network/ippool/calico/client/informers/externalversions/internalinterfaces"

View File

@@ -26,6 +26,7 @@ import (
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
networkcalicov3 "kubesphere.io/kubesphere/pkg/apis/network/calicov3"
versioned "kubesphere.io/kubesphere/pkg/simple/client/network/ippool/calico/client/clientset/versioned"
internalinterfaces "kubesphere.io/kubesphere/pkg/simple/client/network/ippool/calico/client/informers/externalversions/internalinterfaces"

View File

@@ -26,6 +26,7 @@ import (
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
networkcalicov3 "kubesphere.io/kubesphere/pkg/apis/network/calicov3"
versioned "kubesphere.io/kubesphere/pkg/simple/client/network/ippool/calico/client/clientset/versioned"
internalinterfaces "kubesphere.io/kubesphere/pkg/simple/client/network/ippool/calico/client/informers/externalversions/internalinterfaces"

View File

@@ -22,6 +22,7 @@ import (
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
calicov3 "kubesphere.io/kubesphere/pkg/apis/network/calicov3"
)

View File

@@ -22,6 +22,7 @@ import (
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
calicov3 "kubesphere.io/kubesphere/pkg/apis/network/calicov3"
)

View File

@@ -22,6 +22,7 @@ import (
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
calicov3 "kubesphere.io/kubesphere/pkg/apis/network/calicov3"
)

View File

@@ -21,10 +21,11 @@ import (
"encoding/json"
"errors"
"fmt"
k8sinformers "k8s.io/client-go/informers"
"net"
"time"
k8sinformers "k8s.io/client-go/informers"
v3 "github.com/projectcalico/libcalico-go/lib/apis/v3"
"github.com/projectcalico/libcalico-go/lib/backend/model"
cnet "github.com/projectcalico/libcalico-go/lib/net"
@@ -41,6 +42,8 @@ import (
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/util/workqueue"
"k8s.io/klog"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
"kubesphere.io/kubesphere/pkg/apis/network/calicov3"
"kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
kubesphereclient "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
@@ -50,7 +53,6 @@ import (
calicoset "kubesphere.io/kubesphere/pkg/simple/client/network/ippool/calico/client/clientset/versioned"
calicoInformer "kubesphere.io/kubesphere/pkg/simple/client/network/ippool/calico/client/informers/externalversions"
blockInformer "kubesphere.io/kubesphere/pkg/simple/client/network/ippool/calico/client/informers/externalversions/network/calicov3"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
)
const (

View File

@@ -18,13 +18,15 @@ package calico
import (
"flag"
tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1"
"testing"
tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/klog"
"kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
ksfake "kubesphere.io/kubesphere/pkg/client/clientset/versioned/fake"
"kubesphere.io/kubesphere/pkg/constants"

View File

@@ -18,6 +18,7 @@ package ipam
import (
"github.com/containernetworking/cni/pkg/types/current"
"kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
)

View File

@@ -33,11 +33,12 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/klog"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
"kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
kubesphere "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
"kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme"
"kubesphere.io/kubesphere/pkg/simple/client/network/utils"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
)
const (

View File

@@ -20,13 +20,15 @@ import (
"context"
"flag"
"fmt"
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/klog"
"kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
ksfake "kubesphere.io/kubesphere/pkg/client/clientset/versioned/fake"
"testing"
)
func TestIPAM_blockGenerator(t *testing.T) {

View File

@@ -22,6 +22,7 @@ import (
k8sinformers "k8s.io/client-go/informers"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/client-go/util/workqueue"
networkv1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
kubesphereclient "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
"kubesphere.io/kubesphere/pkg/simple/client/k8s"

View File

@@ -21,6 +21,7 @@ import (
"testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
fakeks "kubesphere.io/kubesphere/pkg/client/clientset/versioned/fake"
"kubesphere.io/kubesphere/pkg/simple/client/network/ippool/ipam"

View File

@@ -20,12 +20,14 @@ import (
"bytes"
"context"
"fmt"
"helm.sh/helm/v3/pkg/getter"
"kubesphere.io/kubesphere/pkg/apis/application/v1alpha1"
"kubesphere.io/kubesphere/pkg/simple/client/s3"
"net/url"
"strings"
"time"
"helm.sh/helm/v3/pkg/getter"
"kubesphere.io/kubesphere/pkg/apis/application/v1alpha1"
"kubesphere.io/kubesphere/pkg/simple/client/s3"
)
func parseS3Url(parse *url.URL) (region, endpoint, bucket, path string) {

View File

@@ -20,11 +20,12 @@ import (
"bytes"
"encoding/json"
"fmt"
"helm.sh/helm/v3/pkg/repo"
"k8s.io/klog"
"strings"
"time"
"helm.sh/helm/v3/pkg/repo"
"k8s.io/klog"
"helm.sh/helm/v3/pkg/chart/loader"
)

View File

@@ -23,16 +23,18 @@ import (
"encoding/base64"
"encoding/json"
"fmt"
helmrepo "helm.sh/helm/v3/pkg/repo"
"io"
"io/ioutil"
"strings"
"time"
helmrepo "helm.sh/helm/v3/pkg/repo"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/yaml"
"kubesphere.io/kubesphere/pkg/apis/application/v1alpha1"
"kubesphere.io/kubesphere/pkg/constants"
"kubesphere.io/kubesphere/pkg/utils/idutils"
"sigs.k8s.io/yaml"
"strings"
"time"
)
const IndexYaml = "index.yaml"

View File

@@ -19,9 +19,10 @@ package helmrepoindex
import (
"context"
"fmt"
"kubesphere.io/kubesphere/pkg/apis/application/v1alpha1"
"strings"
"testing"
"kubesphere.io/kubesphere/pkg/apis/application/v1alpha1"
)
func TestLoadRepo(t *testing.T) {

View File

@@ -20,18 +20,20 @@ import (
"bytes"
"encoding/json"
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
"time"
"gopkg.in/yaml.v3"
helmrelease "helm.sh/helm/v3/pkg/release"
"k8s.io/klog"
kpath "k8s.io/utils/path"
"sigs.k8s.io/kustomize/pkg/types"
"kubesphere.io/kubesphere/pkg/server/errors"
"kubesphere.io/kubesphere/pkg/utils/idutils"
"os"
"os/exec"
"path/filepath"
"sigs.k8s.io/kustomize/pkg/types"
"strings"
"time"
)
const (

View File

@@ -18,9 +18,10 @@ package helmwrapper
import (
"fmt"
"kubesphere.io/kubesphere/pkg/constants"
"os"
"testing"
"kubesphere.io/kubesphere/pkg/constants"
)
func TestHelmInstall(t *testing.T) {

View File

@@ -18,6 +18,7 @@ package openpitrix
import (
"github.com/spf13/pflag"
"kubesphere.io/kubesphere/pkg/simple/client/s3"
"kubesphere.io/kubesphere/pkg/utils/reflectutils"
)

Some files were not shown because too many files have changed in this diff Show More