Ran go fmt on code

This commit is contained in:
Yinan Li 2018-01-29 12:54:47 -08:00
parent 56ec190de2
commit 2520f0547e
14 changed files with 42 additions and 42 deletions

10
main.go
View File

@ -25,10 +25,6 @@ import (
"github.com/golang/glog"
"k8s.io/spark-on-k8s-operator/pkg/controller"
"k8s.io/spark-on-k8s-operator/pkg/initializer"
crdclientset "k8s.io/spark-on-k8s-operator/pkg/client/clientset/versioned"
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -36,6 +32,10 @@ import (
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
crdclientset "k8s.io/spark-on-k8s-operator/pkg/client/clientset/versioned"
"k8s.io/spark-on-k8s-operator/pkg/controller"
"k8s.io/spark-on-k8s-operator/pkg/initializer"
)
var (
@ -43,7 +43,7 @@ var (
"Overrides any value in kubeconfig. Only required if out-of-cluster.")
kubeConfig = flag.String("kubeConfig", "", "Path to a kube config. Only required if "+
"out-of-cluster.")
enableInitializer = flag.Bool("enable-initializer", true, "Whether to enable the " +
enableInitializer = flag.Bool("enable-initializer", true, "Whether to enable the "+
"Spark pod initializer.")
initializerThreads = flag.Int("initializer-threads", 10, "Number of worker threads "+
"used by the Spark Pod initializer (if it's enabled).")

View File

@ -60,10 +60,10 @@ const (
// SparkApplication represents a Spark application running on and using Kubernetes as a cluster manager.
type SparkApplication struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
Spec SparkApplicationSpec `json:"spec"`
Status SparkApplicationStatus `json:"status,omitempty"`
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
Spec SparkApplicationSpec `json:"spec"`
Status SparkApplicationStatus `json:"status,omitempty"`
}
// SparkApplicationSpec describes the specification of a Spark application using Kubernetes as a cluster manager.
@ -177,9 +177,9 @@ type SparkApplicationStatus struct {
// SparkApplicationList carries a list of SparkApplication objects.
type SparkApplicationList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []SparkApplication `json:"items,omitempty"`
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []SparkApplication `json:"items,omitempty"`
}
// Dependencies specifies all possible types of dependencies of a Spark application.

View File

@ -49,7 +49,7 @@ func AddConfigMapAnnotation(app *v1alpha1.SparkApplication, annotationKeyPrefix
if app.Spec.SparkConf == nil {
app.Spec.SparkConf = make(map[string]string)
}
annotationConfKey := fmt.Sprintf("%s%s", annotationKeyPrefix, key)
_, ok := app.Spec.SparkConf[annotationConfKey]
if !ok {
@ -128,7 +128,7 @@ func MountHadoopConfigMapToContainer(volumeName string, mountPath string, contai
container.Env = append(
container.Env,
apiv1.EnvVar{
Name: SparkClasspathEnvVar,
Name: SparkClasspathEnvVar,
Value: fmt.Sprintf("$%s:$%s", HadoopConfDirEnvVar, SparkClasspathEnvVar),
})
}

View File

@ -26,7 +26,6 @@ import (
"github.com/golang/glog"
apiv1 "k8s.io/api/core/v1"
typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -34,15 +33,16 @@ import (
"k8s.io/apimachinery/pkg/util/wait"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/scheme"
typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/record"
"k8s.io/client-go/util/workqueue"
"k8s.io/spark-on-k8s-operator/pkg/apis/sparkoperator.k8s.io/v1alpha1"
"k8s.io/spark-on-k8s-operator/pkg/crd"
"k8s.io/spark-on-k8s-operator/pkg/util"
crdclientset "k8s.io/spark-on-k8s-operator/pkg/client/clientset/versioned"
crdinformers "k8s.io/spark-on-k8s-operator/pkg/client/informers/externalversions"
"k8s.io/spark-on-k8s-operator/pkg/crd"
"k8s.io/spark-on-k8s-operator/pkg/util"
)
const (

View File

@ -50,10 +50,10 @@ type sparkPodMonitor struct {
// driverStateUpdate encapsulates state update of the driver.
type driverStateUpdate struct {
appID string
podName string
nodeName string
podPhase apiv1.PodPhase
appID string
podName string
nodeName string
podPhase apiv1.PodPhase
completionTime metav1.Time
}

View File

@ -25,8 +25,8 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kubeclientfake "k8s.io/client-go/kubernetes/fake"
"k8s.io/spark-on-k8s-operator/pkg/config"
"k8s.io/spark-on-k8s-operator/pkg/apis/sparkoperator.k8s.io/v1alpha1"
"k8s.io/spark-on-k8s-operator/pkg/config"
)
func TestOnPodAdded(t *testing.T) {

View File

@ -48,8 +48,8 @@ type appStateUpdate struct {
func newSparkSubmitRunner(workers int, appStateReportingChan chan<- appStateUpdate) *sparkSubmitRunner {
return &sparkSubmitRunner{
workers: workers,
queue: make(chan *submission, workers),
workers: workers,
queue: make(chan *submission, workers),
appStateReportingChan: appStateReportingChan,
}
}
@ -86,7 +86,7 @@ func (r *sparkSubmitRunner) runWorker() {
stateUpdate := appStateUpdate{
appID: s.appID,
submissionTime: metav1.Now(),
state: v1alpha1.FailedSubmissionState,
state: v1alpha1.FailedSubmissionState,
}
if exitErr, ok := err.(*exec.ExitError); ok {

View File

@ -18,9 +18,9 @@ package cmd
import (
"fmt"
"io/ioutil"
"net/url"
"os"
"io/ioutil"
"path/filepath"
"github.com/spf13/cobra"
@ -259,7 +259,7 @@ func uploadLocalDependencies(app *v1alpha1.SparkApplication, files []string) ([]
"unable to upload local dependencies: no upload location specified via --upload-to")
}
uploadLocationUrl, err := url.Parse(UploadTo)
uploadLocationUrl, err := url.Parse(UploadTo)
if err != nil {
return nil, err
}

View File

@ -39,7 +39,7 @@ func TestIsLocalFile(t *testing.T) {
assert.Equal(t, test.isLocal, isLocal, "%s: expected %v got %v", test.file, test.isLocal, isLocal)
}
testcases := []testcase {
testcases := []testcase{
{file: "/path/to/file", isLocal: true},
{file: "file:///path/to/file", isLocal: true},
{file: "local:///path/to/file", isLocal: false},
@ -89,7 +89,7 @@ func TestIsContainerLocalFile(t *testing.T) {
"%s: expected %v got %v", test.file, test.isContainerLocal, isLocal)
}
testcases := []testcase {
testcases := []testcase{
{file: "/path/to/file", isContainerLocal: false},
{file: "file:///path/to/file", isContainerLocal: false},
{file: "local:///path/to/file", isContainerLocal: true},
@ -103,8 +103,8 @@ func TestIsContainerLocalFile(t *testing.T) {
func TestHasNonContainerLocalFiles(t *testing.T) {
type testcase struct {
name string
spec v1alpha1.SparkApplicationSpec
name string
spec v1alpha1.SparkApplicationSpec
hasNonContainerLocalFiles bool
}
@ -161,8 +161,8 @@ func TestHasNonContainerLocalFiles(t *testing.T) {
func TestValidateSpec(t *testing.T) {
type testcase struct {
name string
spec v1alpha1.SparkApplicationSpec
name string
spec v1alpha1.SparkApplicationSpec
expectsValidationError bool
}
@ -218,7 +218,7 @@ func TestValidateSpec(t *testing.T) {
{
name: "application with remote main file and spec.image",
spec: v1alpha1.SparkApplicationSpec{
Image: &image,
Image: &image,
MainApplicationFile: &remoteMainAppFile,
},
expectsValidationError: false,
@ -226,7 +226,7 @@ func TestValidateSpec(t *testing.T) {
{
name: "application with remote main file and spec.initContainerImage",
spec: v1alpha1.SparkApplicationSpec{
InitContainerImage: &image,
InitContainerImage: &image,
MainApplicationFile: &remoteMainAppFile,
Driver: v1alpha1.DriverSpec{
SparkPodSpec: v1alpha1.SparkPodSpec{

View File

@ -170,4 +170,4 @@ func runPortForward(
}()
return forwarder.ForwardPorts()
}
}

View File

@ -19,8 +19,8 @@ package cmd
import (
"fmt"
"io"
"path/filepath"
"os"
"path/filepath"
"cloud.google.com/go/storage"
"golang.org/x/net/context"
@ -32,7 +32,7 @@ type gcsUploader struct {
client *storage.Client
handle *storage.BucketHandle
bucket string
path string
path string
}
func newGcsUploader(bucket string, path string, projectID string, ctx context.Context) (*gcsUploader, error) {
@ -50,7 +50,7 @@ func newGcsUploader(bucket string, path string, projectID string, ctx context.Co
client: client,
handle: handle.UserProject(projectID),
bucket: bucket,
path: path}
path: path}
return uploader, nil
}

View File

@ -55,4 +55,4 @@ func doList(crdClientset crdclientset.Interface) error {
}
return nil
}
}

View File

@ -20,8 +20,8 @@ import (
"fmt"
"os"
"github.com/spf13/cobra"
"github.com/olekukonko/tablewriter"
"github.com/spf13/cobra"
"k8s.io/spark-on-k8s-operator/pkg/apis/sparkoperator.k8s.io/v1alpha1"
crdclientset "k8s.io/spark-on-k8s-operator/pkg/client/clientset/versioned"

View File

@ -24,4 +24,4 @@ import (
func main() {
cmd.Execute()
}
}