Skip to content

Commit

Permalink
refactor(master): cloud,app feature close (#774)
Browse files Browse the repository at this point in the history
* refactor(master): cloud,app feature close
  • Loading branch information
cuisongliu authored Dec 29, 2021
1 parent 66b7568 commit 791cbfd
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ dist
.vscode
test/Note.md
.ossutil_checkpoint
bin
.run
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ linters:
enable:
- gofmt
- goimports
- golint
- revive
- stylecheck
- goconst
- gosimple
Expand Down
3 changes: 3 additions & 0 deletions cmd/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"fmt"
"os"

"github.com/fanux/sealos/pkg/logger"

"github.com/fanux/sealgate/cloud"
"github.com/spf13/cobra"

Expand All @@ -32,6 +34,7 @@ var cloudCmd = &cobra.Command{
Short: "sealos on cloud",
Long: `sealos will create vms vpc switch security group on cloud and install kubernetes on it`,
Run: func(cmd *cobra.Command, args []string) {
logger.Fatal("the cloud feature not support")
fmt.Println("install kubernetes on cloud...")
var key, sec string
if key = os.Getenv("ACCESS_KEY_ID"); key != "" {
Expand Down
3 changes: 3 additions & 0 deletions cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ package cmd
import (
"os"

"github.com/fanux/sealos/pkg/logger"

"github.com/spf13/cobra"

"github.com/fanux/sealos/install"
Expand Down Expand Up @@ -48,6 +50,7 @@ var deleteCmd = &cobra.Command{
_ = appmanager.DeleteApp(cfg, cfgFile)
},
PreRun: func(cmd *cobra.Command, args []string) {
logger.Fatal("the delete app feature not support")
if install.ExitDeleteCase(AppURL) {
_ = cmd.Help()
os.Exit(install.ErrorExitOSCase)
Expand Down
5 changes: 4 additions & 1 deletion cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ package cmd
import (
"os"

"github.com/fanux/sealos/pkg/logger"

"github.com/spf13/cobra"

"github.com/fanux/sealos/cert"
Expand All @@ -26,7 +28,7 @@ import (

var (
AppURL string
installExample string = `
installExample = `
# when usr -f flag , you need add something to config file.
# Apply the configuration in values.yaml to a kubernetes Cluster.
sealos install --pkg-url /root/dashboard.tar -f values.yaml
Expand All @@ -51,6 +53,7 @@ var installCmd = &cobra.Command{
_ = appmanager.InstallApp(cfg, cfgFile)
},
PreRun: func(cmd *cobra.Command, args []string) {
logger.Fatal("the install app feature not support")
if install.ExitInstallCase(AppURL) {
_ = cmd.Help()
os.Exit(install.ErrorExitOSCase)
Expand Down
4 changes: 1 addition & 3 deletions cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ func init() {
// see also https://github.com/LinuxSuRen/cobra-extension/issues/6
const name = "sealos"
verCmd := extver.NewVersionCmd("fanux", name, name, func(ver string) string {
if strings.HasPrefix(ver, "v") {
ver = strings.TrimPrefix(ver, "v")
}
ver = strings.TrimPrefix(ver, "v")
return fmt.Sprintf("https://github.com/fanux/sealos/releases/download/v%s/%s_%s_%s_%s.tar.gz",
ver, name, ver, runtime.GOOS, runtime.GOARCH)
})
Expand Down
File renamed without changes.
4 changes: 1 addition & 3 deletions install/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,7 @@ func getLocalURL(version string) string {
func newCommand(c *Cluster) string {
//TODO should download it on master0 and copy to other nodes
version := extver.GetVersion()
if strings.HasPrefix(version, "v") {
version = strings.TrimPrefix(version, "v")
}
version = strings.TrimPrefix(version, "v")
releaseURL := fmt.Sprintf("https://github.com/fanux/sealos/releases/download/v%s/sealos_%s_linux_amd64.tar.gz",
version, version)
cmd := fmt.Sprintf("wget %s -O -| tar -xz && chmod +x sealos", releaseURL)
Expand Down
2 changes: 1 addition & 1 deletion install/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func IPFormat(host string) string {

// RandString 生成随机字符串
func RandString(len int) string {
var r *rand.Rand = rand.New(rand.NewSource(time.Now().Unix()))
var r = rand.New(rand.NewSource(time.Now().Unix()))
bytes := make([]byte, len)
for i := 0; i < len; i++ {
b := r.Intn(26) + 65
Expand Down
2 changes: 1 addition & 1 deletion pkg/logger/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (r *LocalLogger) SetLogger(adapterName string, configs ...string) error {
}

config := append(configs, "{}")[0]
var num int = -1
var num = -1
var i int
var l *nameLogger
for i, l = range r.outputs {
Expand Down

0 comments on commit 791cbfd

Please sign in to comment.