Skip to content

Commit

Permalink
Print more cluster info when setting multi-cluster (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinuxSuRen committed Sep 11, 2021
1 parent a23ec63 commit 54c19bc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
28 changes: 17 additions & 11 deletions kubectl-plugin/common/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,23 @@ type KSInstallerSpec struct {
Version string
ImageNamespace string

Servicemesh ComponentStatus
Openpitrix ComponentStatus
Notification ComponentStatus
NetworkPolicy ComponentStatus
MetricsServer ComponentStatus
Logging ComponentStatus
Events ComponentStatus
DevOps ComponentStatus
Auditing ComponentStatus
Alerting ComponentStatus
Multicluster Multicluster `yaml:"multicluster"`
Authentication Authentication `yaml:"authentication"`
Servicemesh ComponentStatus
Openpitrix ComponentStatus
Notification ComponentStatus
NetworkPolicy ComponentStatus
MetricsServer ComponentStatus
Logging ComponentStatus
Events ComponentStatus
DevOps ComponentStatus
Auditing ComponentStatus
Alerting ComponentStatus
Multicluster Multicluster `yaml:"multicluster"`
}

// Authentication represents the Authentication of KubeSphere
type Authentication struct {
JwtSecret string `yaml:"jwtSecret"`
}

// ComponentStatus is a common status
Expand Down
5 changes: 4 additions & 1 deletion kubectl-plugin/config/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ func (o *clusterOption) showClusterRole() (err error) {
installer := common.KSInstaller{}
if err = yaml.Unmarshal(yamlData, &installer); err == nil {
fmt.Printf("cluster role: %s\n", installer.Spec.Multicluster.ClusterRole)
if installer.Spec.Multicluster.ClusterRole == "member" {
fmt.Printf("host cluster jwtSecret: %s\n", installer.Spec.Authentication.JwtSecret)
}
}
}

Expand All @@ -117,7 +120,7 @@ func (o *clusterOption) showClusterRole() (err error) {

cfg := kubeSphereConfig{}
if err = yaml.Unmarshal([]byte(fmt.Sprintf("%v", kubeSphereCfg)), &cfg); err == nil {
fmt.Printf("jwtSecret: %s\n", cfg.Authentication.JwtSecret)
fmt.Printf("current jwtSecret: %s\n", cfg.Authentication.JwtSecret)
}
}
return
Expand Down

0 comments on commit 54c19bc

Please sign in to comment.