diff --git a/internal/app/config/config.go b/internal/app/config/config.go index 3f5c0ff3..322f003e 100644 --- a/internal/app/config/config.go +++ b/internal/app/config/config.go @@ -54,6 +54,12 @@ type Install struct { type Quickon struct { Type common.QuickonType `yaml:"type" json:"type"` DevOps bool `yaml:"devops" json:"devops"` + Domain Domain `yaml:"domain" json:"domain"` +} + +type Domain struct { + Type string `yaml:"type" json:"type"` + Name string `yaml:"name" json:"name"` } type Cluster struct { diff --git a/internal/pkg/status/status.go b/internal/pkg/status/status.go index fa92d628..b4b66654 100644 --- a/internal/pkg/status/status.go +++ b/internal/pkg/status/status.go @@ -124,9 +124,14 @@ func (s *Status) Format() error { consoleURL := "" if len(domain) > 0 { if !kutil.IsLegalDomain(domain) { - domain = fmt.Sprintf("http://console.%s", domain) + if cfg.Quickon.DevOps { + consoleURL = fmt.Sprintf("http://zentao.%s", domain) + } else { + consoleURL = fmt.Sprintf("http://console.%s", domain) + } + } else { + consoleURL = fmt.Sprintf("https://%s", domain) } - consoleURL = domain } else { consoleURL = fmt.Sprintf("http://%s:32379", loginIP) } diff --git a/pkg/providers/devops/devops.go b/pkg/providers/devops/devops.go index 30bb453d..254e24cf 100644 --- a/pkg/providers/devops/devops.go +++ b/pkg/providers/devops/devops.go @@ -82,7 +82,7 @@ func (q *Devops) Show() { q.MetaData.Log.Info("----------------------------\t") if len(domain) > 0 { - if !kutil.IsLegalDomain(cfg.Domain) { + if !kutil.IsLegalDomain(cfg.Domain) || cfg.Quickon.Domain.Type != "api" { domain = fmt.Sprintf("http://zentao.%s", cfg.Domain) } else { domain = fmt.Sprintf("https://%s", cfg.Domain) diff --git a/pkg/quickon/quickon.go b/pkg/quickon/quickon.go index a1d65090..69b5cc02 100644 --- a/pkg/quickon/quickon.go +++ b/pkg/quickon/quickon.go @@ -47,6 +47,7 @@ type Meta struct { App string kubeClient *k8s.Client Log log.Logger + DomainType string } func New(f factory.Factory) *Meta { @@ -55,6 +56,7 @@ func New(f factory.Factory) *Meta { // Version: common.DefaultQuickonOSSVersion, ConsolePassword: expass.PwGenAlphaNum(32), Type: common.ZenTaoOSSType.String(), + DomainType: "custom", } } @@ -228,6 +230,7 @@ func (m *Meta) Init() error { return false, err } m.Domain = domain + m.DomainType = "api" m.Log.Infof("generate suffix domain: %s, ip: %v", color.SGreen(m.Domain), color.SGreen(m.IP)) return true, nil }) @@ -274,6 +277,8 @@ func (m *Meta) Init() error { cfg.Domain = m.Domain cfg.APIToken = token + cfg.Quickon.Domain.Name = m.Domain + cfg.Quickon.Domain.Type = m.DomainType cfg.S3.Username = expass.PwGenAlphaNum(8) cfg.S3.Password = expass.PwGenAlphaNum(16) cfg.SaveConfig() @@ -311,7 +316,7 @@ func (m *Meta) Init() error { helmargs = append(helmargs, "--set", "cloud.selectVersion=true") } hostdomain := m.Domain - if kutil.IsLegalDomain(hostdomain) { + if kutil.IsLegalDomain(hostdomain) && m.DomainType == "api" { helmargs = append(helmargs, "--set", "ingress.tls.enabled=true") helmargs = append(helmargs, "--set", "ingress.tls.secretName=tls-haogs-cn") } else {