Skip to content

Commit

Permalink
feat(devops): update devops init
Browse files Browse the repository at this point in the history
update devops init

Signed-off-by: ysicing <[email protected]>
  • Loading branch information
ysicing committed Aug 29, 2023
1 parent 94fcad6 commit 0745cd9
Show file tree
Hide file tree
Showing 16 changed files with 109 additions and 209 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
- name: Cache Go Dependencies
uses: magnetikonline/action-golang-cache@v4
with:
Expand Down Expand Up @@ -65,6 +66,7 @@ jobs:
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
- name: Cache Go Dependencies
uses: magnetikonline/action-golang-cache@v4
with:
Expand Down Expand Up @@ -93,6 +95,7 @@ jobs:
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
- name: Cache Go Dependencies
uses: magnetikonline/action-golang-cache@v4
with:
Expand All @@ -116,6 +119,9 @@ jobs:
uses: actions/checkout@v3
- name: Setup Golang
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
- name: Run Coverage
run: make coverage
- name: Upload Coverage to Codecov
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
- name: install task
run: |
echo "install task"
Expand Down Expand Up @@ -77,6 +78,7 @@ jobs:
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
- name: install task
run: |
echo "install task"
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: build for test

env:
# Common versions
GO_VERSION: '1.20'
GO_VERSION: '1.21'
TZ: Asia/Shanghai

permissions: write-all
Expand Down Expand Up @@ -39,6 +39,7 @@ jobs:
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
- name: install gox
run: |
echo "install gox"
Expand Down
117 changes: 0 additions & 117 deletions Makefile

This file was deleted.

2 changes: 2 additions & 0 deletions cmd/flags/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"os"
"strings"

"github.com/davecgh/go-spew/spew"
"github.com/easysoft/qcadmin/internal/pkg/types"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
Expand Down Expand Up @@ -66,6 +67,7 @@ func ConvertFlags(cmd *cobra.Command, fs []types.Flag) *pflag.FlagSet {
case int:
pf.IntVar(f.P.(*int), f.Name, t, f.Usage)
default:
spew.Dump(t)
continue
}
if f.Required {
Expand Down
3 changes: 0 additions & 3 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ func newCmdInit(f factory.Factory) *cobra.Command {
log.Errorf("init quickon failed, reason: %v", err)
return
}
if !meta.QuickonOSS {
meta.QuickonType = common.QuickonEEType
}
if len(meta.IP) == 0 {
// TODO fix ip, not allow PublicIP
cfg, _ := config.LoadConfig()
Expand Down
4 changes: 0 additions & 4 deletions cmd/quickon/quickon.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ package quickon

import (
"github.com/easysoft/qcadmin/cmd/flags"
"github.com/easysoft/qcadmin/common"
"github.com/easysoft/qcadmin/internal/app/config"
"github.com/easysoft/qcadmin/internal/pkg/types"
"github.com/easysoft/qcadmin/internal/pkg/util/factory"
Expand Down Expand Up @@ -55,9 +54,6 @@ func InitCommand(f factory.Factory) *cobra.Command {
}

initCmd.RunE = func(cmd *cobra.Command, args []string) error {
if !meta.QuickonOSS {
meta.QuickonType = common.QuickonEEType
}
if err := cp.GetKubeClient(); err != nil {
return err
}
Expand Down
6 changes: 5 additions & 1 deletion common/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ const (
const (
DefaultQuickonOSSVersion = "stable-2.6" // 开源版本
DefaultQuickonEEVersion = "stable-1.0"
DefaultZentaoDevOPSOSSVersion = "stable-1.0"
DefaultZentaoDevOPSOSSVersion = "18.6"
DefaultZentaoDevOPSMaxVersion = "4.6"
DefaultZentaoDevOPSBizVersion = "8.6"
DefaultZentaoDevOPSIPDVersion = "1.0.1"
K3sBinName = "k3s"
K3sBinPath = "/usr/local/bin/k3s"
HelmBinName = "helm"
Expand Down Expand Up @@ -94,6 +97,7 @@ const (
DefaultCneOperatorName = "cne-operator"
DefaultIngressName = "nginx-ingress-controller"
DefaultDBName = "qucheng-mysql"
DefaultKubeAPIDomain = "kubeapi.k7s.local"
InitFileName = ".initdone"
InitLockFileName = ".qlock"
InitModeCluster = ".incluster"
Expand Down
38 changes: 14 additions & 24 deletions common/func.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,29 +81,26 @@ func GetChannel(p string) string {
return p
}

// GetVersion 获取chartRepo channel地址
func GetVersion(p string, qt QuickonType) string {
v := strings.Split(p, "-")
// GetVersion 获取版本地址
func GetVersion(version string) string {
v := strings.Split(version, "-")
if len(v) != 2 {
if qt == QuickonOSSType {
return GetVersion(DefaultQuickonOSSVersion, qt)
}
return GetVersion(DefaultQuickonEEVersion, qt)
return version
}
return v[1]
}

// GetZenTaoVersion 获取chartRepo channel地址
func GetZenTaoVersion(p string, qt QuickonType) string {
v := strings.Split(p, "-")
if len(v) != 2 {
if qt == QuickonOSSType {
return GetVersion(DefaultZentaoDevOPSOSSVersion, qt)
}
return GetVersion(DefaultZentaoDevOPSOSSVersion, qt)
}
return v[1]
}
// func GetZenTaoVersion(p string, qt QuickonType) string {
// v := strings.Split(p, "-")
// if len(v) != 2 {
// if qt == QuickonOSSType {
// return GetVersion(DefaultZentaoDevOPSOSSVersion, qt)
// }
// return GetVersion(DefaultZentaoDevOPSOSSVersion, qt)
// }
// return v[1]
// }

func GetDefaultConfig() string {
home := zos.GetHomeDir()
Expand Down Expand Up @@ -181,13 +178,6 @@ func GetDefaultQuickONNamespace() []string {
return ns
}

func GetQuickONName(devops bool, t QuickonType) string {
if t == QuickonOSSType {
return GetReleaseName(devops)
}
return fmt.Sprintf("%s-biz", GetReleaseName(devops))
}

func GetCustomScripts(path string) string {
return fmt.Sprintf("%s/%s", GetDefaultDataDir(), path)
}
Expand Down
10 changes: 8 additions & 2 deletions common/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,16 @@ type cloudAPIS struct {
type QuickonType string

var (
QuickonOSSType QuickonType = "oss" // 开源版
QuickonEEType QuickonType = "ee" // 企业版
ZenTaoOSSType QuickonType = "oss" // 开源版
ZenTaoMaxType QuickonType = "max" // 旗舰版
ZenTaoBizType QuickonType = "biz" // 企业版
ZenTaoIPDType QuickonType = "ipd" // IPD版
)

func (q QuickonType) String() string {
return string(q)
}

type InstallType string

var (
Expand Down
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ require (
gopkg.in/natefinch/lumberjack.v2 v2.2.1
gotest.tools v2.2.0+incompatible
helm.sh/helm/v3 v3.12.3
k8s.io/api v0.28.0
k8s.io/apimachinery v0.28.0
k8s.io/cli-runtime v0.28.0
k8s.io/client-go v0.28.0
k8s.io/component-base v0.28.0
k8s.io/kubectl v0.28.0
k8s.io/metrics v0.28.0
k8s.io/api v0.28.1
k8s.io/apimachinery v0.28.1
k8s.io/cli-runtime v0.28.1
k8s.io/client-go v0.28.1
k8s.io/component-base v0.28.1
k8s.io/kubectl v0.28.1
k8s.io/metrics v0.28.1
k8s.io/system-validators v1.7.0
k8s.io/utils v0.0.0-20230726121419-3b25d923346b
sigs.k8s.io/yaml v1.3.0
Expand Down Expand Up @@ -217,7 +217,7 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.28.0 // indirect
k8s.io/apiserver v0.28.0 // indirect
k8s.io/component-helpers v0.28.0 // indirect
k8s.io/component-helpers v0.28.1 // indirect
k8s.io/klog/v2 v2.100.1 // indirect
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
oras.land/oras-go v1.2.3 // indirect
Expand Down
Loading

0 comments on commit 0745cd9

Please sign in to comment.