diff --git a/Dockerfile b/Dockerfile index 70645da..b205db0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,10 +2,10 @@ FROM golang:1.13.5-alpine3.10 WORKDIR /build COPY . . RUN apk --no-cache add build-base -RUN GOOS=linux go build -a -ldflags '-s -w -extldflags "-static"' -o launchpad . +RUN GOOS=linux go build -a -ldflags '-s -w -extldflags "-static"' -o galaxy . FROM alpine:3.10 RUN apk --no-cache add ca-certificates -WORKDIR /launchpad -COPY --from=0 /build/launchpad . -CMD ["./launchpad", "runner"] \ No newline at end of file +WORKDIR /galaxy +COPY --from=0 /build/galaxy . +CMD ["./galaxy", "runner"] \ No newline at end of file diff --git a/README.md b/README.md index af461e2..cf0dda2 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -#Launchpad +#galaxy diff --git a/actions.go b/actions.go index 16e60f3..42e170a 100644 --- a/actions.go +++ b/actions.go @@ -1,18 +1,27 @@ package main import ( + "context" + "encoding/json" "errors" + "fmt" "os" "strings" "github.com/sirupsen/logrus" "github.com/urfave/cli" - "github.com/spaceuptech/launchpad/proxy" - "github.com/spaceuptech/launchpad/runner" - "github.com/spaceuptech/launchpad/runner/driver" - "github.com/spaceuptech/launchpad/server" - "github.com/spaceuptech/launchpad/utils/auth" + "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/mount" + "github.com/docker/docker/client" + "github.com/spaceuptech/galaxy/cmd" + "github.com/spaceuptech/galaxy/model" + "github.com/spaceuptech/galaxy/proxy" + "github.com/spaceuptech/galaxy/runner" + "github.com/spaceuptech/galaxy/runner/driver" + "github.com/spaceuptech/galaxy/server" + "github.com/spaceuptech/galaxy/utils/auth" ) func actionRunner(c *cli.Context) error { @@ -103,3 +112,107 @@ func setLogLevel(loglevel string) { logrus.SetLevel(logrus.InfoLevel) } } + +type actionCode struct { + service *model.Service + isDeploy bool +} + +func actionStartCode(c *cli.Context) error { + envID := c.String("env") + service, loginResp, err := cmd.CodeStart(envID) + if err != nil { + return err + } + actionCodeStruct := actionCode{ + service: service, + isDeploy: false, + } + if err := runDockerFile(actionCodeStruct, loginResp); err != nil { + return err + } + return nil +} + +func actionBuildCode(c *cli.Context) error { + envID := c.String("env") + service, loginResp, err := cmd.CodeStart(envID) + if err != nil { + return err + } + actionCodeStruct := actionCode{ + service: service, + isDeploy: true, + } + if err := runDockerFile(actionCodeStruct, loginResp); err != nil { + return err + } + return nil +} + +func actionLogin(c *cli.Context) error { + userName := c.String("username") + key := c.String("key") + local := c.Bool("local") + url := "url1" + if local { + url = "ur2" + } + if c.String("url") != "default url" { + url = c.String("url") + } + if err := cmd.LoginStart(userName, key, url, local); err != nil { + return err + } + return nil +} + +func runDockerFile(s actionCode, loginResp *model.LoginResponse) error { + dir, err := os.Getwd() + if err != nil { + return err + } + sa, err := json.Marshal(s) + if err != nil { + return err + } + ctx := context.Background() + cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()) + if err != nil { + return err + } + resp, err := cli.ContainerCreate(ctx, + &container.Config{ + Image: s.service.Tasks[0].Docker.Image, + Env: []string{ + "FILE_PATH=/", + fmt.Sprintf("URL=%s", s.service.Tasks[0].Env["URL"]), + fmt.Sprintf("TOKEN=%s", loginResp.FileToken), + fmt.Sprintf("meta=%s", string(sa))}, + }, + &container.HostConfig{Mounts: []mount.Mount{ + { + Type: mount.TypeBind, + Source: dir, + Target: "/build", + }, + }}, nil, "") + if err != nil { + return err + } + if err := cli.ContainerStart(ctx, resp.ID, types.ContainerStartOptions{}); err != nil { + return err + } + return nil +} + +func actionSetup(c *cli.Context) error { + driver := c.String("driver") + switch driver { + case "kubernetes": + cmd.SetKubernetes() + case "docker": + return cmd.SetDocker() + } + return nil +} diff --git a/cmd/code.go b/cmd/code.go new file mode 100644 index 0000000..c4acfca --- /dev/null +++ b/cmd/code.go @@ -0,0 +1,114 @@ +package cmd + +import ( + "strings" + + "github.com/AlecAivazis/survey/v2" + "github.com/spaceuptech/galaxy/model" +) + +//CodeStart starts the code commands +func CodeStart(envID string) (*model.Service, *model.LoginResponse, error) { + credential, err := getCreds() + if err != nil { + return nil, nil, err + } + + selectedAccount := getSelectedAccount(credential) + + loginRes, err := login(selectedAccount) + if err != nil { + return nil, nil, err + } + + c, err := getServiceConfig(".galaxy.yaml") + if err != nil { + c, err = generateServiceConfig(loginRes.Projects, selectedAccount, envID) + if err != nil { + return nil, nil, err + } + } + return c, loginRes, nil +} + +func generateServiceConfig(projects []model.Projects, selectedaccount *model.Account, envID string) (*model.Service, error) { + progLang, err := getProgLang() + if err != nil { + return nil, err + } + var envNameID string + var clusters []string + serviceName := "" + if err := survey.AskOne(&survey.Input{Message: "Enter Service Name"}, &serviceName); err != nil { + return nil, err + } + defaultServiceID := strings.ReplaceAll(serviceName, " ", "-") + serviceID := "" + if err := survey.AskOne(&survey.Input{Message: "Enter Service ID", Default: strings.ToLower(defaultServiceID)}, &serviceID); err != nil { + return nil, err + } + var port int32 + if err := survey.AskOne(&survey.Input{Message: "Enter Service Port"}, &port); err != nil { + return nil, err + } + projectNameID := "" + if err := survey.AskOne(&survey.Select{Message: "Select Project Name", Options: getProjects(projects)}, &projectNameID); err != nil { + return nil, err + } + + temp := strings.Split(projectNameID, " ") + projectID := temp[0] + + var project model.Projects + if envID == "none" { + project, err := getProject(projectID, projects) + if err != nil { + return nil, err + } + if err := survey.AskOne(&survey.Select{Message: "Select Environment", Options: getEnvironments(project)}, &envNameID); err != nil { + return nil, err + } + temp := strings.Split(envNameID, " ") + envID = temp[0] + } + + selectedEnv, err := getEnvironment(envID, project.Environments) + if err != nil { + return nil, err + } + if err := survey.AskOne(&survey.MultiSelect{Message: "Select Clusters", Options: getClusters(selectedEnv)}, &clusters); err != nil { + return nil, err + } + var progCmd string + if err := survey.AskOne(&survey.Input{Message: "Enter Run Cmd", + Default: strings.Join(getCmd(progLang), " ")}, &progCmd); err != nil { + return nil, err + } + img, err := getImage(progLang) + if err != nil { + return nil, err + } + + c := &model.Service{ + ID: serviceID, + Name: serviceName, + ProjectID: projectID, + Environment: envID, + Version: "v1", + Scale: model.ScaleConfig{Replicas: 0, MinReplicas: 0, MaxReplicas: 100, Concurrency: 50}, + Tasks: []model.Task{ + { + ID: serviceID, + Name: serviceName, + Ports: []model.Port{model.Port{Protocol: "http", Port: port}}, + Resources: model.Resources{CPU: 250, Memory: 512}, + Docker: model.Docker{Image: img}, + Env: map[string]string{"URL": selectedaccount.ServerUrl, "Cmd": progCmd}, + }, + }, + Whitelist: []string{"project:*"}, + Upstreams: []model.Upstream{model.Upstream{ProjectID: projectID, Service: "*"}}, + Runtime: "code", + } + return c, nil +} diff --git a/cmd/creds.go b/cmd/creds.go new file mode 100644 index 0000000..e35df69 --- /dev/null +++ b/cmd/creds.go @@ -0,0 +1,66 @@ +package cmd + +import ( + "fmt" + "io/ioutil" + + "github.com/spaceuptech/galaxy/model" + "gopkg.in/yaml.v2" +) + +func getSelectedAccount(credential *model.Credential) *model.Account { + var selectedaccount model.Account + for _, v := range credential.Accounts { + if credential.SelectedAccount == v.ID { + selectedaccount = v + } + } + return &selectedaccount +} + +func getCreds() (*model.Credential, error) { + fileName := fmt.Sprintf("/%s/galaxy/config.yaml", getHomeDirectory()) + yamlFile, err := ioutil.ReadFile(fileName) + if err != nil { + return nil, fmt.Errorf("error reading yaml file: %s", err) + } + + credential := new(model.Credential) + if err := yaml.Unmarshal(yamlFile, credential); err != nil { + return nil, err + } + return credential, nil +} + +func checkCred(selectedAccount *model.Account) error { + fileName := fmt.Sprintf("/%s/galaxy/config.yaml", getHomeDirectory()) + yamlFile, err := ioutil.ReadFile(fileName) + if err != nil { + credential := model.Credential{ + Accounts: []model.Account{*selectedAccount}, + SelectedAccount: selectedAccount.ID, + } + if err := generateYamlFile(&credential); err != nil { + return err + } + } + credential := new(model.Credential) + if err := yaml.Unmarshal(yamlFile, credential); err != nil { + return err + } + for _, val := range credential.Accounts { + if val.ID == selectedAccount.ID { + val.ID, val.UserName, val.Key, val.ServerUrl = selectedAccount.ID, selectedAccount.UserName, selectedAccount.Key, selectedAccount.ServerUrl + if err := generateYamlFile(credential); err != nil { + return err + } + return nil + } + } + credential.Accounts = append(credential.Accounts, *selectedAccount) + credential.SelectedAccount = selectedAccount.ID + if err := generateYamlFile(credential); err != nil { + return err + } + return nil +} diff --git a/cmd/helper.go b/cmd/helper.go new file mode 100644 index 0000000..28b2e34 --- /dev/null +++ b/cmd/helper.go @@ -0,0 +1,170 @@ +package cmd + +import ( + "errors" + "fmt" + "io/ioutil" + "os" + "path/filepath" + "regexp" + "runtime" + + "github.com/spaceuptech/galaxy/model" + "gopkg.in/yaml.v2" +) + +func getHomeDirectory() string { + if runtime.GOOS == "windows" { + home := os.Getenv("HOMEDRIVE") + os.Getenv("HOMEPATH") + if home == "" { + home = os.Getenv("USERPROFILE") + } + return home + } + return os.Getenv("HOME") +} + +func getServiceConfig(filename string) (*model.Service, error) { + dir, err := os.Getwd() + if err != nil { + return nil, err + } + fileName := fmt.Sprintf("/%s/%s", dir, filename) + file, err := ioutil.ReadFile(fileName) + if err != nil { + return nil, err + } + c := new(model.Service) + err = yaml.Unmarshal(file, c) + if err != nil { + return nil, err + } + return c, nil +} + +func checkFile(filename string) bool { + dir, err := os.Getwd() + if err != nil { + return false + } + fileName := fmt.Sprintf("/%s/%s", dir, filename) + _, err = ioutil.ReadFile(fileName) + if err != nil { + return false + } + return true +} + +func getProgLang() (string, error) { + if checkFile("requirement.txt") { + return "python", nil + } + if checkFile("package.json") { + return "node", nil + } + if checkExt(".go") { + return "go", nil + } + return "", fmt.Errorf("No Programming language detected") +} + +func getImage(progLang string) (string, error) { + switch progLang { + case "python": + return "spaceuptech/runtime-python", nil + case "nodejs": + return "spaceuptech/runtime-node", nil + case "go": + return "spaceuptech/runtime-alpine", nil + default: + return "", fmt.Errorf("%s is not supported", progLang) + } +} + +func getCmd(progLang string) []string { + switch progLang { + case "python": + return []string{"python3", "app.py"} + case "nodejs": + return []string{"npm", "start"} + case "go": + return []string{"./app"} + default: + return []string{} + } +} + +func getProject(projectID string, projects []model.Projects) (*model.Projects, error) { + for _, project := range projects { + if projectID == project.ID { + return &project, nil + } + } + return nil, fmt.Errorf("Invalid Project Name") +} + +func getEnvironment(envID string, environments []model.Environment) (*model.Environment, error) { + for _, env := range environments { + if envID == env.ID { + return &env, nil + } + } + return nil, errors.New("Invalid Project Name") +} + +func getProjects(projects []model.Projects) []string { + var projnames []string + for _, val := range projects { + projnames = append(projnames, fmt.Sprintf("%s (%s)", val.ID, val.Name)) + } + return projnames +} + +func getEnvironments(project *model.Projects) []string { + var envs []string + for _, val := range project.Environments { + envs = append(envs, fmt.Sprintf("%s %s", val.ID, val.Name)) + } + return envs +} + +func getClusters(environment *model.Environment) []string { + var clusternames []string + for _, val := range environment.Clusters { + clusternames = append(clusternames, val.ID) + } + return clusternames +} + +func checkExt(ext string) bool { + pathS, err := os.Getwd() + if err != nil { + panic(err) + } + present := false + filepath.Walk(pathS, func(path string, f os.FileInfo, _ error) error { + if !f.IsDir() { + r, err := regexp.MatchString(ext, f.Name()) + if err == nil && r { + present = true + } + } + return nil + }) + return present +} + +func generateYamlFile(credential *model.Credential) error { + d, err := yaml.Marshal(&credential) + if err != nil { + return err + } + + fileName := fmt.Sprintf("/%s/galaxy/config.yaml", getHomeDirectory()) + err = ioutil.WriteFile(fileName, d, 0644) + if err != nil { + return err + } + + return nil +} diff --git a/cmd/login.go b/cmd/login.go new file mode 100644 index 0000000..9a10be6 --- /dev/null +++ b/cmd/login.go @@ -0,0 +1,76 @@ +package cmd + +import ( + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + + "github.com/AlecAivazis/survey/v2" + "github.com/spaceuptech/galaxy/model" + "github.com/spaceuptech/galaxy/utils" +) + +func login(selectedAccount *model.Account) (*model.LoginResponse, error) { + requestBody, err := json.Marshal(map[string]string{ + "username": selectedAccount.UserName, + "key": selectedAccount.Key, + }) + if err != nil { + return nil, err + } + + resp, err := http.Post(fmt.Sprintf("%s/v1/galaxy/login", selectedAccount.ServerUrl), "application/json", bytes.NewBuffer(requestBody)) + if err != nil { + return nil, err + } + defer utils.CloseReaderCloser(resp.Body) + + if resp.StatusCode != 200 { + return nil, err + } + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + loginResp := new(model.LoginResponse) + if err := json.Unmarshal(body, loginResp); err != nil { + return nil, err + } + return loginResp, nil + +} + +//LoginStart logs the user in galaxy +func LoginStart(userName, key, url string, local bool) error { + if userName == "None" { + if err := survey.AskOne(&survey.Input{Message: "Enter username"}, &userName); err != nil { + return err + } + } + if key == "None" { + if err := survey.AskOne(&survey.Input{Message: "Enter key"}, &key); err != nil { + return err + } + } + selectedAccount := model.Account{ + UserName: userName, + Key: key, + ServerUrl: url, + } + loginRes, err := login(&selectedAccount) + if err != nil { + return err + } + selectedAccount = model.Account{ + ID: loginRes.AccountID, + UserName: userName, + Key: key, + ServerUrl: url, + } + if err := checkCred(&selectedAccount); err != nil { + return err + } + return nil +} diff --git a/cmd/setup.go b/cmd/setup.go new file mode 100644 index 0000000..e720af6 --- /dev/null +++ b/cmd/setup.go @@ -0,0 +1,168 @@ +package cmd + +import ( + "context" + "flag" + "os" + "path/filepath" + + "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/mount" + "github.com/docker/docker/client" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/tools/clientcmd" + "k8s.io/client-go/util/homedir" + + appsv1 "k8s.io/api/apps/v1" + apiv1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func SetDocker() error { + dir, err := os.Getwd() + if err != nil { + return err + } + gatewayContainerConfig := container.Config{ + Image: "Gateway", + Env: []string{ + "Two env are yet to be added", + }, + } + gatewayContainerHostConfig := container.HostConfig{ + Mounts: []mount.Mount{ + { + Type: mount.TypeBind, + Source: dir, + Target: "/build", + }, + }, + } + if err := runContainer(gatewayContainerConfig, gatewayContainerHostConfig); err != nil { + return err + } + + configStoreContainerConfig := container.Config{ + Image: "Config-Store", + Env: []string{ + "Two env are yet to be added", + }, + } + configStoreContainerHostConfig := container.HostConfig{ + Mounts: []mount.Mount{ + { + Type: mount.TypeBind, + Source: dir, + Target: "/build", + }, + }, + } + if err := runContainer(configStoreContainerConfig, configStoreContainerHostConfig); err != nil { + return err + } + + runnerContainerConfig := container.Config{ + Image: "Gateway", + Env: []string{ + "Two env are yet to be added", + }, + } + runnerContainerHostConfig := container.HostConfig{ + Mounts: []mount.Mount{ + { + Type: mount.TypeBind, + Source: dir, + Target: "/build", + }, + }, + } + if err := runContainer(runnerContainerConfig, runnerContainerHostConfig); err != nil { + return err + } + + return nil +} + +func runContainer(containerConfig container.Config, containerHostConfig container.HostConfig) error { + ctx := context.Background() + cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()) + if err != nil { + return err + } + resp, err := cli.ContainerCreate(ctx, + &containerConfig, + &containerHostConfig, nil, "") + if err != nil { + return err + } + if err := cli.ContainerStart(ctx, resp.ID, types.ContainerStartOptions{}); err != nil { + return err + } + return nil +} + +func SetKubernetes() error { + var kubeconfig *string + if home := homedir.HomeDir(); home != "" { + kubeconfig = flag.String("kubeconfig", filepath.Join(home, ".kube", "config"), "") + } else { + kubeconfig = flag.String("kubeconfig", "", "absolute path to the kubeconfig file") + } + flag.Parse() + + config, err := clientcmd.BuildConfigFromFlags("", *kubeconfig) + if err != nil { + return err + } + clientset, err := kubernetes.NewForConfig(config) + if err != nil { + return err + } + + deploymentsClient := clientset.AppsV1().Deployments(apiv1.NamespaceDefault) + + deployment := &appsv1.Deployment{ + ObjectMeta: metav1.ObjectMeta{ + Name: "demo-deployment", + }, + Spec: appsv1.DeploymentSpec{ + Replicas: int32Ptr(2), + Selector: &metav1.LabelSelector{ + MatchLabels: map[string]string{ + "app": "demo", + }, + }, + Template: apiv1.PodTemplateSpec{ + ObjectMeta: metav1.ObjectMeta{ + Labels: map[string]string{ + "app": "demo", + }, + }, + Spec: apiv1.PodSpec{ + Containers: []apiv1.Container{ + { + Name: "web", + Image: "nginx:1.12", + Ports: []apiv1.ContainerPort{ + { + Name: "http", + Protocol: apiv1.ProtocolTCP, + ContainerPort: 80, + }, + }, + }, + }, + }, + }, + }, + } + + _, err = deploymentsClient.Create(deployment) + if err != nil { + return err + } + return nil +} + +func int32Ptr(i int32) *int32 { return &i } diff --git a/galaxy b/galaxy new file mode 100755 index 0000000..9bf0917 Binary files /dev/null and b/galaxy differ diff --git a/go.mod b/go.mod index 6db79a4..bc80adf 100644 --- a/go.mod +++ b/go.mod @@ -1,20 +1,31 @@ -module github.com/spaceuptech/launchpad +module github.com/spaceuptech/galaxy go 1.13 require ( + github.com/AlecAivazis/survey/v2 v2.0.5 + github.com/Microsoft/go-winio v0.4.14 // indirect + github.com/containerd/containerd v1.3.2 // indirect github.com/dgraph-io/badger v1.6.0 github.com/dgrijalva/jwt-go v3.2.0+incompatible + github.com/docker/distribution v2.7.1+incompatible // indirect + github.com/docker/docker v1.4.2-0.20190927142053-ada3c14355ce + github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-units v0.4.0 // indirect github.com/gogo/protobuf v1.3.0 github.com/gorilla/mux v1.7.3 github.com/gorilla/websocket v1.4.1 + github.com/kubernetes-client/go v0.0.0-20190928040339-c757968c4c36 + github.com/opencontainers/go-digest v1.0.0-rc1 // indirect + github.com/opencontainers/image-spec v1.0.1 // indirect github.com/rs/cors v1.7.0 github.com/segmentio/ksuid v1.0.2 github.com/sirupsen/logrus v1.4.2 github.com/urfave/cli v1.22.2 + gopkg.in/yaml.v2 v2.2.4 istio.io/api v0.0.0-20191109011911-e51134872853 istio.io/client-go v0.0.0-20191206191348-5c576a7ecef0 - k8s.io/api v0.0.0-20191114100352-16d7abae0d2a - k8s.io/apimachinery v0.0.0-20191028221656-72ed19daf4bb - k8s.io/client-go v0.0.0-20191114101535-6c5935290e33 + k8s.io/api v0.0.0-20191230033939-7dc09db16fb8 + k8s.io/apimachinery v0.0.0-20200106233518-8f98b2385567 + k8s.io/client-go v0.0.0-20200107234521-8ead54f5cff8 ) diff --git a/go.sum b/go.sum index 29c4cd2..bff666c 100644 --- a/go.sum +++ b/go.sum @@ -1,21 +1,34 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0 h1:ROfEUZz+Gh5pa62DJWXSaonyu3StP6EA6lPEXPI6mCo= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +github.com/AlecAivazis/survey/v2 v2.0.5 h1:xpZp+Q55wi5C7Iaze+40onHnEkex1jSc34CltJjOoPM= +github.com/AlecAivazis/survey/v2 v2.0.5/go.mod h1:WYBhg6f0y/fNYUuesWQc0PKbJcEliGcYHB9sNT3Bg74= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9 h1:HD8gA2tkByhMAwYaFAX9w2l7vxvBQ5NMoxDrkhqhtn4= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= +github.com/Azure/go-autorest/autorest v0.9.0 h1:MRvx8gncNaXJqOoLmhNjUAKh33JJF8LyxPhomEtOsjs= github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= +github.com/Azure/go-autorest/autorest/adal v0.5.0 h1:q2gDruN08/guU9vAjuPWff0+QIrpH6ediguzdAzXAUU= github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= +github.com/Azure/go-autorest/autorest/date v0.1.0 h1:YGrhWfrgtFs84+h0o46rJrlmsZtyZRg470CqAXTZaGM= github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= +github.com/Azure/go-autorest/tracing v0.5.0 h1:TRn4WjSnkcSy5AEG3pnbtFSwNtwzjr4VYyQflFE619k= github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/Microsoft/go-winio v0.4.14 h1:+hMXMk01us9KgxGb7ftKQt2Xpf5hH/yky+TDA+qxleU= +github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= +github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nBpB11F9br+3HUrpgb+fcm5iADzXXYEw= +github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc= github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/containerd/containerd v1.3.2 h1:ForxmXkA6tPIvffbrDAcPUIB32QgXkt2XFj+F0UxetA= +github.com/containerd/containerd v1.3.2/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -33,6 +46,16 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumC github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug= +github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/docker v1.4.2-0.20190927142053-ada3c14355ce h1:H3csZuxZESJeeEiOxq4YXPNmLFbjl7u2qVBrAAGX/sA= +github.com/docker/docker v1.4.2-0.20190927142053-ada3c14355ce/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v1.13.0 h1:A5bSnWdwEvPOZ72/0cMjcYIyuvLCHk/KVrT8qOwdKkw= +github.com/docker/docker v1.13.0/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= @@ -42,6 +65,7 @@ github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680 h1:ZktWZesgun21uEDrwW7iEV1zPCGQldM2atlJZ3TdvVM= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= @@ -65,6 +89,7 @@ github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -85,10 +110,13 @@ github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2z github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gregjones/httpcache v0.0.0-20170728041850-787624de3eb7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= +github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174 h1:WlZsjVhE8Af9IcZDGgJGQpNflI3+MJSBhsgT5PCtzBQ= +github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/imdario/mergo v0.3.5 h1:JboBksRwiiAJWvIYJVo46AfV+IAIKZpfrSzVKj42R4Q= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= @@ -96,7 +124,11 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7 h1:KfgG9LzI+pYjr4xvmz/5H4FXjokeP+rlHLhv3iH62Fo= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.8 h1:QiWkFLKq0T7mpzwOTu6BzNDbfTE8OLrYhVKYMLF46Ok= +github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= @@ -104,10 +136,20 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.4 h1:5Myjjh3JY/NaAi4IsUbHADytDyl1VE1Y9PXDlL+P/VQ= +github.com/kr/pty v1.1.4/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kubernetes-client/go v0.0.0-20190928040339-c757968c4c36 h1:/VKCfQgtQxBXEVU9UAJkW/ybm/070TBG57x2wxYUtXI= +github.com/kubernetes-client/go v0.0.0-20190928040339-c757968c4c36/go.mod h1:ks4KCmmxdXksTSu2dlnUanEOqNd/dsoyS6/7bay2RQ8= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU= +github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= +github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -122,8 +164,14 @@ github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+ github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ= +github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= +github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= @@ -141,8 +189,11 @@ github.com/segmentio/ksuid v1.0.2 h1:9yBfKyw4ECGTdALaF09Snw3sLJmYIX6AbPJrAy6MrDc github.com/segmentio/ksuid v1.0.2/go.mod h1:BXuJDr2byAiHuQaQtSKoXh1J0YmUDurywOXgB2w+OSU= github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/spaceuptech/galaxy v0.0.0-20200104102554-37dd7d3161e4 h1:hj+pufYodCpodXwQaSlcNN0R3v3JvozYjJ2F7wGvJVI= +github.com/spaceuptech/galaxy v0.0.0-20200104102554-37dd7d3161e4/go.mod h1:bn9hngEXqg1qMG8UqQdfXewi+G/jyHsCVseCESLdm7s= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= @@ -151,14 +202,18 @@ github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb6 github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/urfave/cli v1.22.2 h1:gsqYFH8bb9ekPA12kRo0hfjngWQjkJPlN9R0N78BoUo= github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= @@ -167,8 +222,10 @@ go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 h1:1wopBVtVdWnn03fZelqdXTqk7U7zPQCb+T4rbU9ZEoU= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392 h1:ACG4HJsFiNMf47Y4PeRoebLNy/2lXT9EtprMuTFWt1M= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -190,6 +247,8 @@ golang.org/x/net v0.0.0-20190812203447-cdfb69ac37fc h1:gkKoSkUmnU6bpS/VhkuO27bzQ golang.org/x/net v0.0.0-20190812203447-cdfb69ac37fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190923162816-aa69164e4478 h1:l5EDrHhldLYb3ZRHDUhXF7Om7MvYXnkV9/iQNo1lX6g= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191004110552-13f9640d40b9 h1:rjwSpXsdiK0dV8/Naq3kAw9ymfAeJIyd0upUIElB+lI= +golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= @@ -201,16 +260,21 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190530182044-ad28b68e88f1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f h1:25KHgbfyiSm6vwQLbM3zZIe1v9p/3ea4Rz+nnM5K/i4= golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe h1:6fAMxZRR6sl1Uq8U61gxU+kPTs2tR8uOySCbBP7BN/M= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -221,6 +285,7 @@ golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c h1:fqgJT0MGcGpPgpWU7VRdRjuArfcOvC4AoJmILihzhDg= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190921001708-c4c64cad1fd0 h1:xQwXv67TxFo9nC1GJFyab5eq/5B590r6RlnL/G8Sz7w= golang.org/x/time v0.0.0-20190921001708-c4c64cad1fd0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -275,22 +340,34 @@ k8s.io/api v0.0.0-20191016110408-35e52d86657a h1:VVUE9xTCXP6KUPMf92cQmN88orz600e k8s.io/api v0.0.0-20191016110408-35e52d86657a/go.mod h1:/L5qH+AD540e7Cetbui1tuJeXdmNhO8jM6VkXeDdDhQ= k8s.io/api v0.0.0-20191114100352-16d7abae0d2a h1:86XISgFlG7lPOWj6wYLxd+xqhhVt/WQjS4Tf39rP09s= k8s.io/api v0.0.0-20191114100352-16d7abae0d2a/go.mod h1:qetVJgs5i8jwdFIdoOZ70ks0ecgU+dYwqZ2uD1srwOU= +k8s.io/api v0.0.0-20191230033939-7dc09db16fb8 h1:GI6HDm5NhWdsVkQPGc+Yxko3ZEn/WJfNUZHmmyFxaQc= +k8s.io/api v0.0.0-20191230033939-7dc09db16fb8/go.mod h1:cUvsxRRcutO57eFbvcbKsHasCbJP9NF8JA7Q9icijjI= k8s.io/apimachinery v0.0.0-20191004115801-a2eda9f80ab8 h1:Iieh/ZEgT3BWwbLD5qEKcY06jKuPEl6zC7gPSehoLw4= k8s.io/apimachinery v0.0.0-20191004115801-a2eda9f80ab8/go.mod h1:llRdnznGEAqC3DcNm6yEj472xaFVfLM7hnYofMb12tQ= k8s.io/apimachinery v0.0.0-20191028221656-72ed19daf4bb h1:ZUNsbuPdXWrj0rZziRfCWcFg9ZP31OKkziqCbiphznI= k8s.io/apimachinery v0.0.0-20191028221656-72ed19daf4bb/go.mod h1:llRdnznGEAqC3DcNm6yEj472xaFVfLM7hnYofMb12tQ= +k8s.io/apimachinery v0.0.0-20191221033353-3253b0a30d67/go.mod h1:f763v4YxJPg8tVQiktAorc+M5Ot35n9qV7zC0bCzr0s= +k8s.io/apimachinery v0.0.0-20200106233518-8f98b2385567 h1:zrH9OPVcoodom9euDC3EGobVISbQHRMLAQCok1/9Kro= +k8s.io/apimachinery v0.0.0-20200106233518-8f98b2385567/go.mod h1:f763v4YxJPg8tVQiktAorc+M5Ot35n9qV7zC0bCzr0s= k8s.io/client-go v0.0.0-20191016111102-bec269661e48/go.mod h1:hrwktSwYGI4JK+TJA3dMaFyyvHVi/aLarVHpbs8bgCU= k8s.io/client-go v0.0.0-20191114101535-6c5935290e33 h1:07mhG/2oEoo3N+sHVOo0L9PJ/qvbk3N5n2dj8IWefnQ= k8s.io/client-go v0.0.0-20191114101535-6c5935290e33/go.mod h1:4L/zQOBkEf4pArQJ+CMk1/5xjA30B5oyWv+Bzb44DOw= +k8s.io/client-go v0.0.0-20200107234521-8ead54f5cff8 h1:gLxprM74W9osPajaLGwsPZFi+hHanvpAdhCXKC/MW6Q= +k8s.io/client-go v0.0.0-20200107234521-8ead54f5cff8/go.mod h1:XbyVlvmKhF4X6DevVvGCklm1/5RaVa+NltG4Oh89Aeo= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v0.3.0 h1:0VPpR+sizsiivjIfIAQH/rl8tan6jvWkS7lU+0di3lE= k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v0.4.0 h1:lCJCxf/LIowc2IGS9TPjWDyXY4nOmdGdfcwwDQCOURQ= k8s.io/klog v0.4.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= +k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= +k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E= +k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E= k8s.io/utils v0.0.0-20190801114015-581e00157fb1 h1:+ySTxfHnfzZb9ys375PXNlLhkJPLKgHajBU0N62BDvE= k8s.io/utils v0.0.0-20190801114015-581e00157fb1/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= +k8s.io/utils v0.0.0-20191217005138-9e5e9d854fcc h1:MUttqhwRgupMiA5ps5F3d2/NLkU8EZSECTGxrQxqM54= +k8s.io/utils v0.0.0-20191217005138-9e5e9d854fcc/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= diff --git a/main.go b/main.go index ad8ac07..d9f3f91 100644 --- a/main.go +++ b/main.go @@ -20,13 +20,13 @@ func main() { logrus.SetOutput(os.Stdout) app := cli.NewApp() - app.Name = "launchpad" + app.Name = "galaxy" app.Version = "0.1.0" app.Commands = []cli.Command{ { Name: "runner", - Usage: "Starts a launchpad runner instance", + Usage: "Starts a galaxy runner instance", Flags: []cli.Flag{ cli.StringFlag{ Name: "port", @@ -82,7 +82,7 @@ func main() { cli.BoolFlag{ Name: "outside-cluster", EnvVar: "OUTSIDE_CLUSTER", - Usage: "Indicates whether launchpad in running inside the cluster", + Usage: "Indicates whether galaxy in running inside the cluster", }, }, Action: actionRunner, @@ -93,9 +93,9 @@ func main() { Flags: []cli.Flag{ cli.StringFlag{ Name: "addr", - Usage: "Address of the launchpad runner instance", + Usage: "Address of the galaxy runner instance", EnvVar: "ADDR", - Value: "runner.launchpad.svc.cluster.local:4050", + Value: "runner.galaxy.svc.cluster.local:4050", }, cli.StringFlag{ Name: "token", @@ -113,7 +113,7 @@ func main() { }, { Name: "server", - Usage: "Starts the launchpad server instance", + Usage: "Starts the galaxy server instance", Flags: []cli.Flag{ cli.StringFlag{ Name: "port", @@ -130,10 +130,82 @@ func main() { }, Action: actionServer, }, + { + Name: "code", + Usage: "Commands to work with non dockerized code", + Subcommands: []cli.Command{ + { + Name: "start", + Flags: []cli.Flag{ + cli.StringFlag{ + Name: "env", + Usage: "Builds and deploys a codebase", + EnvVar: "ENV", + Value: "none", + }, + }, + Action: actionStartCode, + }, + { + Name: "build", + Flags: []cli.Flag{ + cli.StringFlag{ + Name: "env", + Usage: "Builds a codebase", + EnvVar: "ENV", + Value: "none", + }, + }, + Action: actionBuildCode, + }, + }, + }, + { + Name: "Setup", + Usage: "Commands to work with Kubernetes and Docker", + Flags: []cli.Flag{ + cli.StringFlag{ + Name: "driver", + EnvVar: "DRIVER", + Value: "docker", + }, + }, + Action: actionSetup, + }, + { + Name: "login", + Usage: "Commands to log in", + Flags: []cli.Flag{ + cli.StringFlag{ + Name: "username", + Usage: "", + EnvVar: "USERNAME", + Value: "None", + }, + cli.StringFlag{ + Name: "key", + Usage: "", + EnvVar: "KEY", + Value: "None", + }, + cli.StringFlag{ + Name: "url", + Usage: "", + EnvVar: "URL", + Value: "noorain.bolega.com", + }, + cli.BoolFlag{ + Name: "local", + Usage: "", + EnvVar: "LOCAL", + }, + }, + Action: actionLogin, + }, } // Start the app if err := app.Run(os.Args); err != nil { - logrus.Fatalln("Failed to start launchpad:", err) + logrus.Fatalln("Failed to start galaxy:", err) } } diff --git a/model/cli.go b/model/cli.go new file mode 100644 index 0000000..c43b235 --- /dev/null +++ b/model/cli.go @@ -0,0 +1,37 @@ +package model + +type LoginResponse struct { + AccountID string `json:"id" yaml:"id"` + Token string `json:"token" yaml:"token"` + FileToken string `json:"fileToken" yaml:"fileToken"` + Projects []Projects `json:"projects" yaml:"projects"` +} + +type Credential struct { + Accounts []Account `json:"accounts" yaml:"accounts"` + SelectedAccount string `json:"selectedAccount" yaml:"selectedAccount"` +} + +type Account struct { + ID string `json:"id" yaml:"id"` + UserName string `json:"username" yaml:"username"` + Key string `json:"key" yaml:"key"` + ServerUrl string `json:"serverurl" yaml:"serverurl"` +} + +type Projects struct { + Name string `json:"name" yaml:"name"` + ID string `json:"id" yaml:"id"` + Environments []Environment `json:"environment" yaml:"environment"` +} + +type Environment struct { + Name string `json:"name" yaml:"name"` + ID string `json:"id" yaml:"id"` + Clusters []Cluster `json:"clusters" yaml:"clusters"` +} + +type Cluster struct { + ID string `json:"id" yaml:"id"` + URL string `json:"url" yaml:"url"` +} diff --git a/model/service.go b/model/service.go index 3ffb5b5..ece759b 100644 --- a/model/service.go +++ b/model/service.go @@ -2,18 +2,19 @@ package model // Service describes a service's configurations type Service struct { - ID string `json:"id" yaml:"id"` - Name string `json:"name" yaml:"name"` - ProjectID string `json:"projectId" yaml:"projectId"` - Version string `json:"version" yaml:"version"` - Scale ScaleConfig `json:"scale" yaml:"scale"` - Labels map[string]string `json:"labels" yaml:"labels"` - Tasks []Task `json:"tasks" yaml:"tasks"` - Affinity []Affinity `json:"affinity" yaml:"affinity"` - Whitelist []string `json:"whitelist" yaml:"whitelist"` - Upstreams []Upstream `json:"upstreams" yaml:"upstreams"` - Runtime Runtime `json:"runtime" yaml:"runtime"` - Expose *Expose `json:"expose" yaml:"expose"` + ID string `json:"id" yaml:"id"` + Name string `json:"name" yaml:"name"` + ProjectID string `json:"projectId" yaml:"projectId"` + Environment string `json:"env" yaml:"env"` + Version string `json:"version" yaml:"version"` + Scale ScaleConfig `json:"scale" yaml:"scale"` + Labels map[string]string `json:"labels" yaml:"labels"` + Tasks []Task `json:"tasks" yaml:"tasks"` + Affinity []Affinity `json:"affinity" yaml:"affinity"` + Whitelist []string `json:"whitelist" yaml:"whitelist"` + Upstreams []Upstream `json:"upstreams" yaml:"upstreams"` + Runtime Runtime `json:"runtime" yaml:"runtime"` + Expose *Expose `json:"expose" yaml:"expose"` } // ScaleConfig describes the config used to scale a service diff --git a/proxy/metrics.go b/proxy/metrics.go index f2c798e..093ebad 100644 --- a/proxy/metrics.go +++ b/proxy/metrics.go @@ -9,8 +9,8 @@ import ( "github.com/sirupsen/logrus" - "github.com/spaceuptech/launchpad/model" - "github.com/spaceuptech/launchpad/utils" + "github.com/spaceuptech/galaxy/model" + "github.com/spaceuptech/galaxy/utils" ) func (p *Proxy) collectMetrics() (*model.EnvoyMetrics, error) { diff --git a/proxy/proxy.go b/proxy/proxy.go index 40af987..4fce367 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -9,7 +9,7 @@ import ( "github.com/gorilla/websocket" "github.com/sirupsen/logrus" - "github.com/spaceuptech/launchpad/model" + "github.com/spaceuptech/galaxy/model" ) // Proxy is the module which collects metrics from envoy and pushes it to the autoscaler @@ -62,7 +62,7 @@ func (p *Proxy) Start() error { func (p *Proxy) connect() error { logrus.Debugf("Attempting websocket connection with %s", p.addr) - u := url.URL{Scheme: "ws", Host: p.addr, Path: "/v1/launchpad/socket"} + u := url.URL{Scheme: "ws", Host: p.addr, Path: "/v1/galaxy/socket"} c, _, err := websocket.DefaultDialer.Dial(u.String(), http.Header{"Authorization": []string{"Bearer " + p.token}}) if err != nil { return err diff --git a/runner/autoscaler.go b/runner/autoscaler.go index ff4a0c1..b8aeb12 100644 --- a/runner/autoscaler.go +++ b/runner/autoscaler.go @@ -12,7 +12,7 @@ import ( "github.com/segmentio/ksuid" "github.com/sirupsen/logrus" - "github.com/spaceuptech/launchpad/model" + "github.com/spaceuptech/galaxy/model" ) type counter struct { diff --git a/runner/config.go b/runner/config.go index 69b824a..2a42192 100644 --- a/runner/config.go +++ b/runner/config.go @@ -1,8 +1,8 @@ package runner import ( - "github.com/spaceuptech/launchpad/runner/driver" - "github.com/spaceuptech/launchpad/utils/auth" + "github.com/spaceuptech/galaxy/runner/driver" + "github.com/spaceuptech/galaxy/utils/auth" ) // Config is the object required to configure the runner diff --git a/runner/driver/driver.go b/runner/driver/driver.go index 143970e..5d32638 100644 --- a/runner/driver/driver.go +++ b/runner/driver/driver.go @@ -3,8 +3,8 @@ package driver import ( "fmt" - "github.com/spaceuptech/launchpad/model" - "github.com/spaceuptech/launchpad/utils/auth" + "github.com/spaceuptech/galaxy/model" + "github.com/spaceuptech/galaxy/utils/auth" ) // New creates a new instance of the driver module diff --git a/runner/driver/istio.go b/runner/driver/istio.go index 3089508..bbdbc86 100644 --- a/runner/driver/istio.go +++ b/runner/driver/istio.go @@ -16,8 +16,8 @@ import ( "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" - "github.com/spaceuptech/launchpad/model" - "github.com/spaceuptech/launchpad/utils/auth" + "github.com/spaceuptech/galaxy/model" + "github.com/spaceuptech/galaxy/utils/auth" ) // Istio manages the istio on kubernetes deployment target @@ -248,7 +248,7 @@ func (i *Istio) AdjustScale(service *model.Service, activeReqs int32) error { } // Update the virtual service if the new replica count is zero. This is required to redirect incoming http requests to - // the launchpad runner proxy. The proxy is responsible to scale the service back up from zero. + // the galaxy runner proxy. The proxy is responsible to scale the service back up from zero. if replicaCount == 0 { virtualService, err := i.istio.NetworkingV1alpha3().VirtualServices(service.ProjectID).Get(service.ID, metav1.GetOptions{}) if err != nil { diff --git a/runner/driver/istio_helpers.go b/runner/driver/istio_helpers.go index 41f37c0..5920851 100644 --- a/runner/driver/istio_helpers.go +++ b/runner/driver/istio_helpers.go @@ -17,7 +17,7 @@ import ( "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/spaceuptech/launchpad/model" + "github.com/spaceuptech/galaxy/model" ) func getServiceUniqueName(project, service, version string) string { @@ -101,8 +101,8 @@ func (i *Istio) prepareContainers(service *model.Service) []v1.Container { Resources: *generateResourceRequirements(&model.Resources{CPU: 20, Memory: 50}), // Docker related - Image: "spaceuptech/launchpad:latest", - Command: []string{"./launchpad"}, + Image: "spaceuptech/galaxy:latest", + Command: []string{"./galaxy"}, Args: []string{"proxy"}, ImagePullPolicy: v1.PullIfNotPresent, }) @@ -151,12 +151,12 @@ func makeOriginalVirtualService(virtualService *v1alpha3.VirtualService) { func makeScaleZeroVirtualService(virtualService *v1alpha3.VirtualService, proxyPort uint32) { ogHost := fmt.Sprintf("%s.%s.svc.cluster.local", virtualService.Name, virtualService.Namespace) - // Redirect traffic to launchpad runner when no of replicas is equal to zero. The launchpad proxy will scale up the service + // Redirect traffic to galaxy runner when no of replicas is equal to zero. The galaxy proxy will scale up the service // to service incoming requests. for _, httpRoute := range virtualService.Spec.Http { for _, route := range httpRoute.Route { - // Set the destination to launchpad runner proxy - route.Destination.Host = "runner.launchpad.svc.cluster.local" + // Set the destination to galaxy runner proxy + route.Destination.Host = "runner.galaxy.svc.cluster.local" route.Destination.Port.Number = proxyPort // Set the headers @@ -186,7 +186,7 @@ func prepareVirtualServiceRoutes(service *model.Service, proxyPort uint32) ([]*n destHost := fmt.Sprintf("%s.%s.svc.cluster.local", service.ID, service.ProjectID) destPort := uint32(port.Port) - // Redirect traffic to launchpad runner when no of replicas is equal to zero. The launchpad proxy will scale up the service + // Redirect traffic to galaxy runner when no of replicas is equal to zero. The galaxy proxy will scale up the service // to service incoming requests. if service.Scale.Replicas == 0 { headers = &networkingv1alpha3.Headers{ @@ -198,7 +198,7 @@ func prepareVirtualServiceRoutes(service *model.Service, proxyPort uint32) ([]*n }, } retries = &networkingv1alpha3.HTTPRetry{Attempts: 1, PerTryTimeout: &types.Duration{Seconds: 180}} - destHost = "runner.launchpad.svc.cluster.local" + destHost = "runner.galaxy.svc.cluster.local" destPort = proxyPort } @@ -247,7 +247,7 @@ func prepareVirtualServiceRoutes(service *model.Service, proxyPort uint32) ([]*n destHost := fmt.Sprintf("%s.%s.svc.cluster.local", service.ID, service.ProjectID) destPort := uint32(rule.Port) - // Redirect traffic to launchpad runner when no of replicas is equal to zero. The launchpad proxy will scale up the service + // Redirect traffic to galaxy runner when no of replicas is equal to zero. The galaxy proxy will scale up the service // to service incoming requests. if service.Scale.Replicas == 0 { headers = &networkingv1alpha3.Headers{ @@ -259,7 +259,7 @@ func prepareVirtualServiceRoutes(service *model.Service, proxyPort uint32) ([]*n }, } retries = &networkingv1alpha3.HTTPRetry{Attempts: 1, PerTryTimeout: &types.Duration{Seconds: 180}} - destHost = "runner.launchpad.svc.cluster.local" + destHost = "runner.galaxy.svc.cluster.local" destPort = proxyPort } @@ -371,8 +371,8 @@ func prepareAuthPolicyRules(service *model.Service) []*securityv1beta1.Rule { func prepareUpstreamHosts(service *model.Service) []string { hosts := make([]string, len(service.Upstreams)+1) - // First entry will always be launchpad - hosts[0] = "launchpad/*" + // First entry will always be galaxy + hosts[0] = "galaxy/*" for i, upstream := range service.Upstreams { hosts[i+1] = upstream.ProjectID + "/" + upstream.Service diff --git a/runner/handle.go b/runner/handle.go index 9de56ad..f2c6304 100644 --- a/runner/handle.go +++ b/runner/handle.go @@ -11,8 +11,8 @@ import ( "github.com/sirupsen/logrus" - "github.com/spaceuptech/launchpad/model" - "github.com/spaceuptech/launchpad/utils" + "github.com/spaceuptech/galaxy/model" + "github.com/spaceuptech/galaxy/utils" ) func (runner *Runner) handleCreateProject() http.HandlerFunc { diff --git a/runner/routes.go b/runner/routes.go index 2397b89..d7d614a 100644 --- a/runner/routes.go +++ b/runner/routes.go @@ -1,7 +1,7 @@ package runner func (runner *Runner) routes() { - runner.router.Methods("POST").Path("/v1/launchpad/project").HandlerFunc(runner.handleCreateProject()) - runner.router.Methods("POST").Path("/v1/launchpad/service").HandlerFunc(runner.handleServiceRequest()) - runner.router.HandleFunc("/v1/launchpad/socket", runner.handleWebsocketRequest()) + runner.router.Methods("POST").Path("/v1/galaxy/project").HandlerFunc(runner.handleCreateProject()) + runner.router.Methods("POST").Path("/v1/galaxy/service").HandlerFunc(runner.handleServiceRequest()) + runner.router.HandleFunc("/v1/galaxy/socket", runner.handleWebsocketRequest()) } diff --git a/runner/runner.go b/runner/runner.go index 97a00b6..31325ce 100644 --- a/runner/runner.go +++ b/runner/runner.go @@ -11,10 +11,10 @@ import ( "github.com/gorilla/mux" "github.com/sirupsen/logrus" - "github.com/spaceuptech/launchpad/model" - "github.com/spaceuptech/launchpad/runner/driver" - "github.com/spaceuptech/launchpad/utils" - "github.com/spaceuptech/launchpad/utils/auth" + "github.com/spaceuptech/galaxy/model" + "github.com/spaceuptech/galaxy/runner/driver" + "github.com/spaceuptech/galaxy/utils" + "github.com/spaceuptech/galaxy/utils/auth" ) // Runner is the module responsible to manage the runner @@ -57,7 +57,7 @@ func New(c *Config) (*Runner, error) { debounce := utils.NewDebounce() - opts := badger.DefaultOptions("/tmp/launchpad.db") + opts := badger.DefaultOptions("/tmp/galaxy.db") opts.Logger = &logrus.Logger{Out: ioutil.Discard} db, err := badger.Open(opts) if err != nil { diff --git a/runner/websocket.go b/runner/websocket.go index bf5b202..f3f826e 100644 --- a/runner/websocket.go +++ b/runner/websocket.go @@ -6,8 +6,8 @@ import ( "github.com/gorilla/websocket" "github.com/sirupsen/logrus" - "github.com/spaceuptech/launchpad/model" - "github.com/spaceuptech/launchpad/utils" + "github.com/spaceuptech/galaxy/model" + "github.com/spaceuptech/galaxy/utils" ) var upgrader = websocket.Upgrader{} diff --git a/server/config.go b/server/config.go index 9cdfd70..03a7efe 100644 --- a/server/config.go +++ b/server/config.go @@ -1,6 +1,6 @@ package server -// Config describes the config required by the launchpad server +// Config describes the config required by the galaxy server type Config struct { Port string } diff --git a/server/server.go b/server/server.go index 3d40989..5850388 100644 --- a/server/server.go +++ b/server/server.go @@ -7,14 +7,14 @@ import ( "github.com/sirupsen/logrus" ) -// Server modules manager the various clusters of launchpad +// Server modules manager the various clusters of galaxy type Server struct { // For internal use router *mux.Router config *Config } -// New creates a new launchpad server instance +// New creates a new galaxy server instance func New(config *Config) *Server { return &Server{ router: mux.NewRouter(), @@ -22,12 +22,12 @@ func New(config *Config) *Server { } } -// Start begins the launchpad server operations +// Start begins the galaxy server operations func (s *Server) Start() error { // Initialise the routes s.routes() - // Start the launchpad server - logrus.Infof("Starting launchpad server on port %s", s.config.Port) + // Start the galaxy server + logrus.Infof("Starting galaxy server on port %s", s.config.Port) return http.ListenAndServe(":"+s.config.Port, s.router) } diff --git a/utils/auth/keys.go b/utils/auth/keys.go index 1a20d44..d48829e 100644 --- a/utils/auth/keys.go +++ b/utils/auth/keys.go @@ -12,7 +12,7 @@ import ( "github.com/sirupsen/logrus" - "github.com/spaceuptech/launchpad/model" + "github.com/spaceuptech/galaxy/model" ) func (m *Module) setPublicKey(pemData string) error { @@ -37,11 +37,11 @@ func (m *Module) setPublicKey(pemData string) error { // Set the public key m.config.PublicKey = key - logrus.Infoln("Public key of launchpad server set successfully") + logrus.Infoln("Public key of galaxy server set successfully") return nil } -// We need to retrieve the public key used by the launchpad server instance. This needs to be done on a periodic +// We need to retrieve the public key used by the galaxy server instance. This needs to be done on a periodic // basis since the server may generate new pair of public private keys. Let's call this once a week func (m *Module) routineGetPublicKey() { ticker := time.NewTicker(168 * time.Hour) @@ -54,26 +54,26 @@ func (m *Module) fetchPublicKey() (success bool) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() - req, err := http.NewRequestWithContext(ctx, "GET", "http://api.spaceuptech.com/v1/galaxy/launchpad/public-key", nil) + req, err := http.NewRequestWithContext(ctx, "GET", "http://api.spaceuptech.com/v1/galaxy/galaxy/public-key", nil) if err != nil { - logrus.Errorf("Could not fetch launchpad public key - %s", err.Error()) + logrus.Errorf("Could not fetch galaxy public key - %s", err.Error()) return false } res, err := http.DefaultClient.Do(req) if err != nil { - logrus.Errorf("Could not fetch launchpad public key - %s", err.Error()) + logrus.Errorf("Could not fetch galaxy public key - %s", err.Error()) return false } publicKey := new(model.PublicKeyPayload) if err := json.NewDecoder(res.Body).Decode(publicKey); err != nil { - logrus.Errorf("Could not decode launchpad public key payload - %s", err.Error()) + logrus.Errorf("Could not decode galaxy public key payload - %s", err.Error()) return false } if err := m.setPublicKey(publicKey.PemData); err != nil { - logrus.Errorf("Could not parse launchpad public key - %s", err.Error()) + logrus.Errorf("Could not parse galaxy public key - %s", err.Error()) return false }